Skip to content

Commit 08da182

Browse files
effective-lightalexdeucher
authored andcommitted
drm/amd/display: fix flickering caused by S/G mode
Currently, on a handful of ASICs. We allow the framebuffer for a given plane to exist in either VRAM or GTT. However, if the plane's new framebuffer is in a different memory domain than it's previous framebuffer, flipping between them can cause the screen to flicker. So, to fix this, don't perform an immediate flip in the aforementioned case. Cc: stable@vger.kernel.org Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2354 Reviewed-by: Roman Li <Roman.Li@amd.com> Fixes: 81d0bcf ("drm/amdgpu: make display pinning more flexible (v2)") Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9675b3b commit 08da182

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7901,6 +7901,13 @@ static void amdgpu_dm_commit_cursors(struct drm_atomic_state *state)
79017901
amdgpu_dm_plane_handle_cursor_update(plane, old_plane_state);
79027902
}
79037903

7904+
static inline uint32_t get_mem_type(struct drm_framebuffer *fb)
7905+
{
7906+
struct amdgpu_bo *abo = gem_to_amdgpu_bo(fb->obj[0]);
7907+
7908+
return abo->tbo.resource ? abo->tbo.resource->mem_type : 0;
7909+
}
7910+
79047911
static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
79057912
struct dc_state *dc_state,
79067913
struct drm_device *dev,
@@ -8043,11 +8050,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
80438050

80448051
/*
80458052
* Only allow immediate flips for fast updates that don't
8046-
* change FB pitch, DCC state, rotation or mirroing.
8053+
* change memory domain, FB pitch, DCC state, rotation or
8054+
* mirroring.
80478055
*/
80488056
bundle->flip_addrs[planes_count].flip_immediate =
80498057
crtc->state->async_flip &&
8050-
acrtc_state->update_type == UPDATE_TYPE_FAST;
8058+
acrtc_state->update_type == UPDATE_TYPE_FAST &&
8059+
get_mem_type(old_plane_state->fb) == get_mem_type(fb);
80518060

80528061
timestamp_ns = ktime_get_ns();
80538062
bundle->flip_addrs[planes_count].flip_timestamp_in_us = div_u64(timestamp_ns, 1000);

0 commit comments

Comments
 (0)