summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-01-29 22:12:00 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-01-29 22:26:00 +0000
commit91834fbdee40f46e18d071fd2671a7a642e6aa86 (patch)
tree90e5bc4bf85b63981c225b94ede179988f4ccd8d
parent89092b97b50a7740058d0f72f94dfc6defe15ed6 (diff)
xlib/shm: Clarify testing of seqno
Rename the seqno tests into seqno_passed(), seqno_before() and seqno_after() in order to clarify their semantics. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/cairo-xlib-source.c2
-rw-r--r--src/cairo-xlib-surface-shm.c20
2 files changed, 17 insertions, 5 deletions
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index 0cc32e8e..56dff657 100644
--- a/src/cairo-xlib-source.c
+++ b/src/cairo-xlib-source.c
@@ -87,10 +87,10 @@ _cairo_xlib_proxy_finish (void *abstract_surface)
{
cairo_xlib_proxy_t *proxy = abstract_surface;
+ _cairo_xlib_shm_surface_mark_active (proxy->owner);
XRenderFreePicture (proxy->source.dpy, proxy->source.picture);
if (proxy->source.pixmap)
XFreePixmap (proxy->source.dpy, proxy->source.pixmap);
- _cairo_xlib_shm_surface_mark_active (proxy->owner);
cairo_surface_destroy (proxy->owner);
return CAIRO_STATUS_SUCCESS;
}
diff --git a/src/cairo-xlib-surface-shm.c b/src/cairo-xlib-surface-shm.c
index 32c70330..8ac765e6 100644
--- a/src/cairo-xlib-surface-shm.c
+++ b/src/cairo-xlib-surface-shm.c
@@ -221,6 +221,18 @@ seqno_passed (unsigned long a, unsigned long b)
return (long)(b - a) >= 0;
}
+static inline cairo_bool_t
+seqno_before (unsigned long a, unsigned long b)
+{
+ return (long)(b - a) > 0;
+}
+
+static inline cairo_bool_t
+seqno_after (unsigned long a, unsigned long b)
+{
+ return (long)(a - b) > 0;
+}
+
static inline cairo_status_t
_pqueue_init (struct pqueue *pq)
{
@@ -424,7 +436,7 @@ static void send_event(cairo_xlib_display_t *display,
{
XShmCompletionEvent ev;
- if (seqno_passed (seqno, display->shm->last_event))
+ if (seqno_before (seqno, display->shm->last_event))
return;
ev.type = display->shm->event;
@@ -471,7 +483,7 @@ _cairo_xlib_shm_info_cleanup (cairo_xlib_display_t *display)
info = PQ_TOP(pq);
do {
- if (! seqno_passed (info->last_request, processed)) {
+ if (seqno_after (info->last_request, processed)) {
send_event (display, info, display->shm->last_request);
return;
}
@@ -544,7 +556,7 @@ _cairo_xlib_shm_pool_cleanup (cairo_xlib_display_t *display)
cairo_list_foreach_entry_safe (pool, next, cairo_xlib_shm_t,
&display->shm->pool, link) {
- if (! seqno_passed (pool->attached, processed))
+ if (seqno_before (pool->attached, processed))
break;
if (pool->mem.free_bytes == pool->mem.max_bytes)
@@ -720,7 +732,7 @@ _cairo_xlib_shm_surface_finish (void *abstract_surface)
if (active (shm, display->display)) {
shm->info->last_request = shm->active;
_pqueue_push (&display->shm->info, shm->info);
- if (! seqno_passed (display->shm->last_request, shm->active))
+ if (seqno_before (display->shm->last_request, shm->active))
display->shm->last_request = shm->active;
} else {
_cairo_mempool_free (&shm->info->pool->mem, shm->info->mem);