mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
output: Check the EDID for HDR Static Metadata support
The existence of the KMS property just means that we can send an InfoFrame but we also have to make sure the sink actually supports the metadata type 1 and the selected transfer function. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2879>
This commit is contained in:
parent
7ecdfaa78d
commit
af714edafb
@ -2285,7 +2285,7 @@ meta_monitor_set_hdr_metadata (MetaMonitor *monitor,
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
if (!meta_output_is_hdr_metadata_supported (output))
|
||||
if (!meta_output_is_hdr_metadata_supported (output, metadata->eotf))
|
||||
{
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
|
||||
"HDR metadata is not supported by this monitor");
|
||||
|
@ -561,9 +561,39 @@ meta_output_peek_color_space (MetaOutput *output)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_output_is_hdr_metadata_supported (MetaOutput *output)
|
||||
meta_output_is_hdr_metadata_supported (MetaOutput *output,
|
||||
MetaOutputHdrMetadataEOTF eotf)
|
||||
{
|
||||
MetaOutputClass *output_class = META_OUTPUT_GET_CLASS (output);
|
||||
const MetaOutputInfo *output_info = meta_output_get_info (output);
|
||||
MetaEdidTransferFunction tf = 0;
|
||||
|
||||
g_assert (output_info != NULL);
|
||||
if (!output_info->edid_info)
|
||||
return FALSE;
|
||||
|
||||
if ((output_info->edid_info->hdr_static_metadata.sm &
|
||||
META_EDID_STATIC_METADATA_TYPE1) == 0)
|
||||
return FALSE;
|
||||
|
||||
switch (eotf)
|
||||
{
|
||||
case META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR:
|
||||
tf = META_EDID_TF_TRADITIONAL_GAMMA_SDR;
|
||||
break;
|
||||
case META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_HDR:
|
||||
tf = META_EDID_TF_TRADITIONAL_GAMMA_HDR;
|
||||
break;
|
||||
case META_OUTPUT_HDR_METADATA_EOTF_PQ:
|
||||
tf = META_EDID_TF_PQ;
|
||||
break;
|
||||
case META_OUTPUT_HDR_METADATA_EOTF_HLG:
|
||||
tf = META_EDID_TF_HLG;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((output_info->edid_info->hdr_static_metadata.tf & tf) == 0)
|
||||
return FALSE;
|
||||
|
||||
if (!output_class->is_hdr_metadata_supported)
|
||||
return FALSE;
|
||||
|
@ -254,7 +254,8 @@ void meta_output_set_color_space (MetaOutput *output,
|
||||
|
||||
MetaOutputColorspace meta_output_peek_color_space (MetaOutput *output);
|
||||
|
||||
gboolean meta_output_is_hdr_metadata_supported (MetaOutput *output);
|
||||
gboolean meta_output_is_hdr_metadata_supported (MetaOutput *output,
|
||||
MetaOutputHdrMetadataEOTF eotf);
|
||||
|
||||
void meta_output_set_hdr_metadata (MetaOutput *output,
|
||||
MetaOutputHdrMetadata *metadata);
|
||||
|
@ -2241,7 +2241,8 @@ meta_onscreen_native_invalidate (MetaOnscreenNative *onscreen_native)
|
||||
if (meta_output_is_color_space_supported (onscreen_native->output,
|
||||
META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
onscreen_native->is_color_space_invalid = TRUE;
|
||||
if (meta_output_is_hdr_metadata_supported (onscreen_native->output))
|
||||
if (meta_output_is_hdr_metadata_supported (onscreen_native->output,
|
||||
META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
onscreen_native->is_hdr_metadata_invalid = TRUE;
|
||||
}
|
||||
|
||||
@ -2342,7 +2343,8 @@ meta_onscreen_native_new (MetaRendererNative *renderer_native,
|
||||
onscreen_native);
|
||||
}
|
||||
|
||||
if (meta_output_is_hdr_metadata_supported (output))
|
||||
if (meta_output_is_hdr_metadata_supported (output,
|
||||
META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
{
|
||||
onscreen_native->is_hdr_metadata_invalid = TRUE;
|
||||
onscreen_native->hdr_metadata_changed_handler_id =
|
||||
|
Loading…
Reference in New Issue
Block a user