bcm27xx: update patches from RPi foundation
[oweals/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0232-drm-vc4-Fix-vblank-timestamping-for-firmwarekms.patch
1 From c71f09dafd82a37a488029f33552a45a99d0a9a6 Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Tue, 2 Apr 2019 13:29:00 -0700
4 Subject: [PATCH] drm/vc4: Fix vblank timestamping for firmwarekms.
5
6 The core doesn't expect a false return from the scanoutpos function in
7 normal usage, so we were doing the precise vblank timestamping path
8 and thus "immediate" vblank disables (even though firmwarekms can't
9 actually disable vblanks interrupts, sigh), and the kernel would get
10 confused when getting timestamp info when also turning vblanks back
11 on.
12
13 Signed-off-by: Eric Anholt <eric@anholt.net>
14 ---
15  drivers/gpu/drm/vc4/vc4_crtc.c         | 3 ---
16  drivers/gpu/drm/vc4/vc4_firmware_kms.c | 7 +++++++
17  2 files changed, 7 insertions(+), 3 deletions(-)
18
19 --- a/drivers/gpu/drm/vc4/vc4_crtc.c
20 +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
21 @@ -97,9 +97,6 @@ bool vc4_crtc_get_scanoutpos(struct drm_
22         int vblank_lines;
23         bool ret = false;
24  
25 -       if (vc4->firmware_kms)
26 -               return 0;
27 -
28         /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
29  
30         /* Get optional system timestamp before query. */
31 --- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
32 +++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
33 @@ -20,6 +20,7 @@
34  #include "drm/drm_crtc_helper.h"
35  #include "drm/drm_fourcc.h"
36  #include "drm/drm_probe_helper.h"
37 +#include "drm/drm_drv.h"
38  #include "linux/clk.h"
39  #include "linux/debugfs.h"
40  #include "drm/drm_fb_cma_helper.h"
41 @@ -673,6 +674,12 @@ static int vc4_fkms_bind(struct device *
42  
43         vc4->firmware_kms = true;
44  
45 +       /* firmware kms doesn't have precise a scanoutpos implementation, so
46 +        * we can't do the precise vblank timestamp mode.
47 +        */
48 +       drm->driver->get_scanout_position = NULL;
49 +       drm->driver->get_vblank_timestamp = NULL;
50 +
51         vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL);
52         if (!vc4_crtc)
53                 return -ENOMEM;