output: Move color space and hdr tf support to OutputInfo
Currently querying support for some output features is done partially through the OutputInfo and partially via KMS CRTC and Connector objects. Let's be consistent and use OutputInfo always which works with all backends and backend types. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3552>
This commit is contained in:

committed by
Marge Bot

parent
fb7b9b0955
commit
a3a4de6c6b
@ -2579,15 +2579,18 @@ init_secondary_gpu_state (MetaRendererNative *renderer_native,
|
||||
void
|
||||
meta_onscreen_native_invalidate (MetaOnscreenNative *onscreen_native)
|
||||
{
|
||||
const MetaOutputInfo *output_info =
|
||||
meta_output_get_info (onscreen_native->output);
|
||||
|
||||
if (meta_crtc_get_gamma_lut_size (onscreen_native->crtc) > 0)
|
||||
onscreen_native->is_gamma_lut_invalid = TRUE;
|
||||
if (meta_output_is_privacy_screen_supported (onscreen_native->output))
|
||||
onscreen_native->is_privacy_screen_invalid = TRUE;
|
||||
if (meta_output_is_color_space_supported (onscreen_native->output,
|
||||
META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
if (output_info->supported_color_spaces &
|
||||
(1 << META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
onscreen_native->is_color_space_invalid = TRUE;
|
||||
if (meta_output_is_hdr_metadata_supported (onscreen_native->output,
|
||||
META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
if (output_info->supported_hdr_eotfs &
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
onscreen_native->is_hdr_metadata_invalid = TRUE;
|
||||
}
|
||||
|
||||
@ -2643,6 +2646,7 @@ meta_onscreen_native_new (MetaRendererNative *renderer_native,
|
||||
{
|
||||
MetaOnscreenNative *onscreen_native;
|
||||
CoglFramebufferDriverConfig driver_config;
|
||||
const MetaOutputInfo *output_info = meta_output_get_info (output);
|
||||
|
||||
driver_config = (CoglFramebufferDriverConfig) {
|
||||
.type = COGL_FRAMEBUFFER_DRIVER_TYPE_BACK,
|
||||
@ -2678,8 +2682,8 @@ meta_onscreen_native_new (MetaRendererNative *renderer_native,
|
||||
onscreen_native);
|
||||
}
|
||||
|
||||
if (meta_output_is_color_space_supported (output,
|
||||
META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
if (output_info->supported_color_spaces &
|
||||
(1 << META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
{
|
||||
onscreen_native->is_color_space_invalid = TRUE;
|
||||
onscreen_native->color_space_changed_handler_id =
|
||||
@ -2688,8 +2692,8 @@ meta_onscreen_native_new (MetaRendererNative *renderer_native,
|
||||
onscreen_native);
|
||||
}
|
||||
|
||||
if (meta_output_is_hdr_metadata_supported (output,
|
||||
META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
if (output_info->supported_hdr_eotfs &
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR))
|
||||
{
|
||||
onscreen_native->is_hdr_metadata_invalid = TRUE;
|
||||
onscreen_native->hdr_metadata_changed_handler_id =
|
||||
|
@ -65,54 +65,6 @@ meta_output_kms_get_privacy_screen_state (MetaOutput *output)
|
||||
return connector_state->privacy_screen_state;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
connector_state =
|
||||
meta_kms_connector_get_current_state (output_kms->kms_connector);
|
||||
|
||||
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 TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_output_kms_is_hdr_metadata_supported (MetaOutput *output)
|
||||
{
|
||||
MetaOutputKms *output_kms = META_OUTPUT_KMS (output);
|
||||
const MetaKmsConnectorState *connector_state;
|
||||
|
||||
connector_state =
|
||||
meta_kms_connector_get_current_state (output_kms->kms_connector);
|
||||
|
||||
return connector_state->hdr.supported;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
meta_output_kms_get_connector_id (MetaOutputKms *output_kms)
|
||||
{
|
||||
@ -428,6 +380,50 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
|
||||
|
||||
output_info->tile_info = connector_state->tile_info;
|
||||
|
||||
if (output_info->edid_info)
|
||||
{
|
||||
MetaEdidColorimetry edid_colorimetry =
|
||||
output_info->edid_info->colorimetry;
|
||||
uint64_t connector_colorimetry = connector_state->colorspace.supported;
|
||||
|
||||
if (connector_colorimetry & (1 << META_OUTPUT_COLORSPACE_DEFAULT))
|
||||
output_info->supported_color_spaces |= (1 << META_OUTPUT_COLORSPACE_DEFAULT);
|
||||
|
||||
if ((edid_colorimetry & META_EDID_COLORIMETRY_BT2020RGB) &&
|
||||
(connector_colorimetry & (1 << META_OUTPUT_COLORSPACE_BT2020)))
|
||||
output_info->supported_color_spaces |= (1 << META_OUTPUT_COLORSPACE_BT2020);
|
||||
}
|
||||
|
||||
if (connector_state->hdr.supported &&
|
||||
output_info->edid_info &&
|
||||
(output_info->edid_info->hdr_static_metadata.sm &
|
||||
META_EDID_STATIC_METADATA_TYPE1))
|
||||
{
|
||||
MetaEdidTransferFunction edid_tf =
|
||||
output_info->edid_info->hdr_static_metadata.tf;
|
||||
|
||||
if (edid_tf & META_EDID_TF_TRADITIONAL_GAMMA_SDR)
|
||||
{
|
||||
output_info->supported_hdr_eotfs |=
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_SDR);
|
||||
}
|
||||
if (edid_tf & META_EDID_TF_TRADITIONAL_GAMMA_HDR)
|
||||
{
|
||||
output_info->supported_hdr_eotfs |=
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_TRADITIONAL_GAMMA_HDR);
|
||||
}
|
||||
if (edid_tf & META_EDID_TF_PQ)
|
||||
{
|
||||
output_info->supported_hdr_eotfs |=
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_PQ);
|
||||
}
|
||||
if (edid_tf & META_EDID_TF_HLG)
|
||||
{
|
||||
output_info->supported_hdr_eotfs |=
|
||||
(1 << META_OUTPUT_HDR_METADATA_EOTF_HLG);
|
||||
}
|
||||
}
|
||||
|
||||
output = g_object_new (META_TYPE_OUTPUT_KMS,
|
||||
"id", ((uint64_t) gpu_id << 32) | connector_id,
|
||||
"gpu", gpu,
|
||||
@ -486,10 +482,6 @@ meta_output_kms_class_init (MetaOutputKmsClass *klass)
|
||||
|
||||
output_class->get_privacy_screen_state =
|
||||
meta_output_kms_get_privacy_screen_state;
|
||||
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;
|
||||
|
||||
output_native_class->read_edid = meta_output_kms_read_edid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user