MLK-16001 drm/imx: dpu: plane: Don't support active planes with CRTC disabled
authorLiu Ying <victor.liu@nxp.com>
Mon, 17 Jul 2017 05:54:26 +0000 (13:54 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:33:37 +0000 (15:33 -0500)
It's unnecessary to support active planes with relevant CRTC being disabled,
because we cannot see the planes on the screen.  Let's reject the case
in the atomic check stage explicitly.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/drm/imx/dpu/dpu-plane.c

index a50b3bd..7b2729c 100644 (file)
@@ -157,6 +157,9 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
                return 0;
        }
 
+       if (!state->crtc)
+               return -EINVAL;
+
        if (dplane->grp->has_vproc) {
                /* no down scaling */
                if (state->src_w >> 16 > state->crtc_w ||
@@ -172,20 +175,18 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
        /* no off screen */
        if (state->crtc_x < 0 || state->crtc_y < 0)
                return -EINVAL;
-       if (state->crtc) {
-               crtc_state =
-                       drm_atomic_get_existing_crtc_state(state->state,
-                                                       state->crtc);
-               if (WARN_ON(!crtc_state))
-                       return -EINVAL;
 
-               if (state->crtc_x + state->crtc_w >
-                   crtc_state->adjusted_mode.hdisplay)
-                       return -EINVAL;
-               if (state->crtc_y + state->crtc_h >
-                   crtc_state->adjusted_mode.vdisplay)
-                       return -EINVAL;
-       }
+       crtc_state =
+               drm_atomic_get_existing_crtc_state(state->state, state->crtc);
+       if (WARN_ON(!crtc_state))
+               return -EINVAL;
+
+       if (state->crtc_x + state->crtc_w >
+           crtc_state->adjusted_mode.hdisplay)
+               return -EINVAL;
+       if (state->crtc_y + state->crtc_h >
+           crtc_state->adjusted_mode.vdisplay)
+               return -EINVAL;
 
        /* base address alignment check */
        baseaddr = drm_plane_state_to_baseaddr(state);
@@ -338,9 +339,7 @@ static void dpu_plane_atomic_update(struct drm_plane *plane,
                                        dpstate->base_w, dpstate->base_h);
                constframe_constantcolor(cf, 0, 0, 0, 0);
 
-               if (state->crtc)
-                       framegen_sacfg(res->fg,
-                                       dpstate->base_x, dpstate->base_y);
+               framegen_sacfg(res->fg, dpstate->base_x, dpstate->base_y);
        }
 
        if (dpstate->is_top) {