bcm27xx: update patches from RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0744-drm-vc4-Fix-VIC-usage-with-Broadcast-RGB.patch
1 From a90dcdf7cf7ad632f5a260758a76e406403a7e3c Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 14 May 2020 14:44:15 +0100
4 Subject: [PATCH] drm/vc4: Fix VIC usage with Broadcast RGB
5
6 Adding the Broadcast RGB range selection broke the VIC
7 field of the AVI infoframes on HDMI, zeroing them for all
8 modes on an HDMI monitor.
9
10 Correct this so that it is only zeroed if the range is
11 contrary to the standard range of the mode.
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 ---
15 drivers/gpu/drm/vc4/vc4_firmware_kms.c | 19 ++++++++++++-------
16 1 file changed, 12 insertions(+), 7 deletions(-)
17
18 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
19 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
20 @@ -936,19 +936,14 @@ static void vc4_crtc_mode_set_nofb(struc
21 break;
22 }
23
24 + mb.timings.video_id_code = frame.avi.video_code;
25 +
26 if (!vc4_encoder->hdmi_monitor) {
27 mb.timings.flags |= TIMINGS_FLAGS_DVI;
28 - mb.timings.video_id_code = frame.avi.video_code;
29 } else {
30 struct vc4_fkms_connector_state *conn_state =
31 to_vc4_fkms_connector_state(vc4_crtc->connector->state);
32
33 - /* Do not provide a VIC as the HDMI spec requires that we do not
34 - * signal the opposite of the defined range in the AVI
35 - * infoframe.
36 - */
37 - mb.timings.video_id_code = 0;
38 -
39 if (conn_state->broadcast_rgb == VC4_BROADCAST_RGB_AUTO) {
40 /* See CEA-861-E - 5.1 Default Encoding Parameters */
41 if (drm_default_rgb_quant_range(mode) ==
42 @@ -958,6 +953,16 @@ static void vc4_crtc_mode_set_nofb(struc
43 if (conn_state->broadcast_rgb ==
44 VC4_BROADCAST_RGB_LIMITED)
45 mb.timings.flags |= TIMINGS_FLAGS_RGB_LIMITED;
46 +
47 + /* If not using the default range, then do not provide
48 + * a VIC as the HDMI spec requires that we do not
49 + * signal the opposite of the defined range in the AVI
50 + * infoframe.
51 + */
52 + if (!!(mb.timings.flags & TIMINGS_FLAGS_RGB_LIMITED) !=
53 + (drm_default_rgb_quant_range(mode) ==
54 + HDMI_QUANTIZATION_RANGE_LIMITED))
55 + mb.timings.video_id_code = 0;
56 }
57 }
58