Skip to content

Commit

Permalink
drm/msm/dpu: Require modeset if clone mode status changes
Browse files Browse the repository at this point in the history
If the clone mode enabled status is changing, a modeset needs to happen
so that the resources can be reassigned

Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/637483/
Link: https://lore.kernel.org/r/20250214-concurrent-wb-v6-5-a44c293cf422@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Jessica Zhang authored and Dmitry Baryshkov committed Mar 5, 2025
1 parent 2ea3468 commit 2097260
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
17 changes: 12 additions & 5 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,19 +1351,26 @@ static int dpu_crtc_assign_resources(struct drm_crtc *crtc,
*
* Check if the changes in the object properties demand full mode set.
*/
int dpu_crtc_check_mode_changed(struct drm_crtc_state *crtc_state)
int dpu_crtc_check_mode_changed(struct drm_crtc_state *old_crtc_state,
struct drm_crtc_state *new_crtc_state)
{
struct drm_encoder *drm_enc;
struct drm_crtc *crtc = crtc_state->crtc;
struct drm_crtc *crtc = new_crtc_state->crtc;
bool clone_mode_enabled = drm_crtc_in_clone_mode(old_crtc_state);
bool clone_mode_requested = drm_crtc_in_clone_mode(new_crtc_state);

DRM_DEBUG_ATOMIC("%d\n", crtc->base.id);

/* there might be cases where encoder needs a modeset too */
drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
if (dpu_encoder_needs_modeset(drm_enc, crtc_state->state))
crtc_state->mode_changed = true;
drm_for_each_encoder_mask(drm_enc, crtc->dev, new_crtc_state->encoder_mask) {
if (dpu_encoder_needs_modeset(drm_enc, new_crtc_state->state))
new_crtc_state->mode_changed = true;
}

if ((clone_mode_requested && !clone_mode_enabled) ||
(!clone_mode_requested && clone_mode_enabled))
new_crtc_state->mode_changed = true;

return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ static inline int dpu_crtc_frame_pending(struct drm_crtc *crtc)
return crtc ? atomic_read(&to_dpu_crtc(crtc)->frame_pending) : -EINVAL;
}

int dpu_crtc_check_mode_changed(struct drm_crtc_state *crtc_state);
int dpu_crtc_check_mode_changed(struct drm_crtc_state *old_crtc_state,
struct drm_crtc_state *new_crtc_state);

int dpu_crtc_vblank(struct drm_crtc *crtc, bool en);

Expand Down
5 changes: 3 additions & 2 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,12 @@ static void dpu_kms_disable_commit(struct msm_kms *kms)
static int dpu_kms_check_mode_changed(struct msm_kms *kms, struct drm_atomic_state *state)
{
struct drm_crtc_state *new_crtc_state;
struct drm_crtc_state *old_crtc_state;
struct drm_crtc *crtc;
int i;

for_each_new_crtc_in_state(state, crtc, new_crtc_state, i)
dpu_crtc_check_mode_changed(new_crtc_state);
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i)
dpu_crtc_check_mode_changed(old_crtc_state, new_crtc_state);

return 0;
}
Expand Down

0 comments on commit 2097260

Please sign in to comment.