MLK-21397 drm/imx: dpu: kms: Put possible pipe states properly
authorLiu Ying <victor.liu@nxp.com>
Mon, 8 Apr 2019 05:44:24 +0000 (13:44 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
We should put possible pipe states after we've finished assigning
resources for all pipes.  This makes sure the pipe states which
should be put are all eventually put.  Without this patch, disabled
crtc(s) or enabled crtc(s) without any plane upon will be accidentally
left in the atomic state when commit operations only happen for other
pipe(s), because we skip the put operations when we see the relevant
active plane number is zero.  It's good to put pipe states for those
crtcs, otherwise, we'll depend on atomic helper core behavior to
handle the crtcs.

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

index 50b11bd..4a9dd13 100644 (file)
@@ -761,9 +761,16 @@ static int dpu_drm_atomic_check(struct drm_device *dev,
                }
 
                kfree(states);
+       };
+
+       drm_for_each_crtc(crtc, dev) {
+               if (pipe_states_prone_to_put[drm_crtc_index(crtc)]) {
+                       crtc_state = drm_atomic_get_crtc_state(state, crtc);
+                       if (WARN_ON(IS_ERR(crtc_state)))
+                               return PTR_ERR(crtc_state);
 
-               if (pipe_states_prone_to_put[drm_crtc_index(crtc)])
                        dpu_atomic_put_possible_states_per_crtc(crtc_state);
+               }
        }
 
        ret = drm_atomic_helper_check_planes(dev, state);