HYL_OK3568_LINUX/buildroot/package/weston/0054-HACK-Use-negative-value-for-dynamic-repaint-window.patch
2025-05-10 21:49:39 +08:00

54 lines
1.9 KiB
Diff

From d452ad4bc7d66b15884e3e82762e1bd3046da54d Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Thu, 28 Oct 2021 12:47:09 +0800
Subject: [PATCH 54/93] HACK: Use negative value for dynamic repaint window
Support using negative value for a vblank based dynamic repaint window:
When negative, repaint-window = vblank-duration - abs(repaint-window)
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
compositor/main.c | 2 +-
libweston/compositor.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/compositor/main.c b/compositor/main.c
index efd861b..e57d26a 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -1116,7 +1116,7 @@ weston_compositor_init_config(struct weston_compositor *ec,
s = weston_config_get_section(config, "core", NULL, NULL);
weston_config_section_get_int(s, "repaint-window", &repaint_msec,
ec->repaint_msec);
- if (repaint_msec < -10 || repaint_msec > 1000) {
+ if (repaint_msec < -1000 || repaint_msec > 1000) {
weston_log("Invalid repaint_window value in config: %d\n",
repaint_msec);
} else {
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 2ea1967..ff07e40 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -3665,10 +3665,17 @@ weston_output_finish_frame(struct weston_output *output,
output->frame_time = *stamp;
- timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec);
+ /* HACK: Use negative value for dynamic repaint window */
+ if (compositor->repaint_msec > 0)
+ timespec_add_nsec(&output->next_repaint, stamp, refresh_nsec);
+
timespec_add_msec(&output->next_repaint, &output->next_repaint,
-compositor->repaint_msec);
msec_rel = timespec_sub_to_msec(&output->next_repaint, &now);
+ if (msec_rel < 0) {
+ output->next_repaint = now;
+ msec_rel = 0;
+ }
if (msec_rel < -1000 || msec_rel > 1000) {
static bool warned;
--
2.20.1