diff options
author | Uli Schlachter <psychon@znc.in> | 2010-12-25 14:46:43 +0100 |
---|---|---|
committer | M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> | 2011-01-02 23:50:47 +0200 |
commit | e5f54bb9f34a463cd10240451dd5d29a735c4506 (patch) | |
tree | 627a44dbd7ced22a97f908e41829c9dc1b5b5b6e /src/cairo-xcb-private.h | |
parent | 6b4e07d1430c704fc976edf63c27c46f16a8751f (diff) | |
download | cairo-e5f54bb9f34a463cd10240451dd5d29a735c4506.tar.gz |
XCB: Make sure SHM memory isn't reused too early
This commit delays the return of a SHM area to the free pool. When
_cairo_xcb_shm_info_destroy is called, it now adds the cairo_xcb_shm_info_t to a
list of pending memory areas and sends a GetInputFocus request to the server.
This cairo_xcb_shm_info_t is only really freed when the GetInputFocus request
completes. To avoid unnecessarily waiting for the X server, we check via
xcb_poll_for_reply for the reply which returns immediately if the reply isn't
received yet.
This commits fixes a race where the shared memory area is reused before the X
server finished reading data from it. This does NOT fix races where cairo draws
something new to the same cairo_xcb_shm_info_t while the X server still reads
from it. However, there doesn't seem to exist any code currently where the shm
info isn't immediately destroyed after it was used.
This commit fixes the following tests for xcb-render-0.0 if SHM is enabled:
joins mask mask-transformed-image push-group push-group-color radial-gradient
radil-gradient-mask radial-gradient-mask-source radial-gradient-one-stop
radial-gradient-source smask smask-mask smask-paint
This also fixes mesh-pattern-transformed for all the xcb boilerplate "backends".
Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-private.h')
-rw-r--r-- | src/cairo-xcb-private.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h index 7da888c43..b6b25ce39 100644 --- a/src/cairo-xcb-private.h +++ b/src/cairo-xcb-private.h @@ -68,6 +68,8 @@ struct _cairo_xcb_shm_info { uint32_t offset; void *mem; cairo_xcb_shm_mem_pool_t *pool; + xcb_get_input_focus_cookie_t sync; + cairo_list_t pending; }; struct _cairo_xcb_surface { @@ -187,6 +189,7 @@ struct _cairo_xcb_connection { cairo_mutex_t shm_mutex; cairo_list_t shm_pools; + cairo_list_t shm_pending; cairo_freepool_t shm_info_freelist; cairo_mutex_t screens_mutex; @@ -271,6 +274,9 @@ cairo_private void _cairo_xcb_shm_info_destroy (cairo_xcb_shm_info_t *shm_info); cairo_private void +_cairo_xcb_connection_shm_mem_pools_flush (cairo_xcb_connection_t *connection); + +cairo_private void _cairo_xcb_connection_shm_mem_pools_fini (cairo_xcb_connection_t *connection); cairo_private void |