MLK-19152-2 drm/imx: lcdif: force 'mode_changed' when fb width changed
authorFancy Fang <chen.fang@nxp.com>
Tue, 7 Aug 2018 09:41:39 +0000 (17:41 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
In DRM atomic modeset check, it will not check the fb's width
change, so in later atomic commit, it will not disable the CRTC
which has no mode changed. But for LCDIF, the fb width related
registers configuration can not be done when LCDIF is running.
So force 'mode_changed' to be true when fb width changed.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit 518ff82756a39ff2d2f750596295baa4f5fca4c5)
(cherry picked from commit c399d83491cb80ca9d6b040cdf3e9d1e709785b2)

drivers/gpu/drm/imx/lcdif/lcdif-plane.c

index d21883c..550e632 100644 (file)
@@ -48,7 +48,9 @@ static int lcdif_plane_atomic_check(struct drm_plane *plane,
        uint32_t bus_fmt;
        struct lcdif_plane *lcdif_plane = to_lcdif_plane(plane);
        struct lcdif_soc *lcdif = lcdif_plane->lcdif;
+       struct drm_plane_state *old_state = plane->state;
        struct drm_framebuffer *fb = plane_state->fb;
+       struct drm_framebuffer *old_fb = old_state->fb;
        struct drm_crtc_state *crtc_state;
        struct drm_display_mode *mode;
        unsigned int flags;
@@ -88,6 +90,15 @@ static int lcdif_plane_atomic_check(struct drm_plane *plane,
        if (!plane_state->visible)
                return -EINVAL;
 
+       /* force 'mode_changed' when fb width changed, since
+        * the pitch related registers configuration of LCDIF
+        * can not be done when LCDIF is running.
+        */
+       if (old_fb && likely(!crtc_state->mode_changed)) {
+               if (old_fb->width != fb->width)
+                       crtc_state->mode_changed = true;
+       }
+
        return 0;
 }