From: Jiaxi Zhang <[email protected]>

The shared scanout-position callback subtracts the video VSYNC/porch
window from an encoder line counter. Command mode uses the tear-check
counter: dpu_encoder_phys_cmd_tearcheck_config initializes it at vdisplay,
sets RD_PTR at vdisplay + 1, and permits a wrap at twice vtotal when a TE
edge is missed. Those values are not the video raster/blanking coordinate
system expected by this conversion.

Return false for command mode so the DRM vblank timestamp helper reports
that this accurate scanout-derived timestamp is unavailable. Video mode
keeps its existing calculation; the command-mode TE interrupt callback and
hardware vblank counting remain in place.

IRQ reference accounting and the existing off-delay policy are unchanged.
Idle-power behavior is outside this timestamp correction.

Signed-off-by: Jiaxi Zhang <[email protected]>

---
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -282,6 +282,10 @@
                DRM_ERROR("no encoder found for crtc %d\n", pipe);
                return false;
        }
+
+       /* The command-mode counter follows TE, not the video porch timing. */
+       if (dpu_encoder_get_intf_mode(encoder) == INTF_MODE_CMD)
+               return false;
 
        vsw = mode->crtc_vsync_end - mode->crtc_vsync_start;
        vbp = mode->crtc_vtotal - mode->crtc_vsync_end;

Reply via email to