summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAurabindo Pillai <aurabindo.pillai@amd.com>2020-09-11 15:10:11 -0400
committerBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>2020-10-05 13:54:51 -0400
commitd710992187deab057941f5f2145e35c069684975 (patch)
tree696720b2e0d33cc94b76fa6f562b8f2b81f8d63c
parent6fb7926fecc332110208f93a8a795b5fe1df0431 (diff)
drm/amd/display: Move disable interrupt into commit tail
[Why&How] Since there is no need for accessing crtc state in the interrupt handler, interrupts need not be disabled well in advance, and can be moved to commit_tail where it should be. Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c56
1 files changed, 18 insertions, 38 deletions
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 99c7f1511332..4fa6bed9873f 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -8151,44 +8151,6 @@ static int amdgpu_dm_atomic_commit(struct drm_device *dev,
struct drm_atomic_state *state,
bool nonblock)
{
- struct drm_crtc *crtc;
- struct drm_crtc_state *old_crtc_state, *new_crtc_state;
- struct dm_crtc_state *dm_old_crtc_state;
- struct amdgpu_device *adev = drm_to_adev(dev);
- int i;
-
- /*
- * We evade vblank and pflip interrupts on CRTCs that are undergoing
- * a modeset, being disabled, or have no active planes.
- *
- * It's done in atomic commit rather than commit tail for now since
- * some of these interrupt handlers access the current CRTC state and
- * potentially the stream pointer itself.
- *
- * Since the atomic state is swapped within atomic commit and not within
- * commit tail this would leave to new state (that hasn't been committed yet)
- * being accesssed from within the handlers.
- *
- * TODO: Fix this so we can do this in commit tail and not have to block
- * in atomic check.
- */
-#if !defined(for_each_oldnew_crtc_in_state)
- for_each_crtc_in_state(state, crtc, new_crtc_state, i) {
- old_crtc_state = crtc->state;
-#else
- for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
-#endif
- struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
-
- dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
-
- if (old_crtc_state->active &&
- (!new_crtc_state->active ||
- drm_atomic_crtc_needs_modeset(new_crtc_state))) {
- manage_dm_interrupts(adev, acrtc, false);
- dc_stream_release(dm_old_crtc_state->stream);
- }
- }
/*
* Add check here for SoC's that support hardware cursor plane, to
* unset legacy_cursor_update
@@ -8275,6 +8237,24 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
dc_resource_state_copy_construct_current(dm->dc, dc_state);
}
+#if !defined(for_each_oldnew_crtc_in_state)
+ for_each_crtc_in_state(state, crtc, new_crtc_state, i) {
+ old_crtc_state = crtc->state;
+#else
+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
+#endif
+ struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
+
+ dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);
+
+ if (old_crtc_state->active &&
+ (!new_crtc_state->active ||
+ drm_atomic_crtc_needs_modeset(new_crtc_state))) {
+ manage_dm_interrupts(adev, acrtc, false);
+ dc_stream_release(dm_old_crtc_state->stream);
+ }
+ }
+
/* update changed items */
#if !defined(for_each_oldnew_crtc_in_state)
for_each_crtc_in_state(state, crtc, old_crtc_state, i) {