- padded =
-#ifdef HAVE_ALLOCA
- alloca
-#else
- malloc
-#endif
- ((req->count * 2 + 3) * sizeof(struct iovec));
- /* set the length field. */
- ((CARD16 *) vector[0].iov_base)[1] = shortlen;
- if(!shortlen)
+ /* do we need to work around the X server bug described in glx.xml? */
+ /* 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 && ((uint32_t *) vector[0].iov_base)[1] == 0x10004) ||
+ req->opcode == 21))
+ workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG;
+
+ /* get a sequence number and arrange for delivery. */
+ _xcb_lock_io(c);
+ /* wait for other writing threads to get out of my way. */
+ while(c->out.writing)
+ _xcb_wait_io(c, &c->out.cond);
+
+ request = ++c->out.request;
+ /* send GetInputFocus (sync_req) when 64k-2 requests have been sent without
+ * a reply.
+ * Also send sync_req (could use NoOp) at 32-bit wrap to avoid having
+ * applications see sequence 0 as that is used to indicate
+ * an error in sending the request */
+ while((req->isvoid &&
+ c->out.request == c->in.request_expected + (1 << 16) - 1) ||
+ request == 0)