disp: msm: sde: correct num_datapath during PM resume with CWB

In PM resume with CWB concurrency usecase, crtc pointer in
conn->state is NULL since drm_mode_config_reset operation is
performed on pm_resume. This change relies on conn_mask in
new_crtc_state for primary connector retrieval and also adds
get_num_lm_from_mode callback to DSI for LM count retrieval
from dsi panel topology. Existing get_mode_info api cannot
retrieve the topology info because mode->priv_info is NULL.
This occurs as WB encoder is added in the drm encoder_list
before primary encoder, introduced as part of commit d28ebf05f4
("disp: msm: sde: populate WB display encoder list before dsi").

Change-Id: I55358fd88ab778bd81475cf3628be13335de1cb5
Signed-off-by: Jayaprakash Madisetty <jmadiset@codeaurora.org>
Signed-off-by: Samantha Tran <samtran@codeaurora.org>
This commit is contained in:
Jayaprakash Madisetty
2021-04-01 18:04:32 +05:30
committed by Samantha Tran
parent 6a01182c1e
commit a29369e224
8 changed files with 95 additions and 13 deletions

View File

@@ -5390,40 +5390,57 @@ end:
}
/**
* sde_crtc_get_num_datapath - get the number of datapath active
* of primary connector
* sde_crtc_get_num_datapath - get the number of layermixers active
* on primary connector
* @crtc: Pointer to DRM crtc object
* @connector: Pointer to DRM connector object of WB in CWB case
* @virtual_conn: Pointer to DRM connector object of WB in CWB case
* @crtc_state: Pointer to DRM crtc state
*/
int sde_crtc_get_num_datapath(struct drm_crtc *crtc,
struct drm_connector *connector)
struct drm_connector *virtual_conn, struct drm_crtc_state *crtc_state)
{
struct sde_crtc *sde_crtc = to_sde_crtc(crtc);
struct drm_connector *conn, *primary_conn = NULL;
struct sde_connector_state *sde_conn_state = NULL;
struct drm_connector *conn;
struct drm_connector_list_iter conn_iter;
int num_lm = 0;
if (!sde_crtc || !connector) {
if (!sde_crtc || !virtual_conn || !crtc_state) {
SDE_DEBUG("Invalid argument\n");
return 0;
}
/* return num_mixers used for primary when available in sde_crtc */
if (sde_crtc->num_mixers)
return sde_crtc->num_mixers;
drm_connector_list_iter_begin(crtc->dev, &conn_iter);
drm_for_each_connector_iter(conn, &conn_iter) {
if (conn->state && conn->state->crtc == crtc &&
conn != connector)
if ((drm_connector_mask(conn) & crtc_state->connector_mask)
&& conn != virtual_conn) {
sde_conn_state = to_sde_connector_state(conn->state);
primary_conn = conn;
break;
}
}
drm_connector_list_iter_end(&conn_iter);
/* if primary sde_conn_state has mode info available, return num_lm from here */
if (sde_conn_state)
return sde_conn_state->mode_info.topology.num_lm;
num_lm = sde_conn_state->mode_info.topology.num_lm;
return 0;
/* if PM resume occurs with CWB enabled, retrieve num_lm from primary dsi panel mode */
if (primary_conn && !num_lm) {
num_lm = sde_connector_get_lm_cnt_from_topology(primary_conn,
&crtc_state->adjusted_mode);
if (num_lm < 0) {
SDE_DEBUG("lm cnt fail for conn:%d num_lm:%d\n",
primary_conn->base.id, num_lm);
num_lm = 0;
}
}
return num_lm;
}
int sde_crtc_vblank(struct drm_crtc *crtc, bool en)