db7e7a56ab90cf88a1d91448488dfc4e6fab68bb
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0529-drm-vc4-Use-the-new-helpers.patch
1 From b29e72769f843afeb4585c5310f8bf23c0277daf Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 9 Apr 2021 17:31:55 +0200
4 Subject: [PATCH] drm/vc4: Use the new helpers
5
6 We just introduced new helpers, so let's use them.
7
8 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
9 ---
10 drivers/gpu/drm/vc4/vc4_hdmi.c | 23 ++++-------------------
11 1 file changed, 4 insertions(+), 19 deletions(-)
12
13 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
14 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
15 @@ -224,21 +224,6 @@ static int vc4_hdmi_connector_get_modes(
16 return ret;
17 }
18
19 -static bool hdr_metadata_equal(const struct drm_connector_state *old_state,
20 - const struct drm_connector_state *new_state)
21 -{
22 - struct drm_property_blob *old_blob = old_state->hdr_output_metadata;
23 - struct drm_property_blob *new_blob = new_state->hdr_output_metadata;
24 -
25 - if (!old_blob || !new_blob)
26 - return old_blob == new_blob;
27 -
28 - if (old_blob->length != new_blob->length)
29 - return false;
30 -
31 - return !memcmp(old_blob->data, new_blob->data, old_blob->length);
32 -}
33 -
34 static int vc4_hdmi_connector_atomic_check(struct drm_connector *connector,
35 struct drm_atomic_state *state)
36 {
37 @@ -247,12 +232,13 @@ static int vc4_hdmi_connector_atomic_che
38 struct drm_connector_state *new_state =
39 drm_atomic_get_new_connector_state(state, connector);
40 struct drm_crtc *crtc = new_state->crtc;
41 - struct drm_crtc_state *crtc_state;
42
43 if (!crtc)
44 return 0;
45
46 - if (!hdr_metadata_equal(old_state, new_state)) {
47 + if (!drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) {
48 + struct drm_crtc_state *crtc_state;
49 +
50 crtc_state = drm_atomic_get_crtc_state(state, crtc);
51 if (IS_ERR(crtc_state))
52 return PTR_ERR(crtc_state);
53 @@ -351,8 +337,7 @@ static int vc4_hdmi_connector_init(struc
54 connector->stereo_allowed = 1;
55
56 if (vc4_hdmi->variant->supports_hdr)
57 - drm_object_attach_property(&connector->base,
58 - connector->dev->mode_config.hdr_output_metadata_property, 0);
59 + drm_connector_attach_hdr_output_metadata_property(connector);
60
61 drm_connector_attach_encoder(connector, encoder);
62