diff mbox

[i-g-t,6/7] lib/drmtest: Support Tegra

Message ID 20171012132943.28316-6-thierry.reding@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thierry Reding Oct. 12, 2017, 1:29 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

Add a driver definition for Tegra and wire up all the necessary pieces
to identify its devices.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 lib/drmtest.c | 10 ++++++++++
 lib/drmtest.h |  1 +
 2 files changed, 11 insertions(+)
diff mbox

Patch

diff --git a/lib/drmtest.c b/lib/drmtest.c
index f46419ec36cf..e05f88d4a887 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -130,6 +130,11 @@  static bool is_nouveau_device(int fd)
 	return __is_device(fd, "nouveau");
 }
 
+static bool is_tegra_device(int fd)
+{
+	return __is_device(fd, "tegra");
+}
+
 static bool has_known_intel_chipset(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -285,6 +290,9 @@  int __drm_open_driver(int chipset)
 		if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd))
 			return fd;
 
+		if (chipset & DRIVER_TEGRA && is_tegra_device(fd))
+			return fd;
+
 		/* Only VGEM-specific tests should be run on VGEM */
 		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
 			return fd;
@@ -362,6 +370,8 @@  static const char *chipset_to_str(int chipset)
 		return "amdgpu";
 	case DRIVER_NOUVEAU:
 		return "nouveau";
+	case DRIVER_TEGRA:
+		return "tegra";
 	case DRIVER_ANY:
 		return "any";
 	default:
diff --git a/lib/drmtest.h b/lib/drmtest.h
index e54e1b6756af..bdb938ffd9ab 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -44,6 +44,7 @@ 
 #define DRIVER_VIRTIO	(1 << 3)
 #define DRIVER_AMDGPU	(1 << 4)
 #define DRIVER_NOUVEAU	(1 << 5)
+#define DRIVER_TEGRA	(1 << 6)
 /*
  * Exclude DRVER_VGEM from DRIVER_ANY since if you run on a system
  * with vgem as well as a supported driver, you can end up with a