bcm27xx: update patches from RPi foundation
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0569-drm-vc4-crtc-Disable-color-management-for-HVS5.patch
1 From 9e134cea82d5c69e5d564e87cda2b5cf3ec14768 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 21 Feb 2020 16:54:21 +0100
4 Subject: [PATCH] drm/vc4: crtc: Disable color management for HVS5
5
6 The HVS5 uses different color matrices. Disable color management support
7 for now.
8
9 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
10 ---
11 drivers/gpu/drm/vc4/vc4_crtc.c | 17 +++++++++++------
12 1 file changed, 11 insertions(+), 6 deletions(-)
13
14 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
15 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
16 @@ -441,7 +441,7 @@ static void vc4_crtc_mode_set_nofb(struc
17
18 HVS_WRITE(SCALER_DISPBKGNDX(vc4_state->assigned_channel),
19 SCALER_DISPBKGND_AUTOHS |
20 - SCALER_DISPBKGND_GAMMA |
21 + ((!vc4->hvs->hvs5) ? SCALER_DISPBKGND_GAMMA : 0) |
22 (interlace ? SCALER_DISPBKGND_INTERLACE : 0));
23
24 /* Reload the LUT, since the SRAMs would have been disabled if
25 @@ -1156,6 +1156,7 @@ static int vc4_crtc_bind(struct device *
26 {
27 struct platform_device *pdev = to_platform_device(dev);
28 struct drm_device *drm = dev_get_drvdata(master);
29 + struct vc4_dev *vc4 = to_vc4_dev(drm);
30 struct vc4_crtc *vc4_crtc;
31 struct drm_crtc *crtc;
32 struct drm_plane *primary_plane, *destroy_plane, *temp;
33 @@ -1197,12 +1198,16 @@ static int vc4_crtc_bind(struct device *
34 drm_crtc_init_with_planes(drm, crtc, primary_plane, NULL,
35 &vc4_crtc_funcs, NULL);
36 drm_crtc_helper_add(crtc, &vc4_crtc_helper_funcs);
37 - drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
38
39 - /* We support CTM, but only for one CRTC at a time. It's therefore
40 - * implemented as private driver state in vc4_kms, not here.
41 - */
42 - drm_crtc_enable_color_mgmt(crtc, 0, true, crtc->gamma_size);
43 + if (!vc4->hvs->hvs5) {
44 + drm_mode_crtc_set_gamma_size(crtc, ARRAY_SIZE(vc4_crtc->lut_r));
45 +
46 + /* We support CTM, but only for one CRTC at a
47 + * time. It's therefore implemented as private driver
48 + * state in vc4_kms, not here.
49 + */
50 + drm_crtc_enable_color_mgmt(crtc, 0, true, crtc->gamma_size);
51 + }
52
53 CRTC_WRITE(PV_INTEN, 0);
54 CRTC_WRITE(PV_INTSTAT, PV_INT_VFP_START);