Skip to content

Commit 35ca53b

Browse files
leo-sunli1alexdeucher
authored andcommitted
drm/amd/display: Do not elevate mem_type change to full update
[Why] There should not be any need to revalidate bandwidth on memory placement change, since the fb is expected to be pinned to DCN-accessable memory before scanout. For APU it's DRAM, and DGPU, it's VRAM. However, async flips + memory type change needs to be rejected. [How] Do not set lock_and_validation_needed on mem_type change. Instead, reject an async_flip request if the crtc's buffer(s) changed mem_type. This may fix stuttering/corruption experienced with PSR SU and PSR1 panels, if the compositor allocates fbs in both VRAM carveout and GTT and flips between them. Fixes: a7c0cad ("drm/amd/display: ensure async flips are only accepted for fast updates") Reviewed-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Tom Chung <chiahsuan.chung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 4caacd1) Cc: stable@vger.kernel.org
1 parent ff2e4d8 commit 35ca53b

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11379,6 +11379,25 @@ static int dm_crtc_get_cursor_mode(struct amdgpu_device *adev,
1137911379
return 0;
1138011380
}
1138111381

11382+
static bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
11383+
struct drm_atomic_state *state,
11384+
struct drm_crtc_state *crtc_state)
11385+
{
11386+
struct drm_plane *plane;
11387+
struct drm_plane_state *new_plane_state, *old_plane_state;
11388+
11389+
drm_for_each_plane_mask(plane, dev, crtc_state->plane_mask) {
11390+
new_plane_state = drm_atomic_get_plane_state(state, plane);
11391+
old_plane_state = drm_atomic_get_plane_state(state, plane);
11392+
11393+
if (old_plane_state->fb && new_plane_state->fb &&
11394+
get_mem_type(old_plane_state->fb) != get_mem_type(new_plane_state->fb))
11395+
return true;
11396+
}
11397+
11398+
return false;
11399+
}
11400+
1138211401
/**
1138311402
* amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM.
1138411403
*
@@ -11576,10 +11595,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1157611595

1157711596
/* Remove exiting planes if they are modified */
1157811597
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;
1158311598

1158411599
ret = dm_update_plane_state(dc, state, plane,
1158511600
old_plane_state,
@@ -11874,9 +11889,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1187411889

1187511890
/*
1187611891
* Only allow async flips for fast updates that don't change
11877-
* the FB pitch, the DCC state, rotation, etc.
11892+
* the FB pitch, the DCC state, rotation, mem_type, etc.
1187811893
*/
11879-
if (new_crtc_state->async_flip && lock_and_validation_needed) {
11894+
if (new_crtc_state->async_flip &&
11895+
(lock_and_validation_needed ||
11896+
amdgpu_dm_crtc_mem_type_changed(dev, state, new_crtc_state))) {
1188011897
drm_dbg_atomic(crtc->dev,
1188111898
"[CRTC:%d:%s] async flips are only supported for fast updates\n",
1188211899
crtc->base.id, crtc->name);

0 commit comments

Comments
 (0)