diff mbox

[igt,2/9] igt: Add support for DRIVER_VC4 flags on tests.

Message ID 1454535703-660-2-git-send-email-eric@anholt.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Anholt Feb. 3, 2016, 9:41 p.m. UTC
Signed-off-by: Eric Anholt <eric@anholt.net>
---
 lib/drmtest.c | 16 ++++++++++++++--
 lib/drmtest.h |  1 +
 2 files changed, 15 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 2896af0..7b2227f 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -100,6 +100,16 @@  static bool is_i915_device(int fd)
 	return !ret && strcmp("i915", name) == 0;
 }
 
+static bool is_vc4_device(int fd)
+{
+	int ret;
+	char name[5] = "";
+
+	ret = __get_drm_device_name(fd, name);
+
+	return !ret && strcmp("vc4", name) == 0;
+}
+
 static bool is_intel(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -237,7 +247,7 @@  int __drm_open_driver(int chipset)
 	for (int i = 0; i < 16; i++) {
 		char name[80];
 		int fd;
-		bool found_intel;
+		bool found_intel, found_vc4;
 
 		sprintf(name, "/dev/dri/card%u", i);
 		fd = open(name, O_RDWR);
@@ -246,7 +256,9 @@  int __drm_open_driver(int chipset)
 
 		found_intel =  is_i915_device(fd) && is_intel(fd) && (chipset & DRIVER_INTEL);
 
-		if ((chipset & DRIVER_ANY) || found_intel)
+		found_vc4 = is_vc4_device(fd) && (chipset & DRIVER_VC4);
+
+		if ((chipset & DRIVER_ANY) || found_intel || found_vc4)
 			return fd;
 
 		close(fd);
diff --git a/lib/drmtest.h b/lib/drmtest.h
index ed384ff..9fcab93 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -40,6 +40,7 @@ 
 
 #define DRIVER_ANY 0x1
 #define DRIVER_INTEL (0x1 << 1)
+#define DRIVER_VC4 (0x1 << 2)
 
 #ifdef ANDROID
 #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__))