HYL_OK3568_LINUX/buildroot/package/weston/0095-compositor-Delay-DPMS-ON-to-finsih_frame.patch
2025-05-10 21:49:39 +08:00

86 lines
2.6 KiB
Diff

From 4ef522b7ff6679bc41cb799b77c209770d1b8067 Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Tue, 18 Jul 2023 09:42:32 +0800
Subject: [PATCH 95/95] compositor: Delay DPMS-ON to finsih_frame()
To make sure that the new frame is ready when turning on outputs.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
include/libweston/libweston.h | 1 +
libweston/backend-drm/drm.c | 4 +---
libweston/compositor.c | 21 ++++++++++++++++++++-
3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h
index 06a9ab9..2fda659 100644
--- a/include/libweston/libweston.h
+++ b/include/libweston/libweston.h
@@ -574,6 +574,7 @@ struct weston_output {
void (*detach_head)(struct weston_output *output,
struct weston_head *head);
+ bool pending_active;
bool unavailable;
bool freezing;
diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
index 658e2c3..e410fe9 100644
--- a/libweston/backend-drm/drm.c
+++ b/libweston/backend-drm/drm.c
@@ -3862,9 +3862,7 @@ config_handle_output(struct drm_backend *b, const char *name,
continue;
output->base.freezing = false;
-
- if (!output->virtual)
- drm_set_dpms(&output->base, WESTON_DPMS_ON);
+ output->base.pending_active = 1;
weston_output_damage(&output->base);
} else if (!strncmp(config, "down-scale=",
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 24f4f36..24099c5 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -3659,6 +3659,13 @@ weston_output_finish_frame(struct weston_output *output,
struct timespec vblank_monotonic;
int64_t msec_rel;
+ /* Delayed DPMS-ON to avoid showing old frame */
+ if (output->pending_active) {
+ output->pending_active = false;
+ if (output->set_dpms)
+ output->set_dpms(output, WESTON_DPMS_ON);
+ }
+
/*
* If timestamp of latest vblank is given, it must always go forwards.
* If not given, INVALID flag must be set.
@@ -5546,9 +5553,21 @@ weston_compositor_dpms(struct weston_compositor *compositor,
{
struct weston_output *output;
- wl_list_for_each(output, &compositor->output_list, link)
+ wl_list_for_each(output, &compositor->output_list, link) {
+ /**
+ * Delay to weston_output_finish_frame() to avoid showing
+ * old frame
+ */
+ if (state == WESTON_DPMS_ON) {
+ output->pending_active = true;
+ weston_output_damage(output);
+ continue;
+ }
+ output->pending_active = false;
+
if (output->set_dpms)
output->set_dpms(output, state);
+ }
}
/** Restores the compositor to active status
--
2.20.1