Skip to contentSkip to conversation

lib/drmtest: Allow DRIVER_ANY tests to run on VKMS when supported.

PATCH Superseded Mark Yacoub 2 participants 3 messages Oct 1, 2025 Library code

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/drmtest: Allow DRIVER_ANY tests to run on VKMS when supported.

[Why]
Android's VM use virtio-gpu as its default driver, but VKMS can be enabled on top it.
VKMS is the preferred driver to run IGT.

[How]
To maintain the current way to preferring hardware drivers, introduce a "PREFER_VKMS" flag which does not remove DRIVER_VKMS from the list of drivers to be opened. Android will keep this as always true.

Also, added explicit support for virtio-gpu to be explictly filtered out, making room for VKMS to be the primary driver in use.

Test: kms_bw on AVD

---
 lib/drmtest.c |  1 +
 lib/drmtest.h | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)
lib/drmtest.c +1 -0
index 551385867..a1fb0b5ba 100644
@@ -223,6 +223,7 @@ static const struct module {
 	{ DRIVER_V3D, "v3d" },
 	{ DRIVER_VC4, "vc4" },
 	{ DRIVER_VGEM, "vgem" },
+	{ DRIVER_VIRTIO, "virtio_gpu" },
 	{ DRIVER_VKMS, "vkms" },
 	{ DRIVER_VMWGFX, "vmwgfx" },
 	{ DRIVER_XE, "xe" },
lib/drmtest.h +11 -7
index a9542dde2..32fec584a 100644
@@ -37,6 +37,7 @@
 #include <xf86drm.h>
 
 #include "igt_core.h"
+#include "config.h"
 
 int __get_drm_device_name(int fd, char *name, int name_size);
 
@@ -58,14 +59,17 @@ int __get_drm_device_name(int fd, char *name, int name_size);
 #define DRIVER_VKMS	(1 << 9)
 
 /*
- * 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
- * near-100% skip rate if you don't explicitly specify the device,
- * depending on device-load ordering.
- *
- * Exclude VKMS to prefer hardware drivers.
+ * Exclude DRIVER_VGEM and DRIVER_VIRTIO from DRIVER_ANY since if
+ * you run on a system with vgem or virtio-gpu as well as a supported driver,
+ * you can end up with a near-100% skip rate if you don't explicitly specify
+ * the device, depending on device-load ordering.
  */
-#define DRIVER_ANY	~(DRIVER_VGEM | DRIVER_VKMS)
+#ifdef PREFER_VKMS
+#define DRIVER_ANY	~(DRIVER_VGEM  | DRIVER_VIRTIO)
+#else
+/* Exclude VKMS to prefer hardware drivers if VKMS is not the preferred driver. */
+#define DRIVER_ANY	~(DRIVER_VGEM | DRIVER_VKMS | DRIVER_VIRTIO)
+#endif
 
 /*
  * Compile friendly enum for i915/xe.
Signature · 1 line
2.51.0.618.g983fd99d29-goog
#1 lore raw

Hi Mark,

Quoted 25 lines · Mark Yacoub

[Why]
Android's VM use virtio-gpu as its default driver, but VKMS can be enabled on top it.
VKMS is the preferred driver to run IGT.

[How]
To maintain the current way to preferring hardware drivers, introduce a "PREFER_VKMS" flag which does not remove DRIVER_VKMS from the list of drivers to be opened. Android will keep this as always true.

Also, added explicit support for virtio-gpu to be explictly filtered out, making room for VKMS to be the primary driver in use.

Test: kms_bw on AVD

---
 lib/drmtest.c |  1 +
 lib/drmtest.h | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)
lib/drmtest.c +0 -0
index 551385867..a1fb0b5ba 100644

lib/drmtest.c static const struct module { · line 226

Quoted 4 lines
lib/drmtest.c +1 -0
@@ -223,6 +223,7 @@ static const struct module {
 	{ DRIVER_V3D, "v3d" },
 	{ DRIVER_VC4, "vc4" },
 	{ DRIVER_VGEM, "vgem" },
+	{ DRIVER_VIRTIO, "virtio_gpu" },

Please add it properly with a define, like others.

Quoted 22 lines
lib/drmtest.c +0 -0
 	{ DRIVER_VKMS, "vkms" },
 	{ DRIVER_VMWGFX, "vmwgfx" },
 	{ DRIVER_XE, "xe" },
lib/drmtest.h +1 -3
index a9542dde2..32fec584a 100644
@@ -37,6 +37,7 @@
 #include <xf86drm.h>
 
 #include "igt_core.h"
+#include "config.h"
 
 int __get_drm_device_name(int fd, char *name, int name_size);
 
@@ -58,14 +59,17 @@ int __get_drm_device_name(int fd, char *name, int name_size);
 #define DRIVER_VKMS	(1 << 9)
 
 /*
- * 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
- * near-100% skip rate if you don't explicitly specify the device,

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size); · line 67

Quoted 10 lines
lib/drmtest.h +5 -4
- * depending on device-load ordering.
- *
- * Exclude VKMS to prefer hardware drivers.
+ * Exclude DRIVER_VGEM and DRIVER_VIRTIO from DRIVER_ANY since if
+ * you run on a system with vgem or virtio-gpu as well as a supported driver,
+ * you can end up with a near-100% skip rate if you don't explicitly specify
+ * the device, depending on device-load ordering.
  */
-#define DRIVER_ANY	~(DRIVER_VGEM | DRIVER_VKMS)
+#ifdef PREFER_VKMS

Please no ifdef's when no needed, if anyone wants that igt test uses some other driver, it could have IGT_FORCE_DRIVER=some_gpu_driver

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size); · line 71

Quoted 4 lines
lib/drmtest.h +4 -0
+#define DRIVER_ANY	~(DRIVER_VGEM  | DRIVER_VIRTIO)
+#else
+/* Exclude VKMS to prefer hardware drivers if VKMS is not the preferred driver. */
+#define DRIVER_ANY	~(DRIVER_VGEM | DRIVER_VKMS | DRIVER_VIRTIO)

This should be without any conditional. Please also send code which compile, see CI report.

Regards,
Kamil

Quoted 7 lines
lib/drmtest.h +1 -0
+#endif
 
 /*
  * Compile friendly enum for i915/xe.
Signature · 1 line
2.51.0.618.g983fd99d29-goog
#2 lore raw
Quoted 22 lines · Kamil Konieczny

Hi Mark,

Quoted 20 lines · Mark Yacoub

[Why]
Android's VM use virtio-gpu as its default driver, but VKMS can be enabled on top it.
VKMS is the preferred driver to run IGT.

[How]
To maintain the current way to preferring hardware drivers, introduce a "PREFER_VKMS" flag which does not remove DRIVER_VKMS from the list of drivers to be opened. Android will keep this as always true.

Also, added explicit support for virtio-gpu to be explictly filtered out, making room for VKMS to be the primary driver in use.

Test: kms_bw on AVD

---
 lib/drmtest.c |  1 +
 lib/drmtest.h | 18 +++++++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)
Quoted 12 lines

lib/drmtest.c static const struct module { · line 226

Quoted 9 lines
lib/drmtest.c +1 -0
index 551385867..a1fb0b5ba 100644
@@ -223,6 +223,7 @@ static const struct module {
      { DRIVER_V3D, "v3d" },
      { DRIVER_VC4, "vc4" },
      { DRIVER_VGEM, "vgem" },
+     { DRIVER_VIRTIO, "virtio_gpu" },

Please add it properly with a define, like others.

done. it was missed during a copy-paste to a clean branch.

Quoted 40 lines

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int

Quoted 17 lines
lib/drmtest.c +0 -0
      { DRIVER_VKMS, "vkms" },
      { DRIVER_VMWGFX, "vmwgfx" },
      { DRIVER_XE, "xe" },
lib/drmtest.h +1 -0
index a9542dde2..32fec584a 100644
@@ -37,6 +37,7 @@
 #include <xf86drm.h>
 
 #include "igt_core.h"
+#include "config.h"
 
 int __get_drm_device_name(int fd, char *name, int name_size);
 
@@ -58,14 +59,17 @@ int __get_drm_device_name(int fd, char *name, int

name_size);

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size);

Quoted 11 lines
lib/drmtest.h +2 -6
 #define DRIVER_VKMS  (1 << 9)
 
 /*
- * 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
- * near-100% skip rate if you don't explicitly specify the device,
- * depending on device-load ordering.
- *
- * Exclude VKMS to prefer hardware drivers.
+ * Exclude DRIVER_VGEM and DRIVER_VIRTIO from DRIVER_ANY since if
+ * you run on a system with vgem or virtio-gpu as well as a supported

driver,

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int · line 64

Quoted 1 line
lib/drmtest.h +1 -0
+ * you can end up with a near-100% skip rate if you don't explicitly

specify

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size); · line 67

Quoted 4 lines
lib/drmtest.h +2 -1
+ * the device, depending on device-load ordering.
  */
-#define DRIVER_ANY   ~(DRIVER_VGEM | DRIVER_VKMS)
+#ifdef PREFER_VKMS

Please no ifdef's when no needed, if anyone wants that igt test uses some other driver, it could have IGT_FORCE_DRIVER=some_gpu_driver

Quoted 8 lines

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size);

Quoted 3 lines
lib/drmtest.h +3 -0
+#define DRIVER_ANY   ~(DRIVER_VGEM  | DRIVER_VIRTIO)
+#else
+/* Exclude VKMS to prefer hardware drivers if VKMS is not the preferred

driver. */

lib/drmtest.h int __get_drm_device_name(int fd, char *name, int name_size); · line 71

Quoted 1 line
lib/drmtest.h +1 -0
+#define DRIVER_ANY   ~(DRIVER_VGEM | DRIVER_VKMS | DRIVER_VIRTIO)

This should be without any conditional.

done. did undef then def again.

Quoted 2 lines

Please also send code which compile, see CI report.

my apologies. it was missed during a copy-paste to a clean branch. The working branch was tested on an android VM.
V2 uploaded.

Quoted 12 lines

Regards,
Kamil

Quoted 7 lines
lib/drmtest.h +1 -1
+#endif
 
 /*
  * Compile friendly enum for i915/xe.
--

2.51.0.618.g983fd99d29-goog