intel: Filter out the control bit from the device minor
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 5 Oct 2013 22:00:49 +0000 (23:00 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 5 Oct 2013 22:00:49 +0000 (23:00 +0100)
When computing the render node for the device, filter out the potential
control node.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/intel_device.c

index 91405fa..0db65ca 100644 (file)
@@ -238,10 +238,10 @@ static char *find_render_node(int fd)
        if (master.st_rdev & 0x80)
                return NULL;
 
-       sprintf(buf, "/dev/dri/renderD%d", (int)((master.st_rdev | 0x80) & 0xff));
+       sprintf(buf, "/dev/dri/renderD%d", (int)((master.st_rdev | 0x80) & 0xbf));
        if (stat(buf, &render) == 0 &&
            master.st_mode == render.st_mode &&
-           render.st_rdev == (master.st_rdev | 0x80))
+           render.st_rdev == ((master.st_rdev | 0x80) & 0xbf))
                return strdup(buf);
 #endif