Re: [PATCH 2/2] drm/amd/display: Block immediate flips for non-fast updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Series is:

Reviewed-by: David Francis <david.francis@xxxxxxx>


From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of Nicholas Kazlauskas <nicholas.kazlauskas@xxxxxxx>
Sent: August 2, 2019 11:11:50 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx <amd-gfx@xxxxxxxxxxxxxxxxxxxxx>
Cc: Li, Sun peng (Leo) <Sunpeng.Li@xxxxxxx>; Francis, David <David.Francis@xxxxxxx>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@xxxxxxx>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@xxxxxxx>
Subject: [PATCH 2/2] drm/amd/display: Block immediate flips for non-fast updates
 
[Why]
Underflow can occur in the case where we change buffer pitch, DCC state,
rotation or mirroring for a plane while also performing an immediate
flip. It can also generate a p-state warning stack trace on DCN1 which
is typically observed during the cursor handler pipe locking because of
how frequent cursor updates can occur.

[How]
Store the update type on each CRTC - every plane will have access to
the CRTC state if it's flipping. If the update type is not
UPDATE_TYPE_FAST then the immediate flip should be disallowed.

No changes to the target vblank sequencing need to be done, we just
need to ensure that the surface registers do a double buffered update.

Cc: David Francis <david.francis@xxxxxxx>
Cc: Bhawanpreet Lakha <bhawanpreet.lakha@xxxxxxx>
Cc: Leo Li <sunpeng.li@xxxxxxx>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@xxxxxxx>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c    | 16 +++++++++++++++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h    |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index ffb3c7247ac6..e941d0d3794b 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5690,8 +5690,14 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                 bundle->surface_updates[planes_count].plane_info =
                         &bundle->plane_infos[planes_count];
 
+               /*
+                * Only allow immediate flips for fast updates that don't
+                * change FB pitch, DCC state, rotation or mirroing.
+                */
                 bundle->flip_addrs[planes_count].flip_immediate =
-                               (crtc->state->pageflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) != 0;
+                       (crtc->state->pageflip_flags &
+                        DRM_MODE_PAGE_FLIP_ASYNC) != 0 &&
+                       acrtc_state->update_type == UPDATE_TYPE_FAST;
 
                 timestamp_ns = ktime_get_ns();
                 bundle->flip_addrs[planes_count].flip_timestamp_in_us = div_u64(timestamp_ns, 1000);
@@ -7311,6 +7317,14 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
                 state->async_update = !drm_atomic_helper_async_check(dev, state);
         }
 
+       /* Store the overall update type for use later in atomic check. */
+       for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {
+               struct dm_crtc_state *dm_new_crtc_state =
+                       to_dm_crtc_state(new_crtc_state);
+
+               dm_new_crtc_state->update_type = (int)overall_update_type;
+       }
+
         /* Must be success */
         WARN_ON(ret);
         return ret;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index da48a857949f..cbd6608f58e6 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -307,6 +307,7 @@ struct dm_crtc_state {
         bool cm_has_degamma;
         bool cm_is_degamma_srgb;
 
+       int update_type;
         int active_planes;
         bool interrupts_enabled;
 
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux