@@ -8896,6 +8896,7 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
88968896 struct replay_settings * pr = & acrtc_state -> stream -> link -> replay_settings ;
88978897 struct amdgpu_dm_connector * aconn =
88988898 (struct amdgpu_dm_connector * )acrtc_state -> stream -> dm_stream_context ;
8899+ bool vrr_active = amdgpu_dm_crtc_vrr_active (acrtc_state );
88998900
89008901 if (acrtc_state -> update_type > UPDATE_TYPE_FAST ) {
89018902 if (pr -> config .replay_supported && !pr -> replay_feature_enabled )
@@ -8922,14 +8923,15 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_crtc *acrtc_attach,
89228923 * adequate number of fast atomic commits to notify KMD
89238924 * of update events. See `vblank_control_worker()`.
89248925 */
8925- if (acrtc_attach -> dm_irq_params .allow_sr_entry &&
8926+ if (!vrr_active &&
8927+ acrtc_attach -> dm_irq_params .allow_sr_entry &&
89268928#ifdef CONFIG_DRM_AMD_SECURE_DISPLAY
89278929 !amdgpu_dm_crc_window_is_activated (acrtc_state -> base .crtc ) &&
89288930#endif
89298931 (current_ts - psr -> psr_dirty_rects_change_timestamp_ns ) > 500000000 ) {
89308932 if (pr -> replay_feature_enabled && !pr -> replay_allow_active )
89318933 amdgpu_dm_replay_enable (acrtc_state -> stream , true);
8932- if (psr -> psr_version > = DC_PSR_VERSION_SU_1 &&
8934+ if (psr -> psr_version = = DC_PSR_VERSION_SU_1 &&
89338935 !psr -> psr_allow_active && !aconn -> disallow_edp_enter_psr )
89348936 amdgpu_dm_psr_enable (acrtc_state -> stream );
89358937 }
@@ -9100,7 +9102,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
91009102 acrtc_state -> stream -> link -> psr_settings .psr_dirty_rects_change_timestamp_ns =
91019103 timestamp_ns ;
91029104 if (acrtc_state -> stream -> link -> psr_settings .psr_allow_active )
9103- amdgpu_dm_psr_disable (acrtc_state -> stream );
9105+ amdgpu_dm_psr_disable (acrtc_state -> stream , true );
91049106 mutex_unlock (& dm -> dc_lock );
91059107 }
91069108 }
@@ -9266,11 +9268,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
92669268 bundle -> stream_update .abm_level = & acrtc_state -> abm_level ;
92679269
92689270 mutex_lock (& dm -> dc_lock );
9269- if (acrtc_state -> update_type > UPDATE_TYPE_FAST ) {
9271+ if (( acrtc_state -> update_type > UPDATE_TYPE_FAST ) || vrr_active ) {
92709272 if (acrtc_state -> stream -> link -> replay_settings .replay_allow_active )
92719273 amdgpu_dm_replay_disable (acrtc_state -> stream );
92729274 if (acrtc_state -> stream -> link -> psr_settings .psr_allow_active )
9273- amdgpu_dm_psr_disable (acrtc_state -> stream );
9275+ amdgpu_dm_psr_disable (acrtc_state -> stream , true );
92749276 }
92759277 mutex_unlock (& dm -> dc_lock );
92769278
@@ -11379,6 +11381,25 @@ static int dm_crtc_get_cursor_mode(struct amdgpu_device *adev,
1137911381 return 0 ;
1138011382}
1138111383
11384+ static bool amdgpu_dm_crtc_mem_type_changed (struct drm_device * dev ,
11385+ struct drm_atomic_state * state ,
11386+ struct drm_crtc_state * crtc_state )
11387+ {
11388+ struct drm_plane * plane ;
11389+ struct drm_plane_state * new_plane_state , * old_plane_state ;
11390+
11391+ drm_for_each_plane_mask (plane , dev , crtc_state -> plane_mask ) {
11392+ new_plane_state = drm_atomic_get_plane_state (state , plane );
11393+ old_plane_state = drm_atomic_get_plane_state (state , plane );
11394+
11395+ if (old_plane_state -> fb && new_plane_state -> fb &&
11396+ get_mem_type (old_plane_state -> fb ) != get_mem_type (new_plane_state -> fb ))
11397+ return true;
11398+ }
11399+
11400+ return false;
11401+ }
11402+
1138211403/**
1138311404 * amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM.
1138411405 *
@@ -11576,10 +11597,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1157611597
1157711598 /* Remove exiting planes if they are modified */
1157811599 for_each_oldnew_plane_in_descending_zpos (state , plane , old_plane_state , new_plane_state ) {
11579- if (old_plane_state -> fb && new_plane_state -> fb &&
11580- get_mem_type (old_plane_state -> fb ) !=
11581- get_mem_type (new_plane_state -> fb ))
11582- lock_and_validation_needed = true;
1158311600
1158411601 ret = dm_update_plane_state (dc , state , plane ,
1158511602 old_plane_state ,
@@ -11874,9 +11891,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1187411891
1187511892 /*
1187611893 * Only allow async flips for fast updates that don't change
11877- * the FB pitch, the DCC state, rotation, etc.
11894+ * the FB pitch, the DCC state, rotation, mem_type, etc.
1187811895 */
11879- if (new_crtc_state -> async_flip && lock_and_validation_needed ) {
11896+ if (new_crtc_state -> async_flip &&
11897+ (lock_and_validation_needed ||
11898+ amdgpu_dm_crtc_mem_type_changed (dev , state , new_crtc_state ))) {
1188011899 drm_dbg_atomic (crtc -> dev ,
1188111900 "[CRTC:%d:%s] async flips are only supported for fast updates\n" ,
1188211901 crtc -> base .id , crtc -> name );
0 commit comments