drm/connector: Create a helper to attach the hdr_output_metadata property

All the drivers that implement HDR output call pretty much the same
function to initialise the hdr_output_metadata property, and while the
creation of that property is in a helper, every driver uses the same
code to attach it.

Provide a helper for it as well

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
This commit is contained in:
Maxime Ripard
2021-03-19 11:21:41 +01:00
committed by popcornmix
parent 56400344aa
commit 8debbd4e09
5 changed files with 25 additions and 7 deletions

View File

@@ -6481,9 +6481,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
if (connector_type == DRM_MODE_CONNECTOR_HDMIA || if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
connector_type == DRM_MODE_CONNECTOR_DisplayPort || connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
connector_type == DRM_MODE_CONNECTOR_eDP) { connector_type == DRM_MODE_CONNECTOR_eDP) {
drm_object_attach_property( drm_connector_attach_hdr_output_metadata_property(&aconnector->base);
&aconnector->base.base,
dm->ddev->mode_config.hdr_output_metadata_property, 0);
if (!aconnector->mst_port) if (!aconnector->mst_port)
drm_connector_attach_vrr_capable_property(&aconnector->base); drm_connector_attach_vrr_capable_property(&aconnector->base);

View File

@@ -2492,8 +2492,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi)
drm_connector_attach_max_bpc_property(connector, 8, 16); drm_connector_attach_max_bpc_property(connector, 8, 16);
if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe)
drm_object_attach_property(&connector->base, drm_connector_attach_hdr_output_metadata_property(connector);
connector->dev->mode_config.hdr_output_metadata_property, 0);
drm_connector_attach_encoder(connector, hdmi->bridge.encoder); drm_connector_attach_encoder(connector, hdmi->bridge.encoder);

View File

@@ -2143,6 +2143,27 @@ int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
} }
EXPORT_SYMBOL(drm_connector_attach_max_bpc_property); EXPORT_SYMBOL(drm_connector_attach_max_bpc_property);
/**
* drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADA" property
* @connector: connector to attach the property on.
*
* This is used to allow the userspace to send HDR Metadata to the
* driver.
*
* Returns:
* Zero on success, negative errno on failure.
*/
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector)
{
struct drm_device *dev = connector->dev;
struct drm_property *prop = dev->mode_config.hdr_output_metadata_property;
drm_object_attach_property(&connector->base, prop, 0);
return 0;
}
EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property);
/** /**
* drm_connector_set_vrr_capable_property - sets the variable refresh rate * drm_connector_set_vrr_capable_property - sets the variable refresh rate
* capable property for a connector * capable property for a connector

View File

@@ -2971,8 +2971,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
drm_connector_attach_content_type_property(connector); drm_connector_attach_content_type_property(connector);
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
drm_object_attach_property(&connector->base, drm_connector_attach_hdr_output_metadata_property(connector);
connector->dev->mode_config.hdr_output_metadata_property, 0);
if (!HAS_GMCH(dev_priv)) if (!HAS_GMCH(dev_priv))
drm_connector_attach_max_bpc_property(connector, 8, 12); drm_connector_attach_max_bpc_property(connector, 8, 12);

View File

@@ -1622,6 +1622,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
u32 scaling_mode_mask); u32 scaling_mode_mask);
int drm_connector_attach_vrr_capable_property( int drm_connector_attach_vrr_capable_property(
struct drm_connector *connector); struct drm_connector *connector);
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
int drm_mode_create_aspect_ratio_property(struct drm_device *dev); int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector); int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector); int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);