Skip to content

Commit 0f0c5ca

Browse files
Tom Chunggregkh
authored andcommitted
drm/amd/display: Disable replay and psr while VRR is enabled
commit 67edb81 upstream. [Why] Replay and PSR will cause some video corruption while VRR is enabled. [How] 1. Disable the Replay and PSR while VRR is enabled. 2. Change the amdgpu_dm_crtc_vrr_active() parameter to const. Because the function will only read data from dm_crtc_state. Reviewed-by: Sun peng Li <[email protected]> Signed-off-by: Tom Chung <[email protected]> Signed-off-by: Roman Li <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit d787934) Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 583d3a4 commit 0f0c5ca

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8889,6 +8889,7 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
88898889
struct replay_settings *pr = &acrtc_state->stream->link->replay_settings;
88908890
struct amdgpu_dm_connector *aconn =
88918891
(struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context;
8892+
bool vrr_active = amdgpu_dm_crtc_vrr_active(acrtc_state);
88928893

88938894
if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
88948895
if (pr->config.replay_supported && !pr->replay_feature_enabled)
@@ -8915,7 +8916,8 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
89158916
* adequate number of fast atomic commits to notify KMD
89168917
* of update events. See `vblank_control_worker()`.
89178918
*/
8918-
if (acrtc_attach->dm_irq_params.allow_sr_entry &&
8919+
if (!vrr_active &&
8920+
acrtc_attach->dm_irq_params.allow_sr_entry &&
89198921
#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
89208922
!amdgpu_dm_crc_window_is_activated(acrtc_state->base.crtc) &&
89218923
#endif
@@ -9259,7 +9261,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
92599261
bundle->stream_update.abm_level = &acrtc_state->abm_level;
92609262

92619263
mutex_lock(&dm->dc_lock);
9262-
if (acrtc_state->update_type > UPDATE_TYPE_FAST) {
9264+
if ((acrtc_state->update_type > UPDATE_TYPE_FAST) || vrr_active) {
92639265
if (acrtc_state->stream->link->replay_settings.replay_allow_active)
92649266
amdgpu_dm_replay_disable(acrtc_state->stream);
92659267
if (acrtc_state->stream->link->psr_settings.psr_allow_active)

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ int amdgpu_dm_crtc_set_vupdate_irq(struct drm_crtc *crtc, bool enable)
9393
return rc;
9494
}
9595

96-
bool amdgpu_dm_crtc_vrr_active(struct dm_crtc_state *dm_state)
96+
bool amdgpu_dm_crtc_vrr_active(const struct dm_crtc_state *dm_state)
9797
{
9898
return dm_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE ||
9999
dm_state->freesync_config.state == VRR_STATE_ACTIVE_FIXED;

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ int amdgpu_dm_crtc_set_vupdate_irq(struct drm_crtc *crtc, bool enable);
3737

3838
bool amdgpu_dm_crtc_vrr_active_irq(struct amdgpu_crtc *acrtc);
3939

40-
bool amdgpu_dm_crtc_vrr_active(struct dm_crtc_state *dm_state);
40+
bool amdgpu_dm_crtc_vrr_active(const struct dm_crtc_state *dm_state);
4141

4242
int amdgpu_dm_crtc_enable_vblank(struct drm_crtc *crtc);
4343

0 commit comments

Comments
 (0)