disp: msm: sde: use drm mode set by user-mode in trusted-vm
Trusted-vm uses the cont-splash path to initialize the software states by reading the hardware registers and populating the SDE & DRM software states. But drm mode cannot be determined by register reads, so rely on user-mode to get the mode which comes as part of the first atomic_commit check phase which handles the transition. The primary-vm user-mode passes the current mode to trusted-vm through qrtr which is in-turn passed to driver to set that particular mode. Change-Id: I4fb86b40b8a0583c8edb539b0a51dcd33de731ff Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
This commit is contained in:
@@ -2645,6 +2645,9 @@ static int sde_kms_check_vm_request(struct msm_kms *kms,
|
||||
vm_ops->vm_owns_hw(sde_kms), rc);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (vm_ops->vm_resource_init)
|
||||
rc = vm_ops->vm_resource_init(sde_kms, state);
|
||||
}
|
||||
|
||||
end:
|
||||
@@ -3045,7 +3048,44 @@ static int sde_kms_vm_trusted_cont_splash_res_init(struct sde_kms *sde_kms)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sde_kms_cont_splash_config(struct msm_kms *kms)
|
||||
static struct drm_display_mode *_sde_kms_get_splash_mode(
|
||||
struct sde_kms *sde_kms, struct drm_connector *connector,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
struct drm_display_mode *mode, *cur_mode = NULL;
|
||||
struct drm_crtc *crtc;
|
||||
struct drm_crtc_state *new_cstate, *old_cstate;
|
||||
u32 i = 0;
|
||||
|
||||
if (sde_kms->splash_data.type == SDE_SPLASH_HANDOFF) {
|
||||
list_for_each_entry(mode, &connector->modes, head) {
|
||||
if (mode->type & DRM_MODE_TYPE_PREFERRED) {
|
||||
cur_mode = mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (state) {
|
||||
/* get the mode from first atomic_check phase for trusted_vm*/
|
||||
for_each_oldnew_crtc_in_state(state, crtc, old_cstate,
|
||||
new_cstate, i) {
|
||||
|
||||
if (!new_cstate->active && !old_cstate->active)
|
||||
continue;
|
||||
|
||||
list_for_each_entry(mode, &connector->modes, head) {
|
||||
if (drm_mode_equal(&new_cstate->mode, mode)) {
|
||||
cur_mode = mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cur_mode;
|
||||
}
|
||||
|
||||
static int sde_kms_cont_splash_config(struct msm_kms *kms,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
void *display;
|
||||
struct dsi_display *dsi_display;
|
||||
@@ -3160,12 +3200,16 @@ static int sde_kms_cont_splash_config(struct msm_kms *kms)
|
||||
|
||||
crtc->state->encoder_mask = (1 << drm_encoder_index(encoder));
|
||||
|
||||
/* currently consider modes[0] as the preferred mode */
|
||||
drm_mode = list_first_entry(&connector->modes,
|
||||
struct drm_display_mode, head);
|
||||
SDE_DEBUG("drm_mode->name = %s, type=0x%x, flags=0x%x\n",
|
||||
drm_mode = _sde_kms_get_splash_mode(sde_kms, connector, state);
|
||||
if (!drm_mode) {
|
||||
SDE_ERROR("drm_mode not found; handoff_type:%d\n",
|
||||
sde_kms->splash_data.type);
|
||||
return -EINVAL;
|
||||
}
|
||||
SDE_DEBUG(
|
||||
"drm_mode->name:%s, type:0x%x, flags:0x%x, handoff_type:%d\n",
|
||||
drm_mode->name, drm_mode->type,
|
||||
drm_mode->flags);
|
||||
drm_mode->flags, sde_kms->splash_data.type);
|
||||
|
||||
/* Update CRTC drm structure */
|
||||
crtc->state->active = true;
|
||||
@@ -4547,7 +4591,8 @@ void sde_kms_vm_trusted_resource_deinit(struct sde_kms *sde_kms)
|
||||
memset(&sde_kms->splash_data, 0, sizeof(struct sde_splash_data));
|
||||
}
|
||||
|
||||
int sde_kms_vm_trusted_resource_init(struct sde_kms *sde_kms)
|
||||
int sde_kms_vm_trusted_resource_init(struct sde_kms *sde_kms,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
struct drm_device *dev;
|
||||
struct msm_drm_private *priv;
|
||||
@@ -4588,7 +4633,7 @@ int sde_kms_vm_trusted_resource_init(struct sde_kms *sde_kms)
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = sde_kms_cont_splash_config(&sde_kms->base);
|
||||
ret = sde_kms_cont_splash_config(&sde_kms->base, state);
|
||||
if (ret) {
|
||||
SDE_ERROR("error in setting handoff configs\n");
|
||||
goto error;
|
||||
@@ -4603,8 +4648,6 @@ int sde_kms_vm_trusted_resource_init(struct sde_kms *sde_kms)
|
||||
return 0;
|
||||
|
||||
error:
|
||||
sde_kms_vm_trusted_resource_deinit(sde_kms);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user