[mutter] backend/native: Add udev rule to ignore vkms devices
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] backend/native: Add udev rule to ignore vkms devices
- Date: Fri, 30 Apr 2021 13:47:30 +0000 (UTC)
commit 8989c42d407436aa8f1976c17de22b73ed6a6caa
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Feb 23 10:50:33 2021 +0100
backend/native: Add udev rule to ignore vkms devices
Virtual Kernel Mode Setting (vkms) is a virtual /dev/dri/card* device
not backed by any actual hardware. It's intended for testing purposes,
e.g. to run tests suites with a reproducable setup, or in continuous
integration pipelines.
Currently mutter don't have any tests that can run on top of vkms, but
will eventually get that. To prepare for the ability to do that, and
having said kernel module loaded without causing wierd issues with any
active session, add an udev rule that tells mutter to ignore any vkms
device.
Otherwise, when vkms is loaded, mutter would detect it, assume it's a
regular monitor, configure it as such, thus add a region of the stage
that ends up nowhere, which isn't very helpful. It might also conflict
with running actual tests that need to interact with vkms if the active
session has taken control of it.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1740>
data/61-mutter.rules | 1 +
src/backends/native/meta-backend-native.c | 6 ++++++
src/backends/native/meta-udev.c | 6 ++++++
src/backends/native/meta-udev.h | 2 ++
4 files changed, 15 insertions(+)
---
diff --git a/data/61-mutter.rules b/data/61-mutter.rules
index e2901a284e..bfe63a8e9e 100644
--- a/data/61-mutter.rules
+++ b/data/61-mutter.rules
@@ -1,3 +1,4 @@
DRIVERS=="i915", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="nouveau", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
+DRIVER=="vkms", SUBSYSTEM=="platform", TAG+="mutter-device-ignore"
diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c
index f907acd966..0fcc00c91b 100644
--- a/src/backends/native/meta-backend-native.c
+++ b/src/backends/native/meta-backend-native.c
@@ -468,6 +468,12 @@ on_udev_device_added (MetaUdev *udev,
}
}
+ if (meta_is_udev_device_ignore (device))
+ {
+ g_message ("Ignoring DRM device '%s' (from udev rule)", device_path);
+ return;
+ }
+
new_gpu_kms = create_gpu_from_udev_device (native, device, &error);
if (!new_gpu_kms)
{
diff --git a/src/backends/native/meta-udev.c b/src/backends/native/meta-udev.c
index de05e2e4ec..9fd84e98b7 100644
--- a/src/backends/native/meta-udev.c
+++ b/src/backends/native/meta-udev.c
@@ -102,6 +102,12 @@ meta_is_udev_device_disable_modifiers (GUdevDevice *device)
"mutter-device-disable-kms-modifiers");
}
+gboolean
+meta_is_udev_device_ignore (GUdevDevice *device)
+{
+ return meta_has_udev_device_tag (device, "mutter-device-ignore");
+}
+
gboolean
meta_is_udev_device_preferred_primary (GUdevDevice *device)
{
diff --git a/src/backends/native/meta-udev.h b/src/backends/native/meta-udev.h
index 360e062133..7b179329eb 100644
--- a/src/backends/native/meta-udev.h
+++ b/src/backends/native/meta-udev.h
@@ -34,6 +34,8 @@ gboolean meta_is_udev_device_boot_vga (GUdevDevice *device);
gboolean meta_is_udev_device_disable_modifiers (GUdevDevice *device);
+gboolean meta_is_udev_device_ignore (GUdevDevice *device);
+
gboolean meta_is_udev_device_preferred_primary (GUdevDevice *device);
gboolean meta_udev_is_drm_device (MetaUdev *udev,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]