summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2017-01-16 15:38:54 +0000
committerDaniel Stone <daniels@collabora.com>2017-01-30 16:45:19 +0000
commitcd1a1c34f881de4da1184d39b8934f311bd5d04c (patch)
treec0ef9973ed17c08ed1ac10c3771fa2163afe0838
parent1298073b5a15cfedfc00cb2207376671145fc074 (diff)
Add comments and whitespace to repaint machinery
repaint_needed / repaint_scheduled are surprisingly subtle. Explode the conditional with side-effects into more obvious separate calls, and document what they do. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r--libweston/compositor.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 5e232778..42102646 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -2335,16 +2335,31 @@ output_repaint_timer_handler(void *data)
{
struct weston_output *output = data;
struct weston_compositor *compositor = output->compositor;
+ int ret;
- if (output->repaint_needed &&
- compositor->state != WESTON_COMPOSITOR_SLEEPING &&
- compositor->state != WESTON_COMPOSITOR_OFFSCREEN &&
- weston_output_repaint(output) == 0)
- return 0;
+ /* If we're sleeping, drop the repaint machinery entirely; we will
+ * explicitly repaint all outputs when we come back. */
+ if (compositor->state == WESTON_COMPOSITOR_SLEEPING ||
+ compositor->state == WESTON_COMPOSITOR_OFFSCREEN)
+ goto err;
- weston_output_schedule_repaint_reset(output);
+ /* We don't actually need to repaint this output; drop it from
+ * repaint until something causes damage. */
+ if (!output->repaint_needed)
+ goto err;
+
+ /* If repaint fails, we aren't going to get weston_output_finish_frame
+ * to trigger a new repaint, so drop it from repaint and hope
+ * something later schedules a successful repaint. */
+ ret = weston_output_repaint(output);
+ if (ret != 0)
+ goto err;
return 0;
+
+err:
+ weston_output_schedule_repaint_reset(output);
+ return 0;
}
WL_EXPORT void