Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRM: Add atomic commit log for resume #74

Open
wants to merge 1 commit into
base: celadon/u/mr0/master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading