Implement the mode_set_base drm_crtc_helper callback. DRM core calls
this method when there is a SetCrtc request but only the framebuffer
and/or the x/y scanout position in the framebuffer has changed and no
other video mode parameters have changed.

So mode_set_base is similar to a page flip except that there is no
page flip event handling. So ipu_crtc_mode_set_base() simply calls
ipu_plane_page_flip() with a NULL event pointer. A reference on the
vblank interrupt will be acquired and then released when the flip
completes, as in a normal page flip.

Signed-off-by: Steve Longerbeam <steve_longerbeam at mentor.com>
---
 drivers/staging/imx-drm/ipuv3-crtc.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c 
b/drivers/staging/imx-drm/ipuv3-crtc.c
index 53241fd..179b764 100644
--- a/drivers/staging/imx-drm/ipuv3-crtc.c
+++ b/drivers/staging/imx-drm/ipuv3-crtc.c
@@ -174,6 +174,17 @@ static int ipu_crtc_page_flip(struct drm_crtc *crtc,
        return ipu_plane_page_flip(crtc->primary, fb, event, page_flip_flags);
 }

+static int ipu_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
+                                 struct drm_framebuffer *old_fb)
+{
+       struct ipu_crtc *ipu_crtc = to_ipu_crtc(crtc);
+
+       ipu_crtc->plane[0].x = x;
+       ipu_crtc->plane[0].y = y;
+
+       return ipu_plane_page_flip(crtc->primary, crtc->primary->fb, NULL, 0);
+}
+
 /*
  * Normally the DRM Gamma API is used to program a color LUT that contains
  * gamma-corrected pixel values for red, green, and blue input pixel values
@@ -358,6 +369,7 @@ static void ipu_crtc_commit(struct drm_crtc *crtc)

 static struct drm_crtc_helper_funcs ipu_helper_funcs = {
        .dpms = ipu_crtc_dpms,
+       .mode_set_base = ipu_crtc_mode_set_base,
        .mode_fixup = ipu_crtc_mode_fixup,
        .mode_set = ipu_crtc_mode_set,
        .prepare = ipu_crtc_prepare,
-- 
1.7.9.5

Reply via email to