MLK-20337 drm/imx: lcdif: block 'active CRTC with no plane' commit
authorFancy Fang <chen.fang@nxp.com>
Mon, 26 Nov 2018 11:17:51 +0000 (19:17 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
When an atomic commit contains an active CRTC with no plane,
it may cause two potential issues:

First, this CRTC will fetch its last attached plane data
or has no data can be fetched depending on the plane
driver's atomic_disable() implementation.

Second, this CRTC's 'plane_changed' will be false during
the whole commit tail stage, and this will make vblank
wait to be bypassed which directly causes the later wait
flip done timeout.

So add this commit case check to the LCDIF CRTC's atomic
check to block this kind of commits.

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

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

index 216baf1..9c7642e 100644 (file)
@@ -100,6 +100,13 @@ static int lcdif_crtc_atomic_check(struct drm_crtc *crtc,
        if (!state->enable)
                return 0;
 
+       /* For the commit that the CRTC is active
+        * without planes attached to it should be
+        * invalid.
+        */
+       if (state->active && !state->plane_mask)
+               return -EINVAL;
+
        /* check the requested bus format can be
         * supported by LCDIF CTRC or not
         */