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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to