Change boolean repaint_scheduled to quad-state enum
authorDaniel Stone <daniels@collabora.com>
Fri, 3 Mar 2017 16:59:42 +0000 (16:59 +0000)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 13 Mar 2017 12:20:06 +0000 (14:20 +0200)
commit05df8c16ec8a9ac124691f85d7d89e0a973fea64
tree5622832b53c8bc0364d02852c8b62113d02d3d73
parent09a97e2402c8188fa8b49075bc5604fe8275fb22
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>
libweston/compositor.c
libweston/compositor.h