From 303c324c43ad3c71e9315f41fbde86bb1b17478f Mon Sep 17 00:00:00 2001 From: Veera Sundaram Sankaran Date: Tue, 20 Oct 2020 11:07:05 -0700 Subject: [PATCH] disp: msm: sde: fix crtc_state iteration during vm release Iterate over the crtc old/new state and decide which ones to process by checking the active state of both during the vm release in error cases. Change-Id: Iab20e89792c53fb72e0c00f1fa5091616c7afbf3 Signed-off-by: Veera Sundaram Sankaran --- msm/sde/sde_kms.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 6c720ceb24e6..b6e43ba51042 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -2689,18 +2689,21 @@ static void sde_kms_vm_res_release(struct msm_kms *kms, struct drm_atomic_state *state) { struct drm_crtc *crtc; - struct drm_crtc_state *crtc_state; + struct drm_crtc_state *new_cstate, *old_cstate; struct sde_vm_ops *vm_ops; enum sde_crtc_vm_req vm_req; struct sde_kms *sde_kms = to_sde_kms(kms); int i; - for_each_new_crtc_in_state(state, crtc, crtc_state, i) { - struct sde_crtc_state *cstate; + for_each_oldnew_crtc_in_state(state, crtc, old_cstate, new_cstate, i) { + struct sde_crtc_state *new_state; - cstate = to_sde_crtc_state(state->crtcs[0].new_state); + if (!new_cstate->active && !old_cstate->active) + continue; - vm_req = sde_crtc_get_property(cstate, CRTC_PROP_VM_REQ_STATE); + new_state = to_sde_crtc_state(new_cstate); + vm_req = sde_crtc_get_property(new_state, + CRTC_PROP_VM_REQ_STATE); if (vm_req != VM_REQ_ACQUIRE) return; }