diff options
author | Thierry Reding <treding@nvidia.com> | 2017-10-12 10:20:02 +0200 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2017-11-06 14:52:04 +0100 |
commit | 15302491d1b63f8a1d4bbb5b7954bcb589a55369 (patch) | |
tree | 0d1438c019161e8e5e6d5e6547de09572460bf5c | |
parent | 1a83a13960af90a349e6f78d0964136905900553 (diff) |
lib/drmtest: Support nouveau
Add a driver definition for nouveau and wire up all the necessary pieces
to identify its devices.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | lib/drmtest.c | 14 | ||||
-rw-r--r-- | lib/drmtest.h | 1 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c index e6bdbc35..cd5e39c9 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -80,7 +80,7 @@ static int __get_drm_device_name(int fd, char *name) drm_version_t version; memset(&version, 0, sizeof(version)); - version.name_len = 4; + version.name_len = 8; version.name = name; if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){ @@ -92,7 +92,7 @@ static int __get_drm_device_name(int fd, char *name) static bool __is_device(int fd, const char *expect) { - char name[5] = ""; + char name[9] = ""; if (__get_drm_device_name(fd, name)) return false; @@ -125,6 +125,11 @@ static bool is_amd_device(int fd) return __is_device(fd, "amdg"); } +static bool is_nouveau_device(int fd) +{ + return __is_device(fd, "nouveau"); +} + static bool has_known_intel_chipset(int fd) { struct drm_i915_getparam gp; @@ -277,6 +282,9 @@ int __drm_open_driver(int chipset) if (chipset & DRIVER_AMDGPU && is_amd_device(fd)) return fd; + if (chipset & DRIVER_NOUVEAU && is_nouveau_device(fd)) + return fd; + /* Only VGEM-specific tests should be run on VGEM */ if (chipset == DRIVER_ANY && !is_vgem_device(fd)) return fd; @@ -352,6 +360,8 @@ static const char *chipset_to_str(int chipset) return "virtio"; case DRIVER_AMDGPU: return "amdgpu"; + case DRIVER_NOUVEAU: + return "nouveau"; case DRIVER_ANY: return "any"; default: diff --git a/lib/drmtest.h b/lib/drmtest.h index a86799d5..e54e1b67 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -43,6 +43,7 @@ #define DRIVER_VGEM (1 << 2) #define DRIVER_VIRTIO (1 << 3) #define DRIVER_AMDGPU (1 << 4) +#define DRIVER_NOUVEAU (1 << 5) /* * 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 |