Skip to content

Commit 1ca67ab

Browse files
emersionalexdeucher
authored andcommitted
drm/amd/display: only accept async flips for fast updates
Up until now, amdgpu was silently degrading to vsync when user-space requested an async flip but the hardware didn't support it. The hardware doesn't support immediate flips when the update changes the FB pitch, the DCC state, the rotation, enables or disables CRTCs or planes, etc. This is reflected in the dm_crtc_state.update_type field: UPDATE_TYPE_FAST means that immediate flip is supported. Silently degrading async flips to vsync is not the expected behavior from a uAPI point-of-view. Xorg expects async flips to fail if unsupported, to be able to fall back to a blit. i915 already behaves this way. This patch aligns amdgpu with uAPI expectations and returns a failure when an async flip is not possible. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: André Almeida <andrealmeid@igalia.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: André Almeida <andrealmeid@igalia.com> Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent b42ae87 commit 1ca67ab

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8125,7 +8125,15 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
81258125
* Only allow immediate flips for fast updates that don't
81268126
* change memory domain, FB pitch, DCC state, rotation or
81278127
* mirroring.
8128+
*
8129+
* dm_crtc_helper_atomic_check() only accepts async flips with
8130+
* fast updates.
81288131
*/
8132+
if (crtc->state->async_flip &&
8133+
acrtc_state->update_type != UPDATE_TYPE_FAST)
8134+
drm_warn_once(state->dev,
8135+
"[PLANE:%d:%s] async flip with non-fast update\n",
8136+
plane->base.id, plane->name);
81298137
bundle->flip_addrs[planes_count].flip_immediate =
81308138
crtc->state->async_flip &&
81318139
acrtc_state->update_type == UPDATE_TYPE_FAST &&

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,18 @@ static int dm_crtc_helper_atomic_check(struct drm_crtc *crtc,
398398
return -EINVAL;
399399
}
400400

401+
/*
402+
* Only allow async flips for fast updates that don't change the FB
403+
* pitch, the DCC state, rotation, etc.
404+
*/
405+
if (crtc_state->async_flip &&
406+
dm_crtc_state->update_type != UPDATE_TYPE_FAST) {
407+
drm_dbg_atomic(crtc->dev,
408+
"[CRTC:%d:%s] async flips are only supported for fast updates\n",
409+
crtc->base.id, crtc->name);
410+
return -EINVAL;
411+
}
412+
401413
/* In some use cases, like reset, no stream is attached */
402414
if (!dm_crtc_state->stream)
403415
return 0;

0 commit comments

Comments
 (0)