#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <errno.h>
#include "xcb.h"
#include "xcbext.h"
longlen += vector[i].iov_len;
if(!vector[i].iov_base)
{
- vector[i].iov_base = (caddr_t) pad;
+ vector[i].iov_base = (char *) pad;
assert(vector[i].iov_len <= sizeof(pad));
}
}
flags &= ~XCB_REQUEST_RAW;
/* do we need to work around the X server bug described in glx.xml? */
- if(req->ext && !req->isvoid && strcmp(req->ext->name, "GLX") &&
- ((req->opcode == 17 && ((CARD32 *) vector[0].iov_base)[0] == 0x10004) ||
+ /* XXX: GetFBConfigs won't use BIG-REQUESTS in any sane
+ * configuration, but that should be handled here anyway. */
+ if(req->ext && !req->isvoid && !strcmp(req->ext->name, "GLX") &&
+ ((req->opcode == 17 && ((CARD32 *) vector[0].iov_base)[1] == 0x10004) ||
req->opcode == 21))
workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG;
request = ++c->out.request;
assert(request != 0);
- _xcb_in_expect_reply(c, request, workaround, flags);
+ if(workaround != WORKAROUND_NONE || flags != 0)
+ _xcb_in_expect_reply(c, request, workaround, flags);
if(!req->isvoid)
c->in.request_expected = c->out.request;
pthread_mutex_destroy(&out->reqlenlock);
}
-/* precondition: there must be something for us to write. */
-int _xcb_out_write(XCBConnection *c, struct iovec **vector, int *count)
-{
- int n;
- assert(!c->out.queue_len);
- n = writev(c->fd, *vector, *count);
- if(n < 0 && errno == EAGAIN)
- return 1;
- if(n <= 0)
- return 0;
-
- for(; *count; --*count, ++*vector)
- {
- int cur = (*vector)->iov_len;
- if(cur > n)
- cur = n;
- (*vector)->iov_len -= cur;
- (*vector)->iov_base = (char *) (*vector)->iov_base + cur;
- n -= cur;
- if((*vector)->iov_len)
- break;
- }
- if(!*count)
- *vector = 0;
- assert(n == 0);
- return 1;
-}
-
int _xcb_out_send(XCBConnection *c, struct iovec **vector, int *count)
{
int ret = 1;