3c346a2b8fbe95ac68339d8c4445973bb2a79e30
[openwrt/staging/robimarko.git] /
1 From c1e98dfad80bdb512cd04c9ed5d989a5f0f6b13d Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 9 Apr 2021 17:16:42 +0200
4 Subject: [PATCH] drm/vc4: hdmi: Signal the proper colorimetry info in
5 the infoframe
6
7 Our driver while supporting HDR didn't send the proper colorimetry info
8 in the AVI infoframe.
9
10 Let's add the property needed so that the userspace can let us know what
11 the colorspace is supposed to be.
12
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 ---
15 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 ++++++++--
16 1 file changed, 8 insertions(+), 2 deletions(-)
17
18 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
19 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
20 @@ -236,7 +236,8 @@ static int vc4_hdmi_connector_atomic_che
21 if (!crtc)
22 return 0;
23
24 - if (!drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) {
25 + if (old_state->colorspace != new_state->colorspace ||
26 + !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) {
27 struct drm_crtc_state *crtc_state;
28
29 crtc_state = drm_atomic_get_crtc_state(state, crtc);
30 @@ -326,6 +327,11 @@ static int vc4_hdmi_connector_init(struc
31 if (ret)
32 return ret;
33
34 + ret = drm_mode_create_hdmi_colorspace_property(connector);
35 + if (ret)
36 + return ret;
37 +
38 + drm_connector_attach_colorspace_property(connector);
39 drm_connector_attach_tv_margin_properties(connector);
40 drm_connector_attach_max_bpc_property(connector, 8, 12);
41
42 @@ -440,7 +446,7 @@ static void vc4_hdmi_set_avi_infoframe(s
43 vc4_encoder->limited_rgb_range ?
44 HDMI_QUANTIZATION_RANGE_LIMITED :
45 HDMI_QUANTIZATION_RANGE_FULL);
46 -
47 + drm_hdmi_avi_infoframe_colorspace(&frame.avi, cstate);
48 drm_hdmi_avi_infoframe_bars(&frame.avi, cstate);
49
50 vc4_hdmi_write_infoframe(encoder, &frame);