From 1ec61a0b66b3009f1c8642bf6ec6bf1b14c26cbf Mon Sep 17 00:00:00 2001 From: Amine Najahi Date: Thu, 25 Jun 2020 16:20:53 -0400 Subject: [PATCH] disp: msm: sde: use new state when checking conn-crtc association Currently during CRTC atomic check phase, driver is counting the number of connectors attached to the CRTC by iterating over all the connectors available and checking if they are attached to the CRTC. The current implementation uses the old connector state, which has an invalid state for the first commit. This causes the number of attached connectors to always be 0 for the first commit. This change extracts the new connector state from the atomic state and ensures the calculation is done before checking crtc features. Change-Id: I58d641086f18e8624cbc2d432443323a6a44792e Signed-off-by: Amine Najahi --- msm/sde/sde_crtc.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/msm/sde/sde_crtc.c b/msm/sde/sde_crtc.c index a9db51e25e..f551fc9775 100644 --- a/msm/sde/sde_crtc.c +++ b/msm/sde/sde_crtc.c @@ -4857,6 +4857,7 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, struct sde_multirect_plane_states *multirect_plane = NULL; struct drm_connector *conn; struct drm_connector_list_iter conn_iter; + struct drm_connector_state *conn_state; if (!crtc) { SDE_ERROR("invalid crtc\n"); @@ -4892,6 +4893,19 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, if (state->active_changed) state->mode_changed = true; + /* identify connectors attached to this crtc */ + cstate->num_connectors = 0; + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(conn, &conn_iter) { + conn_state = drm_atomic_get_connector_state(state->state, conn); + + if (conn_state && conn_state->crtc == crtc && + cstate->num_connectors < MAX_CONNECTORS) { + cstate->connectors[cstate->num_connectors++] = conn; + } + } + drm_connector_list_iter_end(&conn_iter); + rc = _sde_crtc_check_dest_scaler_data(crtc, state); if (rc) { SDE_ERROR("crtc%d failed dest scaler check %d\n", @@ -4906,17 +4920,6 @@ static int sde_crtc_atomic_check(struct drm_crtc *crtc, goto end; } - /* identify connectors attached to this crtc */ - cstate->num_connectors = 0; - - drm_connector_list_iter_begin(dev, &conn_iter); - drm_for_each_connector_iter(conn, &conn_iter) - if (conn->state && conn->state->crtc == crtc && - cstate->num_connectors < MAX_CONNECTORS) { - cstate->connectors[cstate->num_connectors++] = conn; - } - drm_connector_list_iter_end(&conn_iter); - _sde_crtc_setup_is_ppsplit(state); _sde_crtc_setup_lm_bounds(crtc, state);