drm/vc4: Fix vblank timestamping for firmwarekms.
authorEric Anholt <eric@anholt.net>
Tue, 2 Apr 2019 20:29:00 +0000 (13:29 -0700)
committerpopcornmix <popcornmix@gmail.com>
Wed, 1 Jul 2020 15:32:58 +0000 (16:32 +0100)
The core doesn't expect a false return from the scanoutpos function in
normal usage, so we were doing the precise vblank timestamping path
and thus "immediate" vblank disables (even though firmwarekms can't
actually disable vblanks interrupts, sigh), and the kernel would get
confused when getting timestamp info when also turning vblanks back
on.

Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/vc4/vc4_crtc.c
drivers/gpu/drm/vc4/vc4_firmware_kms.c

index 7b22d4f..f1f0a7c 100644 (file)
@@ -97,9 +97,6 @@ bool vc4_crtc_get_scanoutpos(struct drm_device *dev, unsigned int crtc_id,
        int vblank_lines;
        bool ret = false;
 
-       if (vc4->firmware_kms)
-               return 0;
-
        /* preempt_disable_rt() should go right here in PREEMPT_RT patchset. */
 
        /* Get optional system timestamp before query. */
index 93bf71f..eb5eb67 100644 (file)
@@ -20,6 +20,7 @@
 #include "drm/drm_crtc_helper.h"
 #include "drm/drm_fourcc.h"
 #include "drm/drm_probe_helper.h"
+#include "drm/drm_drv.h"
 #include "linux/clk.h"
 #include "linux/debugfs.h"
 #include "drm/drm_fb_cma_helper.h"
@@ -673,6 +674,12 @@ static int vc4_fkms_bind(struct device *dev, struct device *master, void *data)
 
        vc4->firmware_kms = true;
 
+       /* firmware kms doesn't have precise a scanoutpos implementation, so
+        * we can't do the precise vblank timestamp mode.
+        */
+       drm->driver->get_scanout_position = NULL;
+       drm->driver->get_vblank_timestamp = NULL;
+
        vc4_crtc = devm_kzalloc(dev, sizeof(*vc4_crtc), GFP_KERNEL);
        if (!vc4_crtc)
                return -ENOMEM;