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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4035>
This commit is contained in:
Sebastian Wick 2024-09-17 17:19:23 +02:00 committed by Marge Bot
parent 6a0cc1371c
commit 2f3ad4be5c
3 changed files with 19 additions and 2 deletions

View File

@ -7,6 +7,7 @@
<property name="ColorManagementProtocol" type="b" access="readwrite" /> <property name="ColorManagementProtocol" type="b" access="readwrite" />
<property name="EnableHDR" type="b" access="readwrite" /> <property name="EnableHDR" type="b" access="readwrite" />
<property name="ForceHDR" type="b" access="readwrite" />
<property name="ForceLinearBlending" type="b" access="readwrite" /> <property name="ForceLinearBlending" type="b" access="readwrite" />
<property name="LuminancePercentage" type="u" access="readwrite" /> <property name="LuminancePercentage" type="u" access="readwrite" />
<property name="SessionManagementProtocol" type="b" access="readwrite" /> <property name="SessionManagementProtocol" type="b" access="readwrite" />

View File

@ -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_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); unsigned int meta_debug_control_get_luminance_percentage (MetaDebugControl *debug_control);
gboolean meta_debug_control_is_session_management_protocol_enabled (MetaDebugControl *debug_control); gboolean meta_debug_control_is_session_management_protocol_enabled (MetaDebugControl *debug_control);

View File

@ -168,7 +168,8 @@ meta_debug_control_init (MetaDebugControl *debug_control)
{ {
MetaDBusDebugControl *dbus_debug_control = MetaDBusDebugControl *dbus_debug_control =
META_DBUS_DEBUG_CONTROL (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; gboolean session_management_protocol;
color_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; enable_hdr = g_strcmp0 (getenv ("MUTTER_DEBUG_ENABLE_HDR"), "1") == 0;
meta_dbus_debug_control_set_enable_hdr (dbus_debug_control, enable_hdr); 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 = force_linear_blending =
g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_LINEAR_BLENDING"), "1") == 0; g_strcmp0 (getenv ("MUTTER_DEBUG_FORCE_LINEAR_BLENDING"), "1") == 0;
meta_dbus_debug_control_set_force_linear_blending (dbus_debug_control, 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 = MetaDBusDebugControl *dbus_debug_control =
META_DBUS_DEBUG_CONTROL (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 unsigned int