From 84beddbe9e11606fb67c91b2703fac9876d975a1 Mon Sep 17 00:00:00 2001 From: Amine Najahi Date: Wed, 11 Nov 2020 21:46:14 -0500 Subject: [PATCH] disp: msm: sde: bound crts and encoders for TUI displays Currently, when starting a TUI session on a secondary display, user-mode will select CRTC[1]/DSI-2 to initiate the session in PVM and select CRTC[0]/DSI-2 in TVM to drive the frame. This breaks existing cont. splash assumption that secondary display will be using CRTC[1] in TVM session. Instead, driver can inform user-mode of the possible CRTCs to use for each of the encoders. This change sets the possible_crtcs variable on both DSI encoders so that user-mode selects DSI-1/CRTC[0] and DSI-2/CRTC[1] in the TVM use case. Change-Id: Ic68f92901e42db80fb97799a05d11b5f3473af97 Signed-off-by: Amine Najahi --- msm/sde/sde_kms.c | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index 302a7f4ee8..29c79a3e7e 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -3021,6 +3021,40 @@ static int sde_kms_inform_cont_splash_res_disable(struct msm_kms *kms, return 0; } +static int sde_kms_vm_trusted_cont_splash_res_init(struct sde_kms *sde_kms) +{ + int i; + void *display; + struct dsi_display *dsi_display; + struct drm_encoder *encoder; + + if (!sde_kms) + return -EINVAL; + + if (!sde_in_trusted_vm(sde_kms)) + return 0; + + for (i = 0; i < sde_kms->dsi_display_count; i++) { + display = sde_kms->dsi_displays[i]; + dsi_display = (struct dsi_display *)display; + + if (!dsi_display->bridge->base.encoder) { + SDE_ERROR("no encoder on dsi display:%d", i); + return -EINVAL; + } + + encoder = dsi_display->bridge->base.encoder; + encoder->possible_crtcs = 1 << i; + + SDE_DEBUG( + "dsi-display:%d encoder id[%d]=%d name=%s crtcs=%x\n", i, + encoder->index, encoder->base.id, + encoder->name, encoder->possible_crtcs); + } + + return 0; +} + static int sde_kms_cont_splash_config(struct msm_kms *kms) { void *display; @@ -3050,6 +3084,12 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms) return -EINVAL; } + rc = sde_kms_vm_trusted_cont_splash_res_init(sde_kms); + if (rc) { + SDE_ERROR("failed vm cont splash resource init, rc=%d", rc); + return -EINVAL; + } + if (((sde_kms->splash_data.type == SDE_SPLASH_HANDOFF) && (!sde_kms->splash_data.num_splash_regions)) || !sde_kms->splash_data.num_splash_displays) { @@ -3102,9 +3142,9 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms) encoder->crtc = priv->crtcs[i]; crtc = encoder->crtc; splash_display->encoder = encoder; - - SDE_DEBUG("for dsi-display:%d crtc id = %d enc id =%d\n", - i, crtc->base.id, encoder->base.id); + SDE_DEBUG("for dsi-display:%d crtc id[%d]:%d enc id[%d]:%d\n", + i, crtc->index, crtc->base.id, encoder->index, + encoder->base.id); mutex_lock(&dev->mode_config.mutex); drm_connector_list_iter_begin(dev, &conn_iter);