Skip to content

Commit

Permalink
DRM: Add atomic commit time for resume
Browse files Browse the repository at this point in the history
Add the first atomic commit time after resume

Tracked-On:
Signed-off-by: Jia, Lin A <[email protected]>
  • Loading branch information
ljia5 committed Dec 16, 2024
1 parent bd445d6 commit 1b0b5b1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/acpi/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
}
Expand Down
10 changes: 10 additions & 0 deletions drivers/gpu/drm/drm_atomic_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <linux/dma-fence.h>
#include <linux/ktime.h>
#include <linux/suspend.h>

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions include/drm/drm_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/android_kabi.h>
#include <asm/errno.h>

extern ktime_t acpi_resume_begin;
#ifdef CONFIG_VT
extern void pm_set_vt_switch(int);
#else
Expand Down

0 comments on commit 1b0b5b1

Please sign in to comment.