backends/native: Convert MetaOutputColorspace to DRM Colorspace

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2890>
This commit is contained in:
Sebastian Wick 2023-03-04 15:31:14 +01:00 committed by Marge Bot
parent 4a97da3675
commit 950fdc6c04
3 changed files with 18 additions and 1 deletions

View File

@ -142,6 +142,8 @@ MetaKmsConnector * meta_kms_connector_new (MetaKmsImplDevice *impl_device,
gboolean meta_kms_connector_is_same_as (MetaKmsConnector *connector, gboolean meta_kms_connector_is_same_as (MetaKmsConnector *connector,
drmModeConnector *drm_connector); drmModeConnector *drm_connector);
uint64_t meta_output_color_space_to_drm_color_space (MetaOutputColorspace color_space);
META_EXPORT_TEST META_EXPORT_TEST
void meta_set_drm_hdr_metadata (MetaOutputHdrMetadata *metadata, void meta_set_drm_hdr_metadata (MetaOutputHdrMetadata *metadata,
struct hdr_output_metadata *drm_metadata); struct hdr_output_metadata *drm_metadata);

View File

@ -343,6 +343,20 @@ supported_drm_color_spaces_to_output_color_spaces (uint64_t drm_support)
return supported; return supported;
} }
uint64_t
meta_output_color_space_to_drm_color_space (MetaOutputColorspace color_space)
{
switch (color_space)
{
case META_OUTPUT_COLORSPACE_BT2020:
return META_KMS_CONNECTOR_COLORSPACE_BT2020_RGB;
case META_OUTPUT_COLORSPACE_UNKNOWN:
case META_OUTPUT_COLORSPACE_DEFAULT:
default:
return META_KMS_CONNECTOR_COLORSPACE_DEFAULT;
}
}
static void static void
state_set_properties (MetaKmsConnectorState *state, state_set_properties (MetaKmsConnectorState *state,
MetaKmsImplDevice *impl_device, MetaKmsImplDevice *impl_device,

View File

@ -245,7 +245,8 @@ process_connector_update (MetaKmsImplDevice *impl_device,
if (!add_connector_property (impl_device, if (!add_connector_property (impl_device,
connector, req, connector, req,
META_KMS_CONNECTOR_PROP_COLORSPACE, META_KMS_CONNECTOR_PROP_COLORSPACE,
connector_update->colorspace.value, meta_output_color_space_to_drm_color_space (
connector_update->colorspace.value),
error)) error))
return FALSE; return FALSE;
} }