Replace HDR debug toggle with o.g.M.DisplayConfig API

HDR being enabled was controlled by toggling a property on
org.gnome.Mutter.DebugControl, which affected how the color space and
HDR metadata of the output was configured. Replace this with a higher
level MetaMonitor / MetaOutput level "color mode" enum, that is also
reflected in the monitor configuration API.

This enum is then used to derive the color space and HDR metadata at the
lower level where it matters. The ForceHDR debug control property is
still left there, as it only affects the color space and transfer
function of the view related to a monitor.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
This commit is contained in:
Jonas Ådahl
2024-12-13 10:52:33 +01:00
committed by Marge Bot
parent 2fa0183a95
commit d855623fb4
20 changed files with 349 additions and 450 deletions

View File

@ -12,10 +12,11 @@ Monitors:
│ │ └──Properties: (2)
│ │ ├──is-current ⇒ yes
│ │ └──is-preferred ⇒ yes
│ └──Properties: (4)
│ └──Properties: (5)
│ ├──is-builtin ⇒ no
│ ├──display-name ⇒ MetaProduct's Inc. 14"
│ ├──is-for-lease ⇒ no
│ ├──color-mode ⇒ 0
│ └──supported-color-modes ⇒ [0]
└──Monitor DP-2 (MetaProduct's Inc. 13")
├──Vendor: MetaProduct's Inc.
@ -30,10 +31,11 @@ Monitors:
│ └──Properties: (2)
│ ├──is-current ⇒ yes
│ └──is-preferred ⇒ yes
└──Properties: (4)
└──Properties: (5)
├──is-builtin ⇒ no
├──display-name ⇒ MetaProduct's Inc. 13"
├──is-for-lease ⇒ no
├──color-mode ⇒ 0
└──supported-color-modes ⇒ [0]
Logical monitors:

View File

@ -30,10 +30,11 @@ Monitors:
│ │ ├──Preferred scale: 1.0
│ │ ├──Supported scales: [1.0, 1.25, 1.5, 1.7475727796554565]
│ │ └──Properties: (0)
│ └──Properties: (4)
│ └──Properties: (5)
│ ├──is-builtin ⇒ no
│ ├──display-name ⇒ MetaProduct's Inc. 14"
│ ├──is-for-lease ⇒ no
│ ├──color-mode ⇒ 0
│ └──supported-color-modes ⇒ [0]
└──Monitor DP-2 (MetaProduct's Inc. 13")
├──Vendor: MetaProduct's Inc.
@ -66,10 +67,11 @@ Monitors:
│ ├──Preferred scale: 1.0
│ ├──Supported scales: [1.0]
│ └──Properties: (0)
└──Properties: (4)
└──Properties: (5)
├──is-builtin ⇒ no
├──display-name ⇒ MetaProduct's Inc. 13"
├──is-for-lease ⇒ no
├──color-mode ⇒ 0
└──supported-color-modes ⇒ [0]
Logical monitors:

View File

@ -797,6 +797,10 @@ meta_create_monitor_test_setup (MetaBackend *backend,
(uint8_t *) &setup->outputs[i].edid_info,
sizeof (setup->outputs[i].edid_info));
}
output_info->supported_color_spaces =
setup->outputs[i].supported_color_spaces;
output_info->supported_hdr_eotfs =
setup->outputs[i].supported_hdr_eotfs;
output = g_object_new (META_TYPE_OUTPUT_TEST,
"id", (uint64_t) i,

View File

@ -118,6 +118,8 @@ typedef struct _MonitorTestCaseOutput
int backlight_max;
gboolean has_edid_info;
MetaEdidInfo edid_info;
uint64_t supported_color_spaces;
uint64_t supported_hdr_eotfs;
} MonitorTestCaseOutput;
typedef struct _MonitorTestCaseCrtc

View File

@ -9659,6 +9659,95 @@ meta_test_monitor_custom_for_lease_config_dbus (void)
assert_monitor_state (new_state, 1, "DP-2", FALSE);
}
static void
meta_test_monitor_color_modes (void)
{
MonitorTestCaseSetup test_case_setup = {
.modes = {
{
.width = 800,
.height = 600,
.refresh_rate = 60.0
}
},
.n_modes = 1,
.outputs = {
{
.crtc = -1,
.modes = { 0 },
.n_modes = 1,
.preferred_mode = 0,
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456",
.supported_color_spaces = ((1 << META_OUTPUT_COLORSPACE_DEFAULT) |
(1 << META_OUTPUT_COLORSPACE_BT2020)),
.supported_hdr_eotfs =
((1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR) |
(1 << META_OUTPUT_HDR_METADATA_EOTF_PQ)),
},
{
.crtc = -1,
.modes = { 0 },
.n_modes = 1,
.preferred_mode = 0,
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x654321",
.supported_color_spaces = 1 << META_OUTPUT_COLORSPACE_DEFAULT,
.supported_hdr_eotfs =
1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR,
}
},
.n_outputs = 2,
.crtcs = {
{
.current_mode = -1
},
{
.current_mode = -1
}
},
.n_crtcs = 2
};
MetaBackend *backend = meta_context_get_backend (test_context);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
GList *monitors;
MetaMonitor *first_monitor;
MetaMonitor *second_monitor;
GList *color_modes;
MetaMonitorTestSetup *test_setup;
test_setup = meta_create_monitor_test_setup (test_backend,
&test_case_setup,
MONITOR_TEST_FLAG_NONE);
emulate_hotplug (test_setup);
check_monitor_test_clients_state ();
monitors = meta_monitor_manager_get_monitors (monitor_manager);
g_assert_cmpuint (g_list_length (monitors), ==, 2);
first_monitor = g_list_nth_data (monitors, 0);
second_monitor = g_list_nth_data (monitors, 1);
color_modes = meta_monitor_get_supported_color_modes (first_monitor);
g_assert_cmpuint (g_list_length (color_modes), ==, 2);
g_assert_nonnull (g_list_find (color_modes,
GINT_TO_POINTER (META_COLOR_MODE_DEFAULT)));
g_assert_nonnull (g_list_find (color_modes,
GINT_TO_POINTER (META_COLOR_MODE_BT2100)));
color_modes = meta_monitor_get_supported_color_modes (second_monitor);
g_assert_cmpuint (g_list_length (color_modes), ==, 1);
g_assert_nonnull (g_list_find (color_modes,
GINT_TO_POINTER (META_COLOR_MODE_DEFAULT)));
}
static gboolean
quit_main_loop (gpointer data)
{
@ -10892,6 +10981,9 @@ init_monitor_tests (void)
add_monitor_test ("/backends/monitor/custom/for-lease-config-dbus",
meta_test_monitor_custom_for_lease_config_dbus);
add_monitor_test ("/backends/monitor/color-modes",
meta_test_monitor_color_modes);
add_monitor_test ("/backends/monitor/migrated/rotated",
meta_test_monitor_migrated_rotated);
add_monitor_test ("/backends/monitor/migrated/horizontal-strip",