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>
This commit is contained in:
Jonas Ådahl 2021-02-23 10:50:33 +01:00
parent 4af0f05603
commit 8989c42d40
4 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,4 @@
DRIVERS=="i915", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers" DRIVERS=="i915", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVERS=="nouveau", 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" DRIVERS=="amdgpu", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"
DRIVER=="vkms", SUBSYSTEM=="platform", TAG+="mutter-device-ignore"

View File

@ -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); new_gpu_kms = create_gpu_from_udev_device (native, device, &error);
if (!new_gpu_kms) if (!new_gpu_kms)
{ {

View File

@ -102,6 +102,12 @@ meta_is_udev_device_disable_modifiers (GUdevDevice *device)
"mutter-device-disable-kms-modifiers"); "mutter-device-disable-kms-modifiers");
} }
gboolean
meta_is_udev_device_ignore (GUdevDevice *device)
{
return meta_has_udev_device_tag (device, "mutter-device-ignore");
}
gboolean gboolean
meta_is_udev_device_preferred_primary (GUdevDevice *device) meta_is_udev_device_preferred_primary (GUdevDevice *device)
{ {

View File

@ -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_disable_modifiers (GUdevDevice *device);
gboolean meta_is_udev_device_ignore (GUdevDevice *device);
gboolean meta_is_udev_device_preferred_primary (GUdevDevice *device); gboolean meta_is_udev_device_preferred_primary (GUdevDevice *device);
gboolean meta_udev_is_drm_device (MetaUdev *udev, gboolean meta_udev_is_drm_device (MetaUdev *udev,