On Wed, Dec 05, 2012 at 09:39:11AM +0200, Arto Merilainen wrote: > 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. Good points, I'll take those into account. Thanks, Thierry
Attachment:
pgpAJkXdyieXK.pgp
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel