Skip to content

Commit ddf6492

Browse files
mlankhorstrodrigovivi
authored andcommitted
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 <[email protected]> Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: [email protected] # v6.8+ Reviewed-by: Uma Shankar <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Maarten Lankhorst,,, <[email protected]> (cherry picked from commit cb8f81c) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 730b724 commit ddf6492

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
@@ -283,6 +283,27 @@ static bool suspend_to_idle(void)
283283
return false;
284284
}
285285

286+
static void xe_display_flush_cleanup_work(struct xe_device *xe)
287+
{
288+
struct intel_crtc *crtc;
289+
290+
for_each_intel_crtc(&xe->drm, crtc) {
291+
struct drm_crtc_commit *commit;
292+
293+
spin_lock(&crtc->base.commit_lock);
294+
commit = list_first_entry_or_null(&crtc->base.commit_list,
295+
struct drm_crtc_commit, commit_entry);
296+
if (commit)
297+
drm_crtc_commit_get(commit);
298+
spin_unlock(&crtc->base.commit_lock);
299+
300+
if (commit) {
301+
wait_for_completion(&commit->cleanup_done);
302+
drm_crtc_commit_put(commit);
303+
}
304+
}
305+
}
306+
286307
void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
287308
{
288309
bool s2idle = suspend_to_idle();
@@ -300,6 +321,8 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
300321
if (!runtime)
301322
intel_display_driver_suspend(xe);
302323

324+
xe_display_flush_cleanup_work(xe);
325+
303326
intel_dp_mst_suspend(xe);
304327

305328
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
@@ -91,13 +91,13 @@ int xe_pm_suspend(struct xe_device *xe)
9191
for_each_gt(gt, xe, id)
9292
xe_gt_suspend_prepare(gt);
9393

94+
xe_display_pm_suspend(xe, false);
95+
9496
/* FIXME: Super racey... */
9597
err = xe_bo_evict_all(xe);
9698
if (err)
9799
goto err;
98100

99-
xe_display_pm_suspend(xe, false);
100-
101101
for_each_gt(gt, xe, id) {
102102
err = xe_gt_suspend(gt);
103103
if (err) {
@@ -151,11 +151,11 @@ int xe_pm_resume(struct xe_device *xe)
151151

152152
xe_irq_resume(xe);
153153

154-
xe_display_pm_resume(xe, false);
155-
156154
for_each_gt(gt, xe, id)
157155
xe_gt_resume(gt);
158156

157+
xe_display_pm_resume(xe, false);
158+
159159
err = xe_bo_restore_user(xe);
160160
if (err)
161161
goto err;
@@ -363,10 +363,11 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
363363
mutex_unlock(&xe->mem_access.vram_userfault.lock);
364364

365365
if (xe->d3cold.allowed) {
366+
xe_display_pm_suspend(xe, true);
367+
366368
err = xe_bo_evict_all(xe);
367369
if (err)
368370
goto out;
369-
xe_display_pm_suspend(xe, true);
370371
}
371372

372373
for_each_gt(gt, xe, id) {

0 commit comments

Comments
 (0)