[cairo-commit] src/cairo-xlib-source.c src/cairo-xlib-surface-shm.c
Chris Wilson
ickle at kemper.freedesktop.org
Tue Jan 29 14:30:38 PST 2013
src/cairo-xlib-source.c | 2 +-
src/cairo-xlib-surface-shm.c | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
New commits:
commit 91834fbdee40f46e18d071fd2671a7a642e6aa86
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Tue Jan 29 22:12:00 2013 +0000
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 at chris-wilson.co.uk>
diff --git a/src/cairo-xlib-source.c b/src/cairo-xlib-source.c
index 0cc32e8..56dff65 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 32c7033..8ac765e 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);
More information about the cairo-commit
mailing list