Skip to content

Commit cb8f81c

Browse files
committed
drm/xe/display: Make display suspend/resume work on discrete
We should unpin before evicting all memory, and repin after GT resume. This way, we preserve the contents of the framebuffers, and won't hang on resume due to migration engine not being restored yet. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: stable@vger.kernel.org # v6.8+ Reviewed-by: Uma Shankar <uma.shankar@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240806105044.596842-3-maarten.lankhorst@linux.intel.com Signed-off-by: Maarten Lankhorst,,, <maarten.lankhorst@linux.intel.com>
1 parent 492be2a commit cb8f81c

File tree

2 files changed

+29
-5
lines changed

2 files changed

+29
-5
lines changed

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,27 @@ static bool suspend_to_idle(void)
287287
return false;
288288
}
289289

290+
static void xe_display_flush_cleanup_work(struct xe_device *xe)
291+
{
292+
struct intel_crtc *crtc;
293+
294+
for_each_intel_crtc(&xe->drm, crtc) {
295+
struct drm_crtc_commit *commit;
296+
297+
spin_lock(&crtc->base.commit_lock);
298+
commit = list_first_entry_or_null(&crtc->base.commit_list,
299+
struct drm_crtc_commit, commit_entry);
300+
if (commit)
301+
drm_crtc_commit_get(commit);
302+
spin_unlock(&crtc->base.commit_lock);
303+
304+
if (commit) {
305+
wait_for_completion(&commit->cleanup_done);
306+
drm_crtc_commit_put(commit);
307+
}
308+
}
309+
}
310+
290311
void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
291312
{
292313
struct intel_display *display = &xe->display;
@@ -308,6 +329,8 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
308329
if (!runtime)
309330
intel_display_driver_suspend(xe);
310331

332+
xe_display_flush_cleanup_work(xe);
333+
311334
intel_dp_mst_suspend(xe);
312335

313336
intel_hpd_cancel_work(xe);

drivers/gpu/drm/xe/xe_pm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ int xe_pm_suspend(struct xe_device *xe)
9393
for_each_gt(gt, xe, id)
9494
xe_gt_suspend_prepare(gt);
9595

96+
xe_display_pm_suspend(xe, false);
97+
9698
/* FIXME: Super racey... */
9799
err = xe_bo_evict_all(xe);
98100
if (err)
99101
goto err;
100102

101-
xe_display_pm_suspend(xe, false);
102-
103103
for_each_gt(gt, xe, id) {
104104
err = xe_gt_suspend(gt);
105105
if (err) {
@@ -154,11 +154,11 @@ int xe_pm_resume(struct xe_device *xe)
154154

155155
xe_irq_resume(xe);
156156

157-
xe_display_pm_resume(xe, false);
158-
159157
for_each_gt(gt, xe, id)
160158
xe_gt_resume(gt);
161159

160+
xe_display_pm_resume(xe, false);
161+
162162
err = xe_bo_restore_user(xe);
163163
if (err)
164164
goto err;
@@ -367,10 +367,11 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
367367
mutex_unlock(&xe->mem_access.vram_userfault.lock);
368368

369369
if (xe->d3cold.allowed) {
370+
xe_display_pm_suspend(xe, true);
371+
370372
err = xe_bo_evict_all(xe);
371373
if (err)
372374
goto out;
373-
xe_display_pm_suspend(xe, true);
374375
}
375376

376377
for_each_gt(gt, xe, id) {

0 commit comments

Comments
 (0)