[RFC PATCH 0/2] libdrm: Add master <> render node helpers

Emil Velikov emil.l.velikov at gmail.com
Sun Feb 1 16:14:53 PST 2015


Hi all,

As mentioned a couple of days ago at #dri-devel some(most) users of 
render nodes tend to rely on strict mapping between the primary and 
render node. I.e. something along the lines of

  fstat(render_fd, &sbuf);
  sprintf(primary_node, "/dev/dri/card%d",
                        ((sbuf.st_rdev & 0x3f) | 0x80));

Currently the following are (ab)using the above code:
 - xf86-video-nouveau
 - xf86-video-intel
 - libva (vaapi)

As reminded by David Herrman, this is not the correct solution - thus 
I've added a couple of helpers which walk through sysfs of the 
respecitive device and return the correct device name.

I'm not 100% happy with the function names, so suggestions are greatly 
appreciated. Any other comments are also welcome :)

Note: BSD guys - you'll likely need your own version of these functions.

Cheers,
Emil

Cc: Thomas Klausner <wiz at NetBSD.org>
Cc: Konstantin Belousov <kib at freebsd.org>
Cc: Robert Millan <rmh at freebsd.org>
Cc: Mark Kettenis <kettenis at openbsd.org>
Cc: Jonathan Gray <jsg at jsg.id.au>
Cc: François Tigeot <ftigeot at wolfpond.org>


More information about the dri-devel mailing list