monitor-manager: Add logging to enabling and disabling HDR mode

It's hard to tell why turning on HDR mode failed without these log
messages. It could be missing support in the sink (EDID/DisplayID) or
missing support in the driver/display hardware (connector properties) or
just a failure turning it on.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3251>
This commit is contained in:
Sebastian Wick 2023-09-06 17:30:00 +02:00 committed by Marge Bot
parent c96341dcd5
commit e3b659cfe8
4 changed files with 84 additions and 23 deletions

View File

@ -501,6 +501,10 @@ ensure_hdr_settings (MetaMonitorManager *manager)
.active = TRUE, .active = TRUE,
.eotf = META_OUTPUT_HDR_METADATA_EOTF_PQ, .eotf = META_OUTPUT_HDR_METADATA_EOTF_PQ,
}; };
meta_topic (META_DEBUG_COLOR,
"MonitorManager: Trying to enabling HDR mode "
"(Colorimetry: bt.2020, TF: PQ, HDR Metadata: Minimal):");
} }
else else
{ {
@ -508,6 +512,10 @@ ensure_hdr_settings (MetaMonitorManager *manager)
hdr_metadata = (MetaOutputHdrMetadata) { hdr_metadata = (MetaOutputHdrMetadata) {
.active = FALSE, .active = FALSE,
}; };
meta_topic (META_DEBUG_COLOR,
"MonitorManager: Trying to enable default mode "
"(Colorimetry: default, TF: default, HDR Metadata: None):");
} }
for (l = manager->monitors; l; l = l->next) for (l = manager->monitors; l; l = l->next)
@ -517,27 +525,6 @@ ensure_hdr_settings (MetaMonitorManager *manager)
if (!meta_monitor_set_color_space (monitor, color_space, &error)) if (!meta_monitor_set_color_space (monitor, color_space, &error))
{ {
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
continue;
g_warning ("Failed to set color space on monitor %s: %s",
meta_monitor_get_display_name (monitor), error->message);
meta_monitor_set_color_space (monitor,
META_OUTPUT_COLORSPACE_DEFAULT,
NULL);
continue;
}
if (!meta_monitor_set_hdr_metadata (monitor, &hdr_metadata, &error))
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
continue;
g_warning ("Failed to set HDR metadata on monitor %s: %s",
meta_monitor_get_display_name (monitor), error->message);
meta_monitor_set_color_space (monitor, meta_monitor_set_color_space (monitor,
META_OUTPUT_COLORSPACE_DEFAULT, META_OUTPUT_COLORSPACE_DEFAULT,
NULL); NULL);
@ -545,8 +532,51 @@ ensure_hdr_settings (MetaMonitorManager *manager)
.active = FALSE, .active = FALSE,
}, NULL); }, NULL);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
{
meta_topic (META_DEBUG_COLOR,
"MonitorManager: Colorimetry not supported "
"on monitor %s",
meta_monitor_get_display_name (monitor));
}
else
{
g_warning ("Failed to set color space on monitor %s: %s",
meta_monitor_get_display_name (monitor), error->message);
}
continue; continue;
} }
if (!meta_monitor_set_hdr_metadata (monitor, &hdr_metadata, &error))
{
meta_monitor_set_color_space (monitor,
META_OUTPUT_COLORSPACE_DEFAULT,
NULL);
meta_monitor_set_hdr_metadata (monitor, &(MetaOutputHdrMetadata) {
.active = FALSE,
}, NULL);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
{
meta_topic (META_DEBUG_COLOR,
"MonitorManager: HDR Metadata not supported "
"on monitor %s",
meta_monitor_get_display_name (monitor));
}
else
{
g_warning ("Failed to set HDR metadata on monitor %s: %s",
meta_monitor_get_display_name (monitor),
error->message);
}
continue;
}
meta_topic (META_DEBUG_COLOR,
"MonitorManager: successfully set on monitor %s",
meta_monitor_get_display_name (monitor));
} }
} }

View File

@ -565,6 +565,21 @@ meta_output_peek_color_space (MetaOutput *output)
return priv->color_space; return priv->color_space;
} }
const char *
meta_output_colorspace_get_name (MetaOutputColorspace color_space)
{
switch (color_space)
{
case META_OUTPUT_COLORSPACE_UNKNOWN:
return "Unknown";
case META_OUTPUT_COLORSPACE_DEFAULT:
return "Default";
case META_OUTPUT_COLORSPACE_BT2020:
return "bt.2020";
}
g_assert_not_reached ();
}
gboolean gboolean
meta_output_is_hdr_metadata_supported (MetaOutput *output, meta_output_is_hdr_metadata_supported (MetaOutput *output,
MetaOutputHdrMetadataEOTF eotf) MetaOutputHdrMetadataEOTF eotf)

View File

@ -162,6 +162,8 @@ gboolean
meta_tile_info_equal (MetaTileInfo *a, meta_tile_info_equal (MetaTileInfo *a,
MetaTileInfo *b); MetaTileInfo *b);
const char * meta_output_colorspace_get_name (MetaOutputColorspace color_space);
#define META_TYPE_OUTPUT_INFO (meta_output_info_get_type ()) #define META_TYPE_OUTPUT_INFO (meta_output_info_get_type ())
META_EXPORT_TEST META_EXPORT_TEST
GType meta_output_info_get_type (void); GType meta_output_info_get_type (void);

View File

@ -148,13 +148,27 @@ meta_output_kms_is_color_space_supported (MetaOutput *output,
output_info = meta_output_get_info (output); output_info = meta_output_get_info (output);
if (!meta_output_info_is_color_space_supported (output_info, color_space)) if (!meta_output_info_is_color_space_supported (output_info, color_space))
{
meta_topic (META_DEBUG_COLOR,
"MetaOutput: Output %s signals that it doesn't support "
"Colorspace %s",
meta_output_get_name (output),
meta_output_colorspace_get_name (color_space));
return FALSE; return FALSE;
}
connector_state = connector_state =
meta_kms_connector_get_current_state (output_kms->kms_connector); meta_kms_connector_get_current_state (output_kms->kms_connector);
if (!(connector_state->colorspace.supported & (1 << color_space))) if (!(connector_state->colorspace.supported & (1 << color_space)))
{
meta_topic (META_DEBUG_COLOR,
"MetaOutput: KMS Connector for output %s doesn't support "
"Colorspace %s",
meta_output_get_name (output),
meta_output_colorspace_get_name (color_space));
return FALSE; return FALSE;
}
return TRUE; return TRUE;
} }