Slow XQueryPointer?

Lauri Kasanen cand at
Fri Jan 27 02:32:34 PST 2012


> You don't have to convert the entire app to XCB to be able to use it for
> just one or two calls, for example, most of xdpyinfo uses libX11 calls
> still, but the loop to list extensions uses xcb to be able to send all
> the queries and then wait for all the responses instead of doing a
> blocking call for every single extension:

Yes, but then I'd depend on libxcb (or have to dive into dlopen and friends).

> Simplest thing (although kind of hideous) might be to launch another
> thread with its own Display connection and only ever run XQueryPointer
> from that, save the coordinates in some shared variable protected by a
> mutex, and read from that in the main thread.  Or in a separate process
> over a pipe, if you don't like threads.
> I don't really know what you need the result for, though, so I don't
> know if that's a viable technique for you.

It's used once per frame for 3d movement (yeh, game). A thread might work.

Attaching a bench app I've used in tracking this down. Run it with some apps open (browser, IRC client, some terminals...) and watch the max number.
Perhaps it'll help, I don't remember how long running a x11perf test took.

- Lauri
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bench.c
Type: application/octet-stream
Size: 741 bytes
Desc: not available
URL: <>

More information about the xorg mailing list