Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Imre Deak <imre.deak@intel.com>
Subject: [PATCH v2 1/2] drm/xe/display: Match i915 driver suspend/resume sequences better
Date: Tue,  6 Aug 2024 12:50:43 +0200	[thread overview]
Message-ID: <20240806105044.596842-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20240806105044.596842-1-maarten.lankhorst@linux.intel.com>

Suspend fbdev sooner, and disable user access before suspending to
prevent some races. I've noticed this when comparing xe suspend to
i915's.

Matches the following commits from i915:
24b412b1bfeb ("drm/i915: Disable intel HPD poll after DRM poll init/enable")
1ef28d86bea9 ("drm/i915: Suspend the framebuffer console earlier during system suspend")
bd738d859e71 ("drm/i915: Prevent modesets during driver init/shutdown")

Thanks to Imre for pointing me to those commits.

Driver shutdown is currently missing, but I have some idea how to
implement it next.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/xe/display/xe_display.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
index ca4468c820788..d544d18ad1ecc 100644
--- a/drivers/gpu/drm/xe/display/xe_display.c
+++ b/drivers/gpu/drm/xe/display/xe_display.c
@@ -294,8 +294,11 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 	 * properly.
 	 */
 	intel_power_domains_disable(xe);
-	if (has_display(xe))
+	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
+	if (has_display(xe)) {
 		drm_kms_helper_poll_disable(&xe->drm);
+		intel_display_driver_disable_user_access(xe);
+	}
 
 	if (!runtime)
 		intel_display_driver_suspend(xe);
@@ -304,12 +307,13 @@ void xe_display_pm_suspend(struct xe_device *xe, bool runtime)
 
 	intel_hpd_cancel_work(xe);
 
+	if (has_display(xe))
+		intel_display_driver_suspend_access(xe);
+
 	intel_encoder_suspend_all(&xe->display);
 
 	intel_opregion_suspend(xe, s2idle ? PCI_D1 : PCI_D3cold);
 
-	intel_fbdev_set_suspend(&xe->drm, FBINFO_STATE_SUSPENDED, true);
-
 	intel_dmc_suspend(xe);
 }
 
@@ -347,14 +351,19 @@ void xe_display_pm_resume(struct xe_device *xe, bool runtime)
 	intel_display_driver_init_hw(xe);
 	intel_hpd_init(xe);
 
+	if (has_display(xe))
+		intel_display_driver_resume_access(xe);
+
 	/* MST sideband requires HPD interrupts enabled */
 	intel_dp_mst_resume(xe);
 	if (!runtime)
 		intel_display_driver_resume(xe);
 
-	intel_hpd_poll_disable(xe);
-	if (has_display(xe))
+	if (has_display(xe)) {
 		drm_kms_helper_poll_enable(&xe->drm);
+		intel_display_driver_enable_user_access(xe);
+	}
+	intel_hpd_poll_disable(xe);
 
 	intel_opregion_resume(xe);
 
-- 
2.45.2


  reply	other threads:[~2024-08-06 10:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 10:50 [PATCH v2 0/2] drm/xe/display suspend/resume fixes Maarten Lankhorst
2024-08-06 10:50 ` Maarten Lankhorst [this message]
2024-08-13 16:32   ` [PATCH v2 1/2] drm/xe/display: Match i915 driver suspend/resume sequences better Shankar, Uma
2024-08-06 10:50 ` [PATCH v2 2/2] drm/xe/display: Make display suspend/resume work on discrete Maarten Lankhorst
2024-08-13 17:41   ` Shankar, Uma
2024-08-06 10:56 ` ✓ CI.Patch_applied: success for drm/xe/display suspend/resume fixes. (rev2) Patchwork
2024-08-06 10:56 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-06 10:57 ` ✓ CI.KUnit: success " Patchwork
2024-08-06 11:13 ` ✓ CI.Build: " Patchwork
2024-08-06 11:17 ` ✓ CI.Hooks: " Patchwork
2024-08-06 11:19 ` ✓ CI.checksparse: " Patchwork
2024-08-06 11:40 ` ✓ CI.BAT: " Patchwork
2024-08-06 12:38 ` ✗ CI.FULL: failure " Patchwork
2024-08-08  7:06 ` ✓ CI.Patch_applied: success for drm/xe/display suspend/resume fixes. (rev3) Patchwork
2024-08-08  7:06 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-08  7:08 ` ✓ CI.KUnit: success " Patchwork
2024-08-08  7:19 ` ✓ CI.Build: " Patchwork
2024-08-08  7:22 ` ✓ CI.Hooks: " Patchwork
2024-08-08  7:23 ` ✓ CI.checksparse: " Patchwork
2024-08-08  7:43 ` ✓ CI.BAT: " Patchwork
2024-08-08  9:28 ` ✗ CI.FULL: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240806105044.596842-2-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox