bcm27xx: add linux 5.4 support
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0268-drm-vc4-Ignore-HVS-unless-initialised.patch
1 From cad68ea70d649cff90102022c5d161bf84e4ed16 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Fri, 19 Jul 2019 14:29:28 +0100
4 Subject: [PATCH] drm/vc4: Ignore HVS unless initialised
5
6 An upstream commit to report HVS underruns causes VC4 in firmware KMS
7 mode to cross into the HVS side, where it crashes due to a NULL hvs
8 pointer.
9
10 Make the underrun masking conditional on the hvs pointer being
11 initialised.
12
13 Fixes: 531a1b622da9 ("drm/vc4: Report HVS underrun errors")
14
15 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
16 ---
17 drivers/gpu/drm/vc4/vc4_crtc.c | 3 ++-
18 drivers/gpu/drm/vc4/vc4_kms.c | 2 +-
19 2 files changed, 3 insertions(+), 2 deletions(-)
20
21 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
22 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
23 @@ -801,7 +801,8 @@ static void vc4_crtc_handle_page_flip(st
24 * the CRTC and encoder already reconfigured, leading to
25 * underruns. This can be seen when reconfiguring the CRTC.
26 */
27 - vc4_hvs_unmask_underrun(dev, vc4_crtc->channel);
28 + if (vc4->hvs)
29 + vc4_hvs_unmask_underrun(dev, vc4_crtc->channel);
30 }
31 spin_unlock_irqrestore(&dev->event_lock, flags);
32 }
33 --- a/drivers/gpu/drm/vc4/vc4_kms.c
34 +++ b/drivers/gpu/drm/vc4/vc4_kms.c
35 @@ -156,7 +156,7 @@ vc4_atomic_complete_commit(struct drm_at
36 struct vc4_crtc *vc4_crtc;
37 int i;
38
39 - for (i = 0; i < dev->mode_config.num_crtc; i++) {
40 + for (i = 0; vc4->hvs && i < dev->mode_config.num_crtc; i++) {
41 if (!state->crtcs[i].ptr || !state->crtcs[i].commit)
42 continue;
43