From 1ae539a6f5bbaf0a174b68b0632dfeebe8c4db73 Mon Sep 17 00:00:00 2001 From: Liu Ying <victor.liu@nxp.com> Date: Mon, 8 Apr 2019 13:44:24 +0800 Subject: [PATCH] MLK-21397 drm/imx: dpu: kms: Put possible pipe states properly 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/imx/dpu/dpu-kms.c b/drivers/gpu/drm/imx/dpu/dpu-kms.c index 50b11bdd176faa..4a9dd1396a7fa3 100644 --- a/drivers/gpu/drm/imx/dpu/dpu-kms.c +++ b/drivers/gpu/drm/imx/dpu/dpu-kms.c @@ -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); -- GitLab