Skip to content

Commit 3df00ec

Browse files
leo-sunli1smb49
authored andcommitted
drm/amd/display: Run idle optimizations at end of vblank handler
BugLink: https://bugs.launchpad.net/bugs/2101042 commit 17e68f89132b9ee4b144358b49e5df404b314181 upstream. [Why & How] 1. After allowing idle optimizations, hw programming is disallowed. 2. Before hw programming, we need to disallow idle optimizations. Otherwise, in scenario 1, we will immediately kick hw out of idle optimizations with register access. Scenario 2 is less of a concern, since any register access will kick hw out of idle optimizations. But we'll do it early for correctness. Signed-off-by: Leo Li <sunpeng.li@amd.com> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 1a1220a commit 3df00ec

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work)
108108
else if (dm->active_vblank_irq_count)
109109
dm->active_vblank_irq_count--;
110110

111-
dc_allow_idle_optimizations(dm->dc, dm->active_vblank_irq_count == 0);
112-
113-
DRM_DEBUG_KMS("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);
111+
if (dm->active_vblank_irq_count > 0) {
112+
DRM_DEBUG_KMS("Allow idle optimizations (MALL): false\n");
113+
dc_allow_idle_optimizations(dm->dc, false);
114+
}
114115

115116
/*
116117
* Control PSR based on vblank requirements from OS
@@ -137,6 +138,11 @@ static void amdgpu_dm_crtc_vblank_control_worker(struct work_struct *work)
137138
}
138139
}
139140

141+
if (dm->active_vblank_irq_count == 0) {
142+
DRM_DEBUG_KMS("Allow idle optimizations (MALL): true\n");
143+
dc_allow_idle_optimizations(dm->dc, true);
144+
}
145+
140146
mutex_unlock(&dm->dc_lock);
141147

142148
dc_stream_release(vblank_work->stream);

0 commit comments

Comments
 (0)