pixman_region32_fini(&output_damage);
output->repaint_needed = false;
+ if (r == 0)
+ output->repaint_status = REPAINT_AWAITING_COMPLETION;
weston_compositor_repick(ec);
static void
weston_output_schedule_repaint_reset(struct weston_output *output)
{
- output->repaint_scheduled = 0;
+ output->repaint_status = REPAINT_NOT_SCHEDULED;
TL_POINT("core_repaint_exit_loop", TLP_OUTPUT(output), TLP_END);
}
struct weston_compositor *compositor = output->compositor;
int ret;
+ assert(output->repaint_status == REPAINT_SCHEDULED);
+
/* 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 ||
TL_POINT("core_repaint_finished", TLP_OUTPUT(output),
TLP_VBLANK(stamp), TLP_END);
+ assert(output->repaint_status == REPAINT_AWAITING_COMPLETION);
assert(stamp || (presented_flags & WP_PRESENTATION_FEEDBACK_INVALID));
/* If we haven't been supplied any timestamp at all, we don't have a
msec_rel += refresh_nsec / 1000000;
out:
+ output->repaint_status = REPAINT_SCHEDULED;
+
if (msec_rel < 1)
output_repaint_timer_handler(output);
else
{
struct weston_output *output = data;
+ assert(output->repaint_status == REPAINT_BEGIN_FROM_IDLE);
+ output->repaint_status = REPAINT_AWAITING_COMPLETION;
output->start_repaint_loop(output);
}
loop = wl_display_get_event_loop(compositor->wl_display);
output->repaint_needed = true;
- if (output->repaint_scheduled)
+
+ /* If we already have a repaint scheduled for our idle handler,
+ * no need to set it again. If the repaint has been called but
+ * not finished, then weston_output_finish_frame() will notice
+ * that a repaint is needed and schedule one. */
+ if (output->repaint_status != REPAINT_NOT_SCHEDULED)
return;
+ output->repaint_status = REPAINT_BEGIN_FROM_IDLE;
wl_event_loop_add_idle(loop, idle_repaint, output);
- output->repaint_scheduled = 1;
TL_POINT("core_repaint_enter_loop", TLP_OUTPUT(output), TLP_END);
}
/** True if damage has occurred since the last repaint for this output;
* if set, a repaint will eventually occur. */
bool repaint_needed;
- int repaint_scheduled;
+
+ /** State of the repaint loop */
+ enum {
+ REPAINT_NOT_SCHEDULED = 0, /**< idle; no repaint will occur */
+ REPAINT_BEGIN_FROM_IDLE, /**< start_repaint_loop scheduled */
+ REPAINT_SCHEDULED, /**< repaint is scheduled to occur */
+ REPAINT_AWAITING_COMPLETION, /**< last repaint not yet finished */
+ } repaint_status;
+
struct wl_event_source *repaint_timer;
struct weston_output_zoom zoom;
int dirty;