Skip to content

Commit

Permalink
DRM: Add the first atomic commit time for resume
Browse files Browse the repository at this point in the history
Print the period from S3 resume to firstly display commit

Tracked-On: OAM-129111
Signed-off-by: Jia, Lin A <[email protected]>
  • Loading branch information
ljia5 authored and sysopenci committed Jan 6, 2025
1 parent 8ff22fe commit 6fdbd2f
Show file tree
Hide file tree
Showing 4 changed files with 21 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->resume == true) {
old_state->resume = false;
ktime_t now = ktime_get();
u64 period_ns = ktime_to_ns(ktime_sub(now, acpi_resume_begin));
drm_info(crtc->dev, "The period from S3 resume to the first display atomic commit: %lld\n",
(long long)period_ns);
}
}
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->resume = true;

DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);

Expand Down
8 changes: 8 additions & 0 deletions include/drm/drm_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,14 @@ struct drm_atomic_state {
* commit without blocking.
*/
struct work_struct commit_work;

/**
* @resume:
*
* Indicate if system just resume from S3, will used it to control if print
* the first commit period.
*/
bool resume : 1;
};

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 6fdbd2f

Please sign in to comment.