backend/native: Only disable KMS modifiers for i915

The intel DRM driver is known for not being able to handle multi head
setups when KMS modifiers are enabled, due to the implicitly selected
modifiers, while being more suitable for single head setups, cause
bandwidth issues when a certain number of monitor times resolution and
refresh rate is configured.

We don't yet support automatically finding a combination of modifiers
that work, and have because of this disabled KMS modifiers unless the
driver actually needs it.

Lets flip this configuration the other way around, changing the current
udev rule to decide wen to *disable* KMS modifier support, as it so that
only the Intel driver has this problem, while on the other hand, there
several drivers that requires modifiers to function at all.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1792>
This commit is contained in:
Jonas Ådahl 2021-03-19 12:08:21 +01:00
parent 90e3d9782d
commit da3baba980
8 changed files with 26 additions and 12 deletions

View File

@ -1 +1 @@
DRIVER=="tegra-host1x", SUBSYSTEM=="platform", TAG+="mutter-device-requires-kms-modifiers"
DRIVERS=="i915", SUBSYSTEM=="drm", TAG+="mutter-device-disable-kms-modifiers"

View File

@ -423,8 +423,8 @@ create_gpu_from_udev_device (MetaBackendNative *native,
if (meta_is_udev_device_boot_vga (device))
flags |= META_KMS_DEVICE_FLAG_BOOT_VGA;
if (meta_is_udev_device_requires_modifiers (device))
flags |= META_KMS_DEVICE_FLAG_REQUIRES_MODIFIERS;
if (meta_is_udev_device_disable_modifiers (device))
flags |= META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS;
if (meta_is_udev_device_preferred_primary (device))
flags |= META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY;

View File

@ -149,12 +149,12 @@ meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms)
}
gboolean
meta_gpu_kms_requires_modifiers (MetaGpuKms *gpu_kms)
meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms)
{
MetaKmsDeviceFlag flags;
flags = meta_kms_device_get_flags (gpu_kms->kms_device);
return !!(flags & META_KMS_DEVICE_FLAG_REQUIRES_MODIFIERS);
return !!(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS);
}
static int

View File

@ -47,7 +47,7 @@ gboolean meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
gboolean meta_gpu_kms_is_boot_vga (MetaGpuKms *gpu_kms);
gboolean meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms);
gboolean meta_gpu_kms_requires_modifiers (MetaGpuKms *gpu_kms);
gboolean meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms);
MetaKmsDevice * meta_gpu_kms_get_kms_device (MetaGpuKms *gpu_kms);

View File

@ -59,7 +59,7 @@ typedef enum _MetaKmsDeviceFlag
META_KMS_DEVICE_FLAG_NONE = 0,
META_KMS_DEVICE_FLAG_BOOT_VGA = 1 << 0,
META_KMS_DEVICE_FLAG_PLATFORM_DEVICE = 1 << 1,
META_KMS_DEVICE_FLAG_REQUIRES_MODIFIERS = 1 << 2,
META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS = 1 << 2,
META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY = 1 << 3,
META_KMS_DEVICE_FLAG_NO_MODE_SETTING = 1 << 4,
} MetaKmsDeviceFlag;

View File

@ -1984,6 +1984,8 @@ meta_renderer_native_initable_init (GInitable *initable,
gpus = meta_backend_get_gpus (backend);
if (gpus)
{
const char *use_kms_modifiers_debug_env;
for (l = gpus; l; l = l->next)
{
MetaGpuKms *gpu_kms = META_GPU_KMS (l->data);
@ -1998,8 +2000,20 @@ meta_renderer_native_initable_init (GInitable *initable,
if (!renderer_native->primary_gpu_kms)
return FALSE;
if (meta_gpu_kms_requires_modifiers (renderer_native->primary_gpu_kms))
renderer_native->use_modifiers = TRUE;
use_kms_modifiers_debug_env = g_getenv ("MUTTER_DEBUG_USE_KMS_MODIFIERS");
if (use_kms_modifiers_debug_env)
{
renderer_native->use_modifiers =
g_strcmp0 (use_kms_modifiers_debug_env, "1") == 0;
}
else
{
renderer_native->use_modifiers =
!meta_gpu_kms_disable_modifiers (renderer_native->primary_gpu_kms);
}
meta_topic (META_DEBUG_KMS, "Usage of KMS modifiers is %s",
renderer_native->use_modifiers ? "enabled" : "disabled");
}
else
{

View File

@ -75,7 +75,7 @@ meta_is_udev_device_boot_vga (GUdevDevice *device)
}
gboolean
meta_is_udev_device_requires_modifiers (GUdevDevice *device)
meta_is_udev_device_disable_modifiers (GUdevDevice *device)
{
g_autoptr (GUdevDevice) platform_device = NULL;
const char * const * tags;
@ -92,7 +92,7 @@ meta_is_udev_device_requires_modifiers (GUdevDevice *device)
if (!tags)
return FALSE;
return g_strv_contains (tags, "mutter-device-requires-kms-modifiers");
return g_strv_contains (tags, "mutter-device-disable-kms-modifiers");
}
gboolean

View File

@ -32,7 +32,7 @@ gboolean meta_is_udev_device_platform_device (GUdevDevice *device);
gboolean meta_is_udev_device_boot_vga (GUdevDevice *device);
gboolean meta_is_udev_device_requires_modifiers (GUdevDevice *device);
gboolean meta_is_udev_device_disable_modifiers (GUdevDevice *device);
gboolean meta_is_udev_device_preferred_primary (GUdevDevice *device);