[RFC libdrm] Add NVIDIA Tegra support
Thierry Reding
thierry.reding at avionic-design.de
Tue Dec 4 23:46:29 PST 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/dri-devel/attachments/20121205/345465a6/attachment.pgp>
More information about the dri-devel
mailing list