6cae581ab27667762e4324adb65e6ef53b745945
[openwrt/staging/stintel.git] /
1 From a7f87202ec94410eabff8df2f4fced0141794a9a Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 9 Apr 2021 17:07:32 +0200
4 Subject: [PATCH] drm/connector: Add a helper to attach the colorspace
5 property
6
7 The intel driver uses the same logic to attach the Colorspace property
8 in multiple places and we'll need it in vc4 too. Let's move that common
9 code in a helper.
10
11 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
12 ---
13 drivers/gpu/drm/drm_connector.c | 20 +++++++++++++++++++
14 .../gpu/drm/i915/display/intel_connector.c | 3 +--
15 include/drm/drm_connector.h | 1 +
16 3 files changed, 22 insertions(+), 2 deletions(-)
17
18 --- a/drivers/gpu/drm/drm_connector.c
19 +++ b/drivers/gpu/drm/drm_connector.c
20 @@ -2165,6 +2165,26 @@ int drm_connector_attach_hdr_output_meta
21 EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property);
22
23 /**
24 + * drm_connector_attach_colorspace_property - attach "Colorspace" property
25 + * @connector: connector to attach the property on.
26 + *
27 + * This is used to allow the userspace to signal the output colorspace
28 + * to the driver.
29 + *
30 + * Returns:
31 + * Zero on success, negative errno on failure.
32 + */
33 +int drm_connector_attach_colorspace_property(struct drm_connector *connector)
34 +{
35 + struct drm_property *prop = connector->colorspace_property;
36 +
37 + drm_object_attach_property(&connector->base, prop, DRM_MODE_COLORIMETRY_DEFAULT);
38 +
39 + return 0;
40 +}
41 +EXPORT_SYMBOL(drm_connector_attach_colorspace_property);
42 +
43 +/**
44 * drm_connector_atomic_hdr_metadata_equal - checks if the hdr metadata changed
45 * @old_state: old connector state to compare
46 * @new_state: new connector state to compare
47 --- a/drivers/gpu/drm/i915/display/intel_connector.c
48 +++ b/drivers/gpu/drm/i915/display/intel_connector.c
49 @@ -297,6 +297,5 @@ intel_attach_colorspace_property(struct
50 return;
51 }
52
53 - drm_object_attach_property(&connector->base,
54 - connector->colorspace_property, 0);
55 + drm_connector_attach_colorspace_property(connector);
56 }
57 --- a/include/drm/drm_connector.h
58 +++ b/include/drm/drm_connector.h
59 @@ -1622,6 +1622,7 @@ int drm_connector_attach_scaling_mode_pr
60 u32 scaling_mode_mask);
61 int drm_connector_attach_vrr_capable_property(
62 struct drm_connector *connector);
63 +int drm_connector_attach_colorspace_property(struct drm_connector *connector);
64 int drm_connector_attach_hdr_output_metadata_property(struct drm_connector *connector);
65 bool drm_connector_atomic_hdr_metadata_equal(struct drm_connector_state *old_state,
66 struct drm_connector_state *new_state);