From: Greg Kroah-Hartman Date: Thu, 7 Sep 2023 14:48:16 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v6.1.53~134 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0aa0449e40f48d1868b208863fe47cb8df305607;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: drm-amd-display-ensure-async-flips-are-only-accepted-for-fast-updates.patch --- diff --git a/queue-6.1/drm-amd-display-ensure-async-flips-are-only-accepted-for-fast-updates.patch b/queue-6.1/drm-amd-display-ensure-async-flips-are-only-accepted-for-fast-updates.patch new file mode 100644 index 00000000000..d6956664619 --- /dev/null +++ b/queue-6.1/drm-amd-display-ensure-async-flips-are-only-accepted-for-fast-updates.patch @@ -0,0 +1,101 @@ +From a7c0cad0dc060bb77e9c9d235d68441b0fc69507 Mon Sep 17 00:00:00 2001 +From: Hamza Mahfooz +Date: Fri, 4 Aug 2023 11:13:04 -0400 +Subject: drm/amd/display: ensure async flips are only accepted for fast updates + +From: Hamza Mahfooz + +commit a7c0cad0dc060bb77e9c9d235d68441b0fc69507 upstream. + +We should be checking to see if async flips are supported in +amdgpu_dm_atomic_check() (i.e. not dm_crtc_helper_atomic_check()). Also, +async flipping isn't supported if a plane's framebuffer changes memory +domains during an atomic commit. So, move the check from +dm_crtc_helper_atomic_check() to amdgpu_dm_atomic_check() and check if +the memory domain has changed in amdgpu_dm_atomic_check(). + +Cc: stable@vger.kernel.org +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2733 +Fixes: c1e18c44dc7f ("drm/amd/display: only accept async flips for fast updates") +Reviewed-by: Harry Wentland +Signed-off-by: Hamza Mahfooz +Signed-off-by: Alex Deucher +Cc: Mario Limonciello +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 ++++++++++++++--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c | 12 -------- + 2 files changed, 21 insertions(+), 15 deletions(-) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -7858,10 +7858,12 @@ static void amdgpu_dm_commit_planes(stru + * fast updates. + */ + if (crtc->state->async_flip && +- acrtc_state->update_type != UPDATE_TYPE_FAST) ++ (acrtc_state->update_type != UPDATE_TYPE_FAST || ++ get_mem_type(old_plane_state->fb) != get_mem_type(fb))) + drm_warn_once(state->dev, + "[PLANE:%d:%s] async flip with non-fast update\n", + plane->base.id, plane->name); ++ + bundle->flip_addrs[planes_count].flip_immediate = + crtc->state->async_flip && + acrtc_state->update_type == UPDATE_TYPE_FAST && +@@ -9813,6 +9815,11 @@ static int amdgpu_dm_atomic_check(struct + + /* Remove exiting planes if they are modified */ + for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { ++ if (old_plane_state->fb && new_plane_state->fb && ++ get_mem_type(old_plane_state->fb) != ++ get_mem_type(new_plane_state->fb)) ++ lock_and_validation_needed = true; ++ + ret = dm_update_plane_state(dc, state, plane, + old_plane_state, + new_plane_state, +@@ -10064,9 +10071,20 @@ static int amdgpu_dm_atomic_check(struct + struct dm_crtc_state *dm_new_crtc_state = + to_dm_crtc_state(new_crtc_state); + ++ /* ++ * Only allow async flips for fast updates that don't change ++ * the FB pitch, the DCC state, rotation, etc. ++ */ ++ if (new_crtc_state->async_flip && lock_and_validation_needed) { ++ drm_dbg_atomic(crtc->dev, ++ "[CRTC:%d:%s] async flips are only supported for fast updates\n", ++ crtc->base.id, crtc->name); ++ ret = -EINVAL; ++ goto fail; ++ } ++ + dm_new_crtc_state->update_type = lock_and_validation_needed ? +- UPDATE_TYPE_FULL : +- UPDATE_TYPE_FAST; ++ UPDATE_TYPE_FULL : UPDATE_TYPE_FAST; + } + + /* Must be success */ +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +@@ -406,18 +406,6 @@ static int dm_crtc_helper_atomic_check(s + return -EINVAL; + } + +- /* +- * Only allow async flips for fast updates that don't change the FB +- * pitch, the DCC state, rotation, etc. +- */ +- if (crtc_state->async_flip && +- dm_crtc_state->update_type != UPDATE_TYPE_FAST) { +- drm_dbg_atomic(crtc->dev, +- "[CRTC:%d:%s] async flips are only supported for fast updates\n", +- crtc->base.id, crtc->name); +- return -EINVAL; +- } +- + /* In some use cases, like reset, no stream is attached */ + if (!dm_crtc_state->stream) + return 0; diff --git a/queue-6.1/series b/queue-6.1/series index 25976df309c..8665c261569 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -82,3 +82,4 @@ tpm-enable-hwrng-only-for-pluton-on-amd-cpus.patch kvm-x86-mmu-use-kstrtobool-instead-of-strtobool.patch kvm-x86-mmu-add-never-option-to-allow-sticky-disabling-of-nx_huge_pages.patch net-avoid-address-overwrite-in-kernel_connect.patch +drm-amd-display-ensure-async-flips-are-only-accepted-for-fast-updates.patch