tools/dri3info: Match fd against render nodes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson
2015-02-10 12:12:48 +00:00
parent 27ededdfc7
commit 88db217705

View File

@@ -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)