[Xcb] [Bug 6686] Use XCB_REQUEST_RAW flag for performance

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Aug 31 09:23:21 PDT 2009


http://bugs.freedesktop.org/show_bug.cgi?id=6686


Jamey Sharp <jamey at minilop.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|josh at freedesktop.org        |julien at danjou.info




--- Comment #5 from Jamey Sharp <jamey at minilop.net>  2009-08-31 09:23:19 PST ---
Awesome, thanks Julien. :-) I don't think this patch is right though.

First, you should be able to programatically work out when this optimization is
OK, rather than listing the functions to apply it to. According to my original
notes in this bug, the request a) must not be in an extension and b) must not
have any parameters. I think that's more restrictive than necessary but I can't
remember why I described it that way, and at least it isn't wrong.

More importantly: When you use XCB_REQUEST_RAW, xcb_send_request won't set the
length or major opcode fields for you. It just sends the bag of bytes that you
hand it, exactly as-is. So you can't pass it an uninitialized request, you have
to set those fields.

In my original illustrative patch, I set those fields by preinitializing a
'static const' request. That means fewer instructions and especially fewer
stores, and is probably where the "must not have any parameters" restriction
came from.

If you don't make the request const, then I think this optimization applies to
any core protocol request that does not have variable-length parameters.
Ideally you'd use 'static const' where possible as well as non-const raw
requests for the others.

If we did a little API work in core XCB, we could extend this to extension
requests as well, but I don't want to think that hard yet.


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the Xcb mailing list