X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_out.c;h=762efbd20eb41b448eb0515db1dac11a828a9d08;hb=731c85762d8994119f4eaf572cc59c9adbb7abd9;hp=145bddd7725c7151d7cc78f1c7ace1818872611f;hpb=f27166f49b9ef6bdcce78429bffc724d1e4fb360;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_out.c b/src/xcb_out.c index 145bddd..762efbd 100644 --- a/src/xcb_out.c +++ b/src/xcb_out.c @@ -79,7 +79,7 @@ CARD32 XCBGetMaximumRequestLength(XCBConnection *c) return c->out.maximum_request_length; } -int XCBSendRequest(XCBConnection *c, unsigned int *request, struct iovec *vector, const XCBProtocolRequest *req) +int XCBSendRequest(XCBConnection *c, unsigned int *request, int flags, struct iovec *vector, const XCBProtocolRequest *req) { static const char pad[3]; int ret; @@ -105,7 +105,7 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, struct iovec *vector ((CARD8 *) vector[0].iov_base)[1] = req->opcode; /* do we need to work around the X server bug described in glx.xml? */ - if(strcmp(req->ext->name, "GLX") && + if(!req->isvoid && strcmp(req->ext->name, "GLX") && ((req->opcode == 17 && ((CARD32 *) vector[0].iov_base)[0] == 0x10004) || req->opcode == 21)) workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG; @@ -117,17 +117,14 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, struct iovec *vector for(i = 0; i < req->count; ++i) longlen += (vector[i].iov_len + 3) >> 2; - if(longlen > c->setup->maximum_request_length) - { - if(longlen > XCBGetMaximumRequestLength(c)) - return 0; /* server can't take this; maybe need BIGREQUESTS? */ - } - else + if(longlen <= c->setup->maximum_request_length) { /* we don't need BIGREQUESTS. */ shortlen = longlen; longlen = 0; } + else if(longlen > XCBGetMaximumRequestLength(c)) + return 0; /* server can't take this; maybe need BIGREQUESTS? */ padded = #ifdef HAVE_ALLOCA @@ -173,10 +170,13 @@ int XCBSendRequest(XCBConnection *c, unsigned int *request, struct iovec *vector return -1; } + /* wait for other writing threads to get out of my way. */ + while(c->out.writing) + pthread_cond_wait(&c->out.cond, &c->iolock); + *request = ++c->out.request; - if(!req->isvoid) - _xcb_in_expect_reply(c, *request, workaround); + _xcb_in_expect_reply(c, *request, workaround, flags); ret = _xcb_out_write_block(c, padded, padlen); pthread_mutex_unlock(&c->iolock); @@ -254,8 +254,6 @@ int _xcb_out_write(XCBConnection *c) int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count) { - while(c->out.writing) - pthread_cond_wait(&c->out.cond, &c->iolock); assert(!c->out.vec && !c->out.vec_len); while(count && c->out.queue_len + vector[0].iov_len < sizeof(c->out.queue)) {