Skip to content

Commit 8debbd4

Browse files
mripardpopcornmix
authored andcommitted
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>
1 parent 5640034 commit 8debbd4

5 files changed

Lines changed: 25 additions & 7 deletions

File tree

‎drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6481,9 +6481,7 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm,
64816481
if (connector_type == DRM_MODE_CONNECTOR_HDMIA ||
64826482
connector_type == DRM_MODE_CONNECTOR_DisplayPort ||
64836483
connector_type == DRM_MODE_CONNECTOR_eDP) {
6484-
drm_object_attach_property(
6485-
&aconnector->base.base,
6486-
dm->ddev->mode_config.hdr_output_metadata_property, 0);
6484+
drm_connector_attach_hdr_output_metadata_property(&aconnector->base);
64876485

64886486
if (!aconnector->mst_port)
64896487
drm_connector_attach_vrr_capable_property(&aconnector->base);

‎drivers/gpu/drm/bridge/synopsys/dw-hdmi.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,8 +2492,7 @@ static int dw_hdmi_connector_create(struct dw_hdmi *hdmi)
24922492
drm_connector_attach_max_bpc_property(connector, 8, 16);
24932493

24942494
if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe)
2495-
drm_object_attach_property(&connector->base,
2496-
connector->dev->mode_config.hdr_output_metadata_property, 0);
2495+
drm_connector_attach_hdr_output_metadata_property(connector);
24972496

24982497
drm_connector_attach_encoder(connector, hdmi->bridge.encoder);
24992498

‎drivers/gpu/drm/drm_connector.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2143,6 +2143,27 @@ int drm_connector_attach_max_bpc_property(struct drm_connector *connector,
21432143
}
21442144
EXPORT_SYMBOL(drm_connector_attach_max_bpc_property);
21452145

2146+
/**
2147+
* drm_connector_attach_hdr_output_metadata_property - attach "HDR_OUTPUT_METADA" property
2148+
* @connector: connector to attach the property on.
2149+
*
2150+
* This is used to allow the userspace to send HDR Metadata to the
2151+
* driver.
2152+
*
2153+
* Returns:
2154+
* Zero on success, negative errno on failure.
2155+
*/
2156+
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector)
2157+
{
2158+
struct drm_device *dev = connector->dev;
2159+
struct drm_property *prop = dev->mode_config.hdr_output_metadata_property;
2160+
2161+
drm_object_attach_property(&connector->base, prop, 0);
2162+
2163+
return 0;
2164+
}
2165+
EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property);
2166+
21462167
/**
21472168
* drm_connector_set_vrr_capable_property - sets the variable refresh rate
21482169
* capable property for a connector

‎drivers/gpu/drm/i915/display/intel_hdmi.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,8 +2971,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
29712971
drm_connector_attach_content_type_property(connector);
29722972

29732973
if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
2974-
drm_object_attach_property(&connector->base,
2975-
connector->dev->mode_config.hdr_output_metadata_property, 0);
2974+
drm_connector_attach_hdr_output_metadata_property(connector);
29762975

29772976
if (!HAS_GMCH(dev_priv))
29782977
drm_connector_attach_max_bpc_property(connector, 8, 12);

‎include/drm/drm_connector.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,6 +1622,7 @@ int drm_connector_attach_scaling_mode_property(struct drm_connector *connector,
16221622
u32 scaling_mode_mask);
16231623
int drm_connector_attach_vrr_capable_property(
16241624
struct drm_connector *connector);
1625+
int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
16251626
int drm_mode_create_aspect_ratio_property(struct drm_device *dev);
16261627
int drm_mode_create_hdmi_colorspace_property(struct drm_connector *connector);
16271628
int drm_mode_create_dp_colorspace_property(struct drm_connector *connector);

0 commit comments

Comments
 (0)