[cairo] [RFC PATCH] xlib-shm: Use XCB for SHM synchronization

Chris Wilson chris at chris-wilson.co.uk
Sun Dec 1 04:41:31 PST 2013

On Sun, Dec 01, 2013 at 01:30:41PM +0100, Uli Schlachter wrote:
> The old code used XSendEvent() to make sure that LastKnownRequestProcessed()
> gets updated eventually and tracked sequence numbers to implement an
> asynchronous XSync() through this.
> The problems with this is that XSetEventQueueOwner(dpy, XCBOwnsEventQueue)
> changes semantics here and _XReadEvents() becomes a no-op. This broke the
> implementation and would cause an endless loop in
> _cairo_xlib_shm_surface_flush().
> Additionally, the SHM event that is generated through XSendEvent() ended up in
> the event queue and would need to be fetched by the main loop. Otherwise, the
> event queue's size would grow and "some things" got slow.
> The new implementation uses xcb_get_input_focus() and xcb_poll_for_reply() to
> implement the asynchronous XSync(). This causes more syncs to be done, because
> the old optimization of "only call XSendEvent() when actually needed" no longer
> applies. Also, this causes ownership of the X11 socket to be passed back and
> forth between XCB and Xlib.
> TODO: Run the perf suite and check for regressions

Not the perf suite but actual browser usage (e.g. midori).

Not impressed though.

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list