mirror of
https://github.com/X11Libre/xf86-video-intel.git
synced 2026-03-24 01:24:12 +00:00
tools/dri3info: Match fd against render nodes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
@@ -60,7 +60,7 @@ static void get_device_path(int fd, char *buf, int len)
|
||||
if (fstat(fd, &remote))
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (i = 0; i < 16; i++) {
|
||||
snprintf(buf, len, "/dev/dri/card%d", i);
|
||||
if (stat(buf, &local))
|
||||
continue;
|
||||
@@ -68,10 +68,18 @@ static void get_device_path(int fd, char *buf, int len)
|
||||
if (local.st_mode == remote.st_mode &&
|
||||
local.st_rdev == remote.st_rdev)
|
||||
return;
|
||||
|
||||
snprintf(buf, len, "/dev/dri/renderD%d", i + 128);
|
||||
if (stat(buf, &local))
|
||||
continue;
|
||||
|
||||
if (local.st_mode == remote.st_mode &&
|
||||
local.st_rdev == remote.st_rdev)
|
||||
return;
|
||||
}
|
||||
|
||||
out:
|
||||
strncpy(buf, "unknown card", len);
|
||||
strncpy(buf, "unknown path", len);
|
||||
}
|
||||
|
||||
static void get_driver_name(int fd, char *name, int len)
|
||||
|
||||
Reference in New Issue
Block a user