Change boolean repaint_scheduled to quad-state enum

repaint_scheduled is actually cleverly a quad-state, disguised as a
boolean. There are four possible conditions for the repaint loop to be
in at any time:
  - loop idle; no repaint will occur until specifically requested, which
    may be never (repaint_scheduled == 0)
  - loop schedule to begin: the loop was previously idle, but due to a
    repaint-schedule request, we will call the start_repaint_loop hook
    in the next idle task
  - repaint scheduled: the compositor has definitively scheduled a
    repaint request for this output, which will occur in fixed time
  - awaiting repaint completion: the backend has not yet signaled
    completion of the last repaint request, and the compositor will not
    schedule another until it does so

All but the first condition were previously conflated as
repaint_scheduled == 1, but break them out into separate conditions to
aid clarity, backed up by some asserts.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 45dcb6d..5fc25c4 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -174,7 +174,15 @@
 	/** 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;