Re: [RFC libdrm] Add NVIDIA Tegra support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/04/2012 05:13 PM, Thierry Reding wrote:
+int drm_tegra_open(const char *path, struct drm_tegra **devicep)
+{
+       struct drm_tegra *device;
+       int err;
+
+       if (!path || !devicep)
+               return -EINVAL;
+
+       device = calloc(1, sizeof(*device));
+       if (!device)
+               return -ENOMEM;
+
+       DRMINITLISTHEAD(&device->bo_list);
+
+       device->fd = open(path, O_RDWR);
+       if (device->fd < 0) {
+               err = -errno;
+               free(device);
+               return err;
+       }
+
+       *devicep = device;
+
+       return 0;
+}

I think you shouldn't ask the path from the application (=DDX) here, but use drmOpen() that automatically finds the correct device for you.

I'd also prefer letting the application open and close the device and modify drm_tegra_open() to take the fd as a parameter. That way the DDX could easily access also all generic libdrm functions.

- Arto
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux