diff options
Diffstat (limited to 'src/backends')
-rw-r--r-- | src/backends/meta-monitor.c | 2 | ||||
-rw-r--r-- | src/backends/meta-output.c | 32 | ||||
-rw-r--r-- | src/backends/meta-output.h | 3 | ||||
-rw-r--r-- | src/backends/native/meta-onscreen-native.c | 6 |
4 files changed, 38 insertions, 5 deletions
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c index c1315e84e..112ed97f6 100644 --- a/src/backends/meta-monitor.c +++ b/src/backends/meta-monitor.c @@ -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"); diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c index 0db3242d9..b81608a0f 100644 --- a/src/backends/meta-output.c +++ b/src/backends/meta-output.c @@ -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; diff --git a/src/backends/meta-output.h b/src/backends/meta-output.h index e4f20475b..ba86e2c27 100644 --- a/src/backends/meta-output.h +++ b/src/backends/meta-output.h @@ -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); diff --git a/src/backends/native/meta-onscreen-native.c b/src/backends/native/meta-onscreen-native.c index 3311b64b1..3fc020024 100644 --- a/src/backends/native/meta-onscreen-native.c +++ b/src/backends/native/meta-onscreen-native.c @@ -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 = |