[mutter] clutter/stage-cogl: Reduce while loop iterations
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter/stage-cogl: Reduce while loop iterations
- Date: Fri, 7 Jun 2019 15:39:45 +0000 (UTC)
commit 67a3715ded0f36fd03193adafb72e079460b7167
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Thu Jun 6 15:39:26 2019 +0800
clutter/stage-cogl: Reduce while loop iterations
If `last_presentation_time` is zero (unsupported) or just very old
(system was idle) then we would like to avoid that triggering a large
number of loop interations. This will get us closer to the right answer
without iterating.
https://gitlab.gnome.org/GNOME/mutter/merge_requests/363
clutter/clutter/cogl/clutter-stage-cogl.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
---
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 229015b90..03f067267 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -204,6 +204,19 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
next_presentation_time = stage_cogl->last_presentation_time + refresh_interval;
+ /* Get next_presentation_time closer to its final value, to reduce
+ * the number of while iterations below.
+ */
+ if (next_presentation_time < now)
+ {
+ int64_t last_virtual_presentation_time = now - now % refresh_interval;
+ int64_t hardware_clock_phase =
+ stage_cogl->last_presentation_time % refresh_interval;
+
+ next_presentation_time =
+ last_virtual_presentation_time + hardware_clock_phase;
+ }
+
while (next_presentation_time < now + min_render_time_allowed)
next_presentation_time += refresh_interval;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]