mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
output: Check the EDID for the supported sink Colorimetry
Just like the HDR Metadata property the Colorspace property values only indicate that the display driver supports signaling certain colorimetry. It does not indidcate that the sink actually supports processing the colorimetry. For this we have to look up the colorimetry support in the EDID. The default colorimetry is always supported. If we want bt.2020 we might get either the RGB or YCC variant even if we ask for the RGB variant but there is nothing we can do about it so let's just pretend it's a driver issue. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2919>
This commit is contained in:
parent
754a1a1ce6
commit
cca07612b8
@ -528,17 +528,38 @@ meta_output_set_privacy_screen_enabled (MetaOutput *output,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_info_is_color_space_supported (const MetaOutputInfo *output_info,
|
||||
MetaOutputColorspace color_space)
|
||||
{
|
||||
MetaEdidColorimetry colorimetry;
|
||||
|
||||
if (!output_info->edid_info)
|
||||
return FALSE;
|
||||
|
||||
colorimetry = output_info->edid_info->colorimetry;
|
||||
|
||||
switch (color_space)
|
||||
{
|
||||
case META_OUTPUT_COLORSPACE_DEFAULT:
|
||||
return TRUE;
|
||||
case META_OUTPUT_COLORSPACE_BT2020:
|
||||
return !!(colorimetry & META_EDID_COLORIMETRY_BT2020RGB);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_is_color_space_supported (MetaOutput *output,
|
||||
MetaOutputColorspace color_space)
|
||||
{
|
||||
MetaOutputClass *output_class = META_OUTPUT_GET_CLASS (output);
|
||||
uint64_t supported = 0;
|
||||
|
||||
if (output_class->get_supported_color_spaces)
|
||||
supported = output_class->get_supported_color_spaces (output);
|
||||
if (!output_class->is_color_space_supported)
|
||||
return FALSE;
|
||||
|
||||
return supported & (1 << color_space);
|
||||
return output_class->is_color_space_supported (output, color_space);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -182,6 +182,9 @@ META_EXPORT_TEST
|
||||
void meta_output_info_parse_edid (MetaOutputInfo *output_info,
|
||||
GBytes *edid);
|
||||
|
||||
gboolean meta_output_info_is_color_space_supported (const MetaOutputInfo *output_info,
|
||||
MetaOutputColorspace color_space);
|
||||
|
||||
gboolean meta_output_is_laptop (MetaOutput *output);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MetaOutputInfo, meta_output_info_unref)
|
||||
@ -198,7 +201,8 @@ struct _MetaOutputClass
|
||||
gboolean (* set_privacy_screen_enabled) (MetaOutput *output,
|
||||
gboolean enabled,
|
||||
GError **error);
|
||||
uint64_t (* get_supported_color_spaces) (MetaOutput *output);
|
||||
gboolean (* is_color_space_supported) (MetaOutput *output,
|
||||
MetaOutputColorspace color_space);
|
||||
gboolean (* is_hdr_metadata_supported) (MetaOutput *output);
|
||||
};
|
||||
|
||||
|
@ -139,16 +139,26 @@ meta_output_kms_get_privacy_screen_state (MetaOutput *output)
|
||||
return connector_state->privacy_screen_state;
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
meta_output_kms_get_supported_color_spaces (MetaOutput *output)
|
||||
static gboolean
|
||||
meta_output_kms_is_color_space_supported (MetaOutput *output,
|
||||
MetaOutputColorspace color_space)
|
||||
{
|
||||
MetaOutputKms *output_kms = META_OUTPUT_KMS (output);
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
const MetaOutputInfo *output_info;
|
||||
|
||||
output_info = meta_output_get_info (output);
|
||||
|
||||
if (!meta_output_info_is_color_space_supported (output_info, color_space))
|
||||
return FALSE;
|
||||
|
||||
connector_state =
|
||||
meta_kms_connector_get_current_state (output_kms->kms_connector);
|
||||
|
||||
return connector_state->colorspace.supported;
|
||||
if (!(connector_state->colorspace.supported & (1 << color_space)))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -535,8 +545,8 @@ meta_output_kms_class_init (MetaOutputKmsClass *klass)
|
||||
|
||||
output_class->get_privacy_screen_state =
|
||||
meta_output_kms_get_privacy_screen_state;
|
||||
output_class->get_supported_color_spaces =
|
||||
meta_output_kms_get_supported_color_spaces;
|
||||
output_class->is_color_space_supported =
|
||||
meta_output_kms_is_color_space_supported;
|
||||
output_class->is_hdr_metadata_supported =
|
||||
meta_output_kms_is_hdr_metadata_supported;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user