DisplayConfig: Advertise monitor color standard support

It'll be used to allow Settings to know whether it can enable HDR or
not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4192>
This commit is contained in:
Jonas Ådahl 2024-12-12 12:49:16 +01:00 committed by Marge Bot
parent f1e497acfa
commit a39e941f91
4 changed files with 38 additions and 8 deletions

View File

@ -393,11 +393,16 @@
Variable Refresh Rate is active (absence
of this means unknown)
- "is-for-lease" (b): whether the monitor is for lease or not
- "supported-color-modes" (au): list of supported color modes
Possible mode flags:
1 : preferred mode
2 : current mode
Available color modes:
0 : default
1 : BT.2100
@logical_monitors represent current logical monitor configuration

View File

@ -2002,6 +2002,23 @@ request_persistent_confirmation (MetaMonitorManager *manager)
#define LOGICAL_MONITOR_FORMAT "(iidub" LOGICAL_MONITOR_MONITORS_FORMAT "a{sv})"
#define LOGICAL_MONITORS_FORMAT "a" LOGICAL_MONITOR_FORMAT
static GVariant *
generate_color_modes_variant (MetaMonitor *monitor)
{
GVariantBuilder builder;
GList *l;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("au"));
for (l = meta_monitor_get_supported_color_modes (monitor); l; l = l->next)
{
MetaColorMode color_mode = GPOINTER_TO_INT (l->data);
g_variant_builder_add (&builder, "u", color_mode);
}
return g_variant_builder_end (&builder);
}
static gboolean
meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
GDBusMethodInvocation *invocation,
@ -2159,6 +2176,10 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
"is-for-lease",
g_variant_new_boolean (is_for_lease));
g_variant_builder_add (&monitor_properties_builder, "{sv}",
"supported-color-modes",
generate_color_modes_variant (monitor));
g_variant_builder_add (&monitors_builder, MONITOR_FORMAT,
monitor_spec->connector,
monitor_spec->vendor,

View File

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

View File

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