[Xcb] FW: Xlib buffer size

Jamey Sharp jamey at minilop.net
Tue Jun 1 10:46:06 PDT 2004


On Mon, May 31, 2004 at 07:49:24PM +0530, aparna.kailas at wipro.com wrote:
> I am new to X window. I am trying to port Xlib-TCP interface to
> another network layer.

Oh? What are you trying to port it to?

Note that this mailing list is for XCB, not Xlib; but since we're
working on replacing Xlib's network transport code with XCB, you
probably want to port XCB also. (You might even find that porting XCB is
easier...)

> I read in the X lib reference manual that Xlib buffers requests until
> some condition, like buffer is full or application is waiting for an
> event, before it flushes the buffer to the TCP layer.

This is true for XCB also; but see also Xlib's "synchronous mode".

> I would like to know :
> 1. what is the maximum data (in bytes) that the Xlib sends to the TCP
> enroute to the TCP layer (as in the case when the buffer becomes
> full)? 
> 2. Is the maximum Xlib buffer size fixed across implementations or
> does it vary?

For the reference implementation of Xlib, the output buffer size
defaults to 16kB, but you can change the buffer size by setting the
environment variable XLIBBUFFERSIZE to an appropriate number of bytes.
If you try to set it to less than 2kB, however, Xlib will use a 2kB
buffer. See OpenDis.c.

XCB's output buffer size is fixed at compile time. As shipped it's set
to 4kB, and I haven't provided a compile-time option for changing it.
Keith had some good argument for setting it to that size, but I forget
what it was. Note that when Xlib is compiled to use XCB, it uses XCB's
buffer.

This isn't the maximum data that Xlib or XCB might hand off to the
underlying transport, though. A single X request is allowed to be 256kB,
or 16GB if the BIG-REQUESTS extension is in use. Both of these libraries
will send the contents of the output buffer plus the entire request in
one writev system call.

I wouldn't generally expect the buffer size to matter, though. Are you
hoping to hardcode packet sizes or something? 
-- 
Jamey Sharp <jamey at minilop.net> - http://minilop.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://freedesktop.org/pipermail/xcb/attachments/20040601/eab73b6a/attachment.pgp


More information about the xcb mailing list