From 1b0b5b146f4f2819d53ace7436f6e1a87503e5e7 Mon Sep 17 00:00:00 2001 From: jialin Date: Sun, 15 Dec 2024 16:13:57 +0000 Subject: [PATCH] DRM: Add atomic commit time for resume Add the first atomic commit time after resume Tracked-On: Signed-off-by: Jia, Lin A --- drivers/acpi/sleep.c | 2 ++ drivers/gpu/drm/drm_atomic_helper.c | 10 ++++++++++ include/drm/drm_atomic.h | 1 + include/linux/suspend.h | 1 + 4 files changed, 14 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 32da5a0d80a5..9fee2975878c 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -32,6 +32,7 @@ */ bool acpi_no_s5; static u8 sleep_states[ACPI_S_STATE_COUNT]; +ktime_t acpi_resume_begin; static void acpi_sleep_tts_switch(u32 acpi_state) { @@ -598,6 +599,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state) if (error) return error; pr_info("Low-level resume complete\n"); + acpi_resume_begin = ktime_get(); pm_set_resume_via_firmware(); break; } diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 09fce8f75628..cf22e8486dff 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -2517,6 +2518,14 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state) complete_all(&old_state->fake_commit->hw_done); complete_all(&old_state->fake_commit->flip_done); } + + if (old_state->restore == 1) { + old_state->restore = 0; + ktime_t now = ktime_get(); + u64 period_ns = ktime_to_ns(ktime_sub(now, acpi_resume_begin)); + drm_info(crtc->dev, "resume completet, resume period %lld, restore = %d\n", + (long long)period_ns, old_state->restore); + } } EXPORT_SYMBOL(drm_atomic_helper_commit_hw_done); @@ -3572,6 +3581,7 @@ int drm_atomic_helper_resume(struct drm_device *dev, int err; drm_mode_config_reset(dev); + state->restore = 1; DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err); diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index e769cd9ad5f2..5df6831fdb24 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -428,6 +428,7 @@ struct drm_atomic_state { * commit without blocking. */ struct work_struct commit_work; + int restore; }; void __drm_crtc_commit_free(struct kref *kref); diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 8ed08c8cd1e2..fa984d3c8c00 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -11,6 +11,7 @@ #include #include +extern ktime_t acpi_resume_begin; #ifdef CONFIG_VT extern void pm_set_vt_switch(int); #else