Skip to content

Commit 4caacd1

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 <[email protected]> Signed-off-by: Leo Li <[email protected]> Signed-off-by: Tom Chung <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent aa6713f commit 4caacd1

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
@@ -11464,6 +11464,25 @@ static int dm_crtc_get_cursor_mode(struct amdgpu_device *adev,
1146411464
return 0;
1146511465
}
1146611466

11467+
static bool amdgpu_dm_crtc_mem_type_changed(struct drm_device *dev,
11468+
struct drm_atomic_state *state,
11469+
struct drm_crtc_state *crtc_state)
11470+
{
11471+
struct drm_plane *plane;
11472+
struct drm_plane_state *new_plane_state, *old_plane_state;
11473+
11474+
drm_for_each_plane_mask(plane, dev, crtc_state->plane_mask) {
11475+
new_plane_state = drm_atomic_get_plane_state(state, plane);
11476+
old_plane_state = drm_atomic_get_plane_state(state, plane);
11477+
11478+
if (old_plane_state->fb && new_plane_state->fb &&
11479+
get_mem_type(old_plane_state->fb) != get_mem_type(new_plane_state->fb))
11480+
return true;
11481+
}
11482+
11483+
return false;
11484+
}
11485+
1146711486
/**
1146811487
* amdgpu_dm_atomic_check() - Atomic check implementation for AMDgpu DM.
1146911488
*
@@ -11661,10 +11680,6 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1166111680

1166211681
/* Remove exiting planes if they are modified */
1166311682
for_each_oldnew_plane_in_descending_zpos(state, plane, old_plane_state, new_plane_state) {
11664-
if (old_plane_state->fb && new_plane_state->fb &&
11665-
get_mem_type(old_plane_state->fb) !=
11666-
get_mem_type(new_plane_state->fb))
11667-
lock_and_validation_needed = true;
1166811683

1166911684
ret = dm_update_plane_state(dc, state, plane,
1167011685
old_plane_state,
@@ -11959,9 +11974,11 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
1195911974

1196011975
/*
1196111976
* Only allow async flips for fast updates that don't change
11962-
* the FB pitch, the DCC state, rotation, etc.
11977+
* the FB pitch, the DCC state, rotation, mem_type, etc.
1196311978
*/
11964-
if (new_crtc_state->async_flip && lock_and_validation_needed) {
11979+
if (new_crtc_state->async_flip &&
11980+
(lock_and_validation_needed ||
11981+
amdgpu_dm_crtc_mem_type_changed(dev, state, new_crtc_state))) {
1196511982
drm_dbg_atomic(crtc->dev,
1196611983
"[CRTC:%d:%s] async flips are only supported for fast updates\n",
1196711984
crtc->base.id, crtc->name);

0 commit comments

Comments
 (0)