summaryrefslogtreecommitdiff
path: root/src/xcb_out.c
AgeCommit message (Collapse)Author
2010-04-17Always wake up readers after writing.Jamey Sharp
Since writers must make sure they read as well, threads may have gone to sleep waiting for the opportunity to read. The writer must wake up one of those readers or the application can hang. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Josh Triplett <josh@freedesktop.org>
2010-04-17Delete a useless level of indirection from _xcb_out_send's parameters.Jamey Sharp
_xcb_out_send needs _xcb_conn_wait to store back its progress so it can be reinvoked to pick up where it left off---but then _xcb_out_send guarantees that it leaves either an empty output vector or a shut-down connection, so *its* callers never care how much progress was made. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Josh Triplett <josh@freedesktop.org>
2009-07-06Fix precedence bug: wrong length for big-requests preceded by sync.Jamey Sharp
Also replace excessively clever use of bitwise OR with equivalent addition. Reported-by: Geoffrey Li <geoffrey@seitopos.com> Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
2008-10-29Support handing off socket write permission to external code.Josh Triplett
Libraries like Xlib, some XCB language bindings, and potentially others have a common problem: they want to share the X connection with XCB. This requires coordination of request sequence numbers. Previously, XCB had an Xlib-specific lock, and allowed Xlib to block XCB from making requests. Now we've replaced that lock with a handoff mechanism, xcb_take_socket, allowing external code to ask XCB for permission to take over the write side of the socket and send raw data with xcb_writev. The caller of xcb_take_socket must supply a callback which XCB can call when it wants the write side of the socket back to make a request. This callback synchronizes with the external socket owner, flushes any output queues if appropriate, and then returns the sequence number of the last request sent over the socket. Commit by Josh Triplett and Jamey Sharp. Handoff mechanism inspired by Keith Packard.
2008-10-29Track 64-bit sequence numbers internally.Jamey Sharp
External APIs that used 32-bit sequence numbers continue to do so. Commit by Josh Triplett and Jamey Sharp.
2008-10-29Inline _xcb_lock_io, _xcb_unlock_io, and _xcb_wait_io.Jamey Sharp
These functions are once again a single pthread call, so just make that call directly.
2008-08-28Use unsigned to compare and rename syncJulien Danjou
- i must be unsigned to be compare in the loop - sync shadow global sync() function Signed-off-by: Julien Danjou <julien@danjou.info>
2007-10-28Factor pthread_cond_wait(iolock) to _xcb_wait_io.Jamey Sharp
This parallels the _xcb_lock_io and _xcb_unlock_io factoring.
2006-11-18Provide xcb_prefetch_maximum_request_length counterpart to ↵Jamey Sharp
xcb_get_maximum_request_length.
2006-10-04Factor out pthread_mutex_lock and unlock calls for the iolock.Jamey Sharp
2006-09-25Stop installing the protocol descriptions for extensions to an extensions/Josh Triplett
subdirectory
2006-09-23The Great XCB RenamingJosh Triplett
Rename API to follow a new naming convention: * XCB_CONSTANTS_UPPERCASE_WITH_UNDERSCORES * xcb_functions_lowercase_with_underscores * xcb_types_lowercase_with_underscores_and_suffix_t * expand all abbreviations like "req", "rep", and "iter" Word boundaries for the names in the protocol descriptions fall: * Wherever the protocol descriptions already have an underscore * Between a lowercase letter and a subsequent uppercase letter * Before the last uppercase letter in a string of uppercase letters followed by a lowercase letter (such as in LSBFirst between LSB and First) * Before and after a string of digits (with exceptions for sized types like xcb_char2b_t and xcb_glx_float32_t to match the stdint.h convention) Also fix up some particular naming issues: * Rename shape_op and shape_kind to drop the "shape_" prefix, since otherwise these types end up as xcb_shape_shape_{op,kind}_t. * Remove leading underscores from enums in the GLX protocol description, previously needed to ensure a word separator, but now redundant. This renaming breaks code written for the previous API naming convention. The scripts in XCB's tools directory will convert code written for the old API to use the new API; they work well enough that we used them to convert the non-program-generated code in XCB, and when run on the old program-generated code, they almost exactly reproduce the new program-generated code (modulo whitespace and bugs in the old code generator). Authors: Vincent Torri, Thomas Hunger, Josh Triplett
2006-09-21Shut down the connection in all "fatal" error cases.Jamey Sharp
2006-09-21Make all public functions do nothing on an error connection.Jamey Sharp
2006-07-30Fix Keith's 32-bit wrap fix.Jamey Sharp
Issue 0, 1, or 2 syncs as needed and do not handle 16-bit wrap until absolutely necessary.
2006-07-01Switch sequence comparisons to handle 32-bit sequence number wrap.Keith Packard
Create a macro, XCB_SEQUENCE_COMPARE, that accepts two sequence numbers and a comparison operator and correctly handles 32-bit wrap around. Rewrite all ordered sequence number comparisons to use this macro. Also, caught one error where a sequence was stored in a signed int variable. Push out a GetInputFocus request when the sequence number does wrap at 32 bits so that applications cannot see sequence 0 (as that is an error indicator).
2006-05-14Use correct word offset when testing for GetFBConfigsSGIX VendorPrivate.Jamey Sharp
2006-05-14In the GLX workaround, use !strcmp to check for equality with "GLX", not strcmp.Josh Triplett
2006-04-20Minor performance improvement: do not call _xcb_in_expect_reply unless it is ↵Jamey Sharp
needed. It is not often needed.
2006-03-12Merge branch 'master' of git+ssh://git.freedesktop.org/git/xcbJamey Sharp
2006-03-12Only _xcb_conn_wait calls _xcb_out_write now, so move it to xcb_conn.c and ↵Jamey Sharp
make it static.
2006-03-12Remove c->out.vec. Pass iovecs directly down the call tree. Add ↵Jamey Sharp
_xcb_out_flush_to, refactor other functions, make write_block static.
2006-03-11Portability fixes. Should help DragonFly and Solaris, and should not hurt ↵Jamey Sharp
anything else. Tested only on linux so far though.
2006-03-09Move c->out.vec refs out of _xcb_conn_wait up to _xcb_out_flush.Jamey Sharp
2006-03-08Move c->out.vec refs out of _xcb_out_write up to _xcb_conn_wait.Jamey Sharp
2006-03-07Fix off-by-one error that kept the last byte(s) of the output queue from ↵Jamey Sharp
being used.
2006-03-06Off-by-one error in the sequence-wrapping proof, and therefore in the ↵Jamey Sharp
corresponding code.
2006-03-05Implement provably-correct sequence wrap handling. Add flag ↵Jamey Sharp
XCB_REQUEST_DISCARD_REPLY.
2006-03-03API/ABI change: XCBSendRequest returns the sequence number instead of using ↵Jamey Sharp
an out-parameter. Now 0 is a special sequence number indicating failure.
2006-03-02Tweak to previous API change: Require that spare iovecs fall before ↵Jamey Sharp
vector[0]. Leave vector in well-defined state.
2006-03-02assert() that XCBSendRequest was handed enough space to set opcodes and ↵Jamey Sharp
short length fields.
2006-03-02API/ABI change: XCBSendRequest callers must pad to 4-byte boundaries now. ↵Jamey Sharp
When not in RAW mode, a null pointer for iov_base is replaced by up to 3 padding bytes.
2006-02-27Buffer a couple CARD32s on the stack instead of using an extra iovec. Also a ↵Jamey Sharp
bugfix: do not hold a reference to longlen after it goes out of scope.
2006-02-27Add XCB_REQUEST_RAW flag for XCBSendRequest.Jamey Sharp
2006-02-27Move test for other writing threads *before* allocating a sequence number.Jamey Sharp
2006-02-26API/ABI break: Add flags to XCBSendRequest, first for error-checked requests.Jamey Sharp
There's no more race condition between event and reply handling. The *RequestBlind and *RequestChecked functions are not yet implemented.
2006-02-25Rearrange an if statement that's been bothering me.Jamey Sharp
2006-02-24Coalesce _xcb_writev into _xcb_out_write and simplify.Jamey Sharp
2006-02-24Remove XCB_CEIL and use a simpler definition for XCB_PAD.Jamey Sharp
2006-02-24Bugfix: protect the output queue from being written while another thread is ↵Jamey Sharp
flushing it.
2006-02-24Simplify: Always use writev. (In _xcb_out_flush, convert the output queue to ↵Jamey Sharp
a single iovec if needed.)
2006-02-23Factor padding out of _xcb_out_write_block and into its callers, ↵Jamey Sharp
XCBSendRequest and write_setup. This requires dynamically allocating memory in XCBSendRequest, but this malloc/free pair turns out to cause a 30% speed hit for the 'x11perf -noop' test -- so for the moment I use alloca where available and fall back to malloc on other platforms. Later I think I'll change the contract of XCBSendRequest so the caller is responsible for memory allocation, because the caller ought to always be able to stack-allocate here.
2006-02-23Minor performance fix: Only rearrange buffers for BIG-REQUESTs.Jamey Sharp
2006-02-23Move request_written update back where it was for now: doing it early can ↵Jamey Sharp
cause XCBWaitForReply to wrongly believe that the request has been flushed. Eventually, we should fix bug #6021.
2006-02-23Move _xcb_write and _xcb_writev to xcb_out.c and make them static, since ↵Jamey Sharp
only _xcb_out_write calls them.
2006-02-23More return value changes, and make _xcb_in_read_packet static since it is ↵Jamey Sharp
not called from outside xcb_in.c.
2006-02-23More return value changes.Jamey Sharp
2006-02-23Make the return value of _xcb_conn_wait boolean, instead of syscall-like.Jamey Sharp
2006-02-22Bugfix: move request_written update *before* _xcb_conn_wait in ↵Jamey Sharp
_xcb_out_flush. Otherwise a reply may be read before we record that we have sent the request, and then XCB gets... confused.
2006-02-22Remove vestiges of adjacent request combining implementation. It is very dead.Jamey Sharp