From 2f3ad4be5c239952f1e30aeb6b083e54f5ef6cc1 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 17 Sep 2024 17:19:23 +0200 Subject: [PATCH] core/debug-control: Add new ForceHDR debug control It will be used to force the color state of all monitors to be as if they managed to turn on HDR mode. This is useful for debugging shaders in an environment where an HDR mode capable display is not available, such as the nested mode. Part-of: --- .../org.gnome.Mutter.DebugControl.xml | 1 + src/core/meta-debug-control-private.h | 2 ++ src/core/meta-debug-control.c | 18 ++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/data/dbus-interfaces/org.gnome.Mutter.DebugControl.xml b/data/dbus-interfaces/org.gnome.Mutter.DebugControl.xml index d7420cdff..5bb1134bf 100644 --- a/data/dbus-interfaces/org.gnome.Mutter.DebugControl.xml +++ b/data/dbus-interfaces/org.gnome.Mutter.DebugControl.xml @@ -7,6 +7,7 @@ + diff --git a/src/core/meta-debug-control-private.h b/src/core/meta-debug-control-private.h index 052b69fd4..2e8d55338 100644 --- a/src/core/meta-debug-control-private.h +++ b/src/core/meta-debug-control-private.h @@ -26,6 +26,8 @@ gboolean meta_debug_control_is_linear_blending_forced (MetaDebugControl *debug_c gboolean meta_debug_control_is_hdr_enabled (MetaDebugControl *debug_control); +gboolean meta_debug_control_is_hdr_forced (MetaDebugControl *debug_control); + unsigned int meta_debug_control_get_luminance_percentage (MetaDebugControl *debug_control); gboolean meta_debug_control_is_session_management_protocol_enabled (MetaDebugControl *debug_control); diff --git a/src/core/meta-debug-control.c b/src/core/meta-debug-control.c index abf2d179d..b8ee48d61 100644 --- a/src/core/meta-debug-control.c +++ b/src/core/meta-debug-control.c @@ -168,7 +168,8 @@ meta_debug_control_init (MetaDebugControl *debug_control) { MetaDBusDebugControl *dbus_debug_control = META_DBUS_DEBUG_CONTROL (debug_control); - gboolean enable_hdr, force_linear_blending, color_management_protocol; + gboolean enable_hdr, force_hdr, force_linear_blending, + color_management_protocol; gboolean session_management_protocol; color_management_protocol = @@ -179,6 +180,9 @@ meta_debug_control_init (MetaDebugControl *debug_control) enable_hdr = g_strcmp0 (getenv ("MUTTER_DEBUG_ENABLE_HDR"), "1") == 0; meta_dbus_debug_control_set_enable_hdr (dbus_debug_control, enable_hdr); + force_hdr = g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_HDR"), "1") == 0; + meta_dbus_debug_control_set_force_hdr (dbus_debug_control, force_hdr); + force_linear_blending = g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_LINEAR_BLENDING"), "1") == 0; meta_dbus_debug_control_set_force_linear_blending (dbus_debug_control, @@ -216,7 +220,17 @@ meta_debug_control_is_hdr_enabled (MetaDebugControl *debug_control) MetaDBusDebugControl *dbus_debug_control = META_DBUS_DEBUG_CONTROL (debug_control); - return meta_dbus_debug_control_get_enable_hdr (dbus_debug_control); + return meta_dbus_debug_control_get_enable_hdr (dbus_debug_control) || + meta_debug_control_is_hdr_forced (debug_control); +} + +gboolean +meta_debug_control_is_hdr_forced (MetaDebugControl *debug_control) +{ + MetaDBusDebugControl *dbus_debug_control = + META_DBUS_DEBUG_CONTROL (debug_control); + + return meta_dbus_debug_control_get_force_hdr (dbus_debug_control); } unsigned int