mirror of
https://github.com/brl/mutter.git
synced 2025-06-13 16:59:30 +00:00
Add rudimentary mode setting test
Add a test that uses vkms to test that mode setting works, and that rendering works. It renders 10 frames in a row after mode setting, then exits. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2151>
This commit is contained in:
@ -43,6 +43,7 @@ typedef enum _MetaBackendNativeMode
|
||||
{
|
||||
META_BACKEND_NATIVE_MODE_DEFAULT = 0,
|
||||
META_BACKEND_NATIVE_MODE_HEADLESS,
|
||||
META_BACKEND_NATIVE_MODE_TEST,
|
||||
} MetaBackendNativeMode;
|
||||
|
||||
#endif /* META_BACKEND_NATIVE_TYPES_H */
|
||||
|
@ -127,10 +127,19 @@ meta_backend_native_create_default_seat (MetaBackend *backend,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
|
||||
const char *seat_id;
|
||||
const char *seat_id = NULL;
|
||||
MetaSeatNativeFlag flags;
|
||||
|
||||
seat_id = meta_backend_native_get_seat_id (backend_native);
|
||||
switch (backend_native->mode)
|
||||
{
|
||||
case META_BACKEND_NATIVE_MODE_DEFAULT:
|
||||
case META_BACKEND_NATIVE_MODE_HEADLESS:
|
||||
seat_id = meta_backend_native_get_seat_id (backend_native);
|
||||
break;
|
||||
case META_BACKEND_NATIVE_MODE_TEST:
|
||||
seat_id = META_BACKEND_TEST_INPUT_SEAT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (meta_backend_is_headless (backend))
|
||||
flags = META_SEAT_NATIVE_FLAG_NO_LIBINPUT;
|
||||
@ -379,6 +388,7 @@ meta_backend_native_get_seat_id (MetaBackendNative *backend_native)
|
||||
switch (backend_native->mode)
|
||||
{
|
||||
case META_BACKEND_NATIVE_MODE_DEFAULT:
|
||||
case META_BACKEND_NATIVE_MODE_TEST:
|
||||
return meta_launcher_get_seat_id (backend_native->launcher);
|
||||
case META_BACKEND_NATIVE_MODE_HEADLESS:
|
||||
return "seat0";
|
||||
@ -459,6 +469,21 @@ create_gpu_from_udev_device (MetaBackendNative *native,
|
||||
return meta_gpu_kms_new (native, kms_device, error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
should_ignore_device (MetaBackendNative *backend_native,
|
||||
GUdevDevice *device)
|
||||
{
|
||||
switch (backend_native->mode)
|
||||
{
|
||||
case META_BACKEND_NATIVE_MODE_DEFAULT:
|
||||
case META_BACKEND_NATIVE_MODE_HEADLESS:
|
||||
return meta_is_udev_device_ignore (device);
|
||||
case META_BACKEND_NATIVE_MODE_TEST:
|
||||
return !meta_is_udev_test_device (device);
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
static void
|
||||
on_udev_device_added (MetaUdev *udev,
|
||||
GUdevDevice *device,
|
||||
@ -488,9 +513,9 @@ on_udev_device_added (MetaUdev *udev,
|
||||
}
|
||||
}
|
||||
|
||||
if (meta_is_udev_device_ignore (device))
|
||||
if (should_ignore_device (native, device))
|
||||
{
|
||||
g_message ("Ignoring DRM device '%s' (from udev rule)", device_path);
|
||||
g_message ("Ignoring DRM device '%s'", device_path);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -524,9 +549,9 @@ init_gpus (MetaBackendNative *native,
|
||||
MetaGpuKms *gpu_kms;
|
||||
GError *local_error = NULL;
|
||||
|
||||
if (meta_is_udev_device_ignore (device))
|
||||
if (should_ignore_device (native, device))
|
||||
{
|
||||
g_message ("Ignoring DRM device '%s' (from udev rule)",
|
||||
g_message ("Ignoring DRM device '%s'",
|
||||
g_udev_device_get_device_file (device));
|
||||
continue;
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "backends/native/meta-launcher.h"
|
||||
#include "backends/native/meta-udev.h"
|
||||
|
||||
#define META_BACKEND_TEST_INPUT_SEAT "meta-test-seat0"
|
||||
|
||||
#define META_TYPE_BACKEND_NATIVE (meta_backend_native_get_type ())
|
||||
META_EXPORT_TEST
|
||||
G_DECLARE_FINAL_TYPE (MetaBackendNative, meta_backend_native,
|
||||
|
@ -108,6 +108,13 @@ meta_is_udev_device_ignore (GUdevDevice *device)
|
||||
return meta_has_udev_device_tag (device, "mutter-device-ignore");
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_is_udev_test_device (GUdevDevice *device)
|
||||
{
|
||||
return g_strcmp0 (g_udev_device_get_property (device, "ID_PATH"),
|
||||
"platform-vkms") == 0;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_is_udev_device_preferred_primary (GUdevDevice *device)
|
||||
{
|
||||
|
@ -36,6 +36,8 @@ gboolean meta_is_udev_device_disable_modifiers (GUdevDevice *device);
|
||||
|
||||
gboolean meta_is_udev_device_ignore (GUdevDevice *device);
|
||||
|
||||
gboolean meta_is_udev_test_device (GUdevDevice *device);
|
||||
|
||||
gboolean meta_is_udev_device_preferred_primary (GUdevDevice *device);
|
||||
|
||||
gboolean meta_udev_is_drm_device (MetaUdev *udev,
|
||||
|
Reference in New Issue
Block a user