kms/device: Add flag to disable sending DRM modifiers to clients
So far the new flag can only be set via the new environment variable MUTTER_DEBUG_SEND_KMS_MODIFIERS, and doesn't have any effect yet. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2637>
This commit is contained in:
parent
6601c3b02a
commit
00ffe0b454
@ -64,6 +64,7 @@ typedef enum _MetaKmsDeviceFlag
|
||||
META_KMS_DEVICE_FLAG_NO_MODE_SETTING = 1 << 4,
|
||||
META_KMS_DEVICE_FLAG_HAS_ADDFB2 = 1 << 5,
|
||||
META_KMS_DEVICE_FLAG_FORCE_LEGACY = 1 << 6,
|
||||
META_KMS_DEVICE_FLAG_DISABLE_CLIENT_MODIFIERS = 1 << 7,
|
||||
} MetaKmsDeviceFlag;
|
||||
|
||||
typedef enum _MetaKmsResourceChanges
|
||||
|
@ -87,6 +87,7 @@ struct _MetaRendererNative
|
||||
MetaGles3 *gles3;
|
||||
|
||||
gboolean use_modifiers;
|
||||
gboolean send_modifiers;
|
||||
|
||||
GHashTable *gpu_datas;
|
||||
|
||||
@ -247,6 +248,12 @@ meta_renderer_native_get_egl (MetaRendererNative *renderer_native)
|
||||
return meta_backend_get_egl (meta_renderer_get_backend (renderer));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_renderer_native_send_modifiers (MetaRendererNative *renderer_native)
|
||||
{
|
||||
return renderer_native->send_modifiers;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_renderer_native_use_modifiers (MetaRendererNative *renderer_native)
|
||||
{
|
||||
@ -2033,7 +2040,9 @@ meta_renderer_native_initable_init (GInitable *initable,
|
||||
gpus = meta_backend_get_gpus (backend);
|
||||
if (gpus)
|
||||
{
|
||||
const char *use_kms_modifiers_debug_env;
|
||||
MetaKmsDevice *kms_device;
|
||||
MetaKmsDeviceFlag flags;
|
||||
const char *kms_modifiers_debug_env;
|
||||
|
||||
for (l = gpus; l; l = l->next)
|
||||
{
|
||||
@ -2049,19 +2058,17 @@ meta_renderer_native_initable_init (GInitable *initable,
|
||||
if (!renderer_native->primary_gpu_kms)
|
||||
return FALSE;
|
||||
|
||||
use_kms_modifiers_debug_env = g_getenv ("MUTTER_DEBUG_USE_KMS_MODIFIERS");
|
||||
if (use_kms_modifiers_debug_env)
|
||||
kms_device = meta_gpu_kms_get_kms_device (renderer_native->primary_gpu_kms);
|
||||
flags = meta_kms_device_get_flags (kms_device);
|
||||
|
||||
kms_modifiers_debug_env = g_getenv ("MUTTER_DEBUG_USE_KMS_MODIFIERS");
|
||||
if (kms_modifiers_debug_env)
|
||||
{
|
||||
renderer_native->use_modifiers =
|
||||
g_strcmp0 (use_kms_modifiers_debug_env, "1") == 0;
|
||||
g_strcmp0 (kms_modifiers_debug_env, "1") == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MetaKmsDevice *kms_device =
|
||||
meta_gpu_kms_get_kms_device (renderer_native->primary_gpu_kms);
|
||||
MetaKmsDeviceFlag flags;
|
||||
|
||||
flags = meta_kms_device_get_flags (kms_device);
|
||||
renderer_native->use_modifiers =
|
||||
!(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS) &&
|
||||
flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2;
|
||||
@ -2069,6 +2076,22 @@ meta_renderer_native_initable_init (GInitable *initable,
|
||||
|
||||
meta_topic (META_DEBUG_KMS, "Usage of KMS modifiers is %s",
|
||||
renderer_native->use_modifiers ? "enabled" : "disabled");
|
||||
|
||||
kms_modifiers_debug_env = g_getenv ("MUTTER_DEBUG_SEND_KMS_MODIFIERS");
|
||||
if (kms_modifiers_debug_env)
|
||||
{
|
||||
renderer_native->send_modifiers =
|
||||
g_strcmp0 (kms_modifiers_debug_env, "1") == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer_native->send_modifiers =
|
||||
!(flags & META_KMS_DEVICE_FLAG_DISABLE_CLIENT_MODIFIERS) &&
|
||||
flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2;
|
||||
}
|
||||
|
||||
meta_topic (META_DEBUG_KMS, "Sending KMS modifiers to clients is %s",
|
||||
renderer_native->send_modifiers ? "enabled" : "disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -66,6 +66,8 @@ void meta_renderer_native_finish_frame (MetaRendererNative *renderer_native,
|
||||
|
||||
void meta_renderer_native_reset_modes (MetaRendererNative *renderer_native);
|
||||
|
||||
gboolean meta_renderer_native_send_modifiers (MetaRendererNative *renderer_native);
|
||||
|
||||
gboolean meta_renderer_native_use_modifiers (MetaRendererNative *renderer_native);
|
||||
|
||||
MetaRendererNativeMode meta_renderer_native_get_mode (MetaRendererNative *renderer_native);
|
||||
|
Loading…
Reference in New Issue
Block a user