diff mbox

[i-g-t,2/2] lib/drmtest: add virtio_gpu support

Message ID 1467322187-31530-2-git-send-email-gustavo@padovan.org (mailing list archive)
State New, archived
Headers show

Commit Message

Gustavo Padovan June 30, 2016, 9:29 p.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Support the virtio GPU on drmtest.

Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
 lib/drmtest.c | 9 +++++++++
 lib/drmtest.h | 1 +
 2 files changed, 10 insertions(+)

Comments

Daniel Vetter July 12, 2016, 12:24 p.m. UTC | #1
On Thu, Jun 30, 2016 at 06:29:47PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> 
> Support the virtio GPU on drmtest.
> 
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>

Both applied, thanks for the patches. Aside: i-g-t patches should be
submitted to intel-gfx.
-Daniel

> ---
>  lib/drmtest.c | 9 +++++++++
>  lib/drmtest.h | 1 +
>  2 files changed, 10 insertions(+)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 9f3ac7f..b374006 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -115,6 +115,11 @@ static bool is_vgem_device(int fd)
>  	return __is_device(fd, "vgem");
>  }
>  
> +static bool is_virtio_device(int fd)
> +{
> +	return __is_device(fd, "virt");
> +}
> +
>  static bool has_known_intel_chipset(int fd)
>  {
>  	struct drm_i915_getparam gp;
> @@ -260,6 +265,10 @@ int __drm_open_driver(int chipset)
>  		    is_vgem_device(fd))
>  			return fd;
>  
> +		if (chipset & DRIVER_VIRTIO &&
> +		    is_virtio_device(fd))
> +			return fd;
> +
>  		close(fd);
>  	}
>  
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 8ce32a6..19d4bd1 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -41,6 +41,7 @@
>  #define DRIVER_INTEL	(1 << 0)
>  #define DRIVER_VC4	(1 << 1)
>  #define DRIVER_VGEM	(1 << 2)
> +#define DRIVER_VIRTIO	(1 << 3)
>  #define DRIVER_ANY 	~(DRIVER_VGEM)
>  
>  #ifdef ANDROID
> -- 
> 2.5.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 9f3ac7f..b374006 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -115,6 +115,11 @@  static bool is_vgem_device(int fd)
 	return __is_device(fd, "vgem");
 }
 
+static bool is_virtio_device(int fd)
+{
+	return __is_device(fd, "virt");
+}
+
 static bool has_known_intel_chipset(int fd)
 {
 	struct drm_i915_getparam gp;
@@ -260,6 +265,10 @@  int __drm_open_driver(int chipset)
 		    is_vgem_device(fd))
 			return fd;
 
+		if (chipset & DRIVER_VIRTIO &&
+		    is_virtio_device(fd))
+			return fd;
+
 		close(fd);
 	}
 
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 8ce32a6..19d4bd1 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -41,6 +41,7 @@ 
 #define DRIVER_INTEL	(1 << 0)
 #define DRIVER_VC4	(1 << 1)
 #define DRIVER_VGEM	(1 << 2)
+#define DRIVER_VIRTIO	(1 << 3)
 #define DRIVER_ANY 	~(DRIVER_VGEM)
 
 #ifdef ANDROID