[Xcb] small utility libraries

Jamey Sharp jamey at minilop.net
Sun May 15 19:35:26 PDT 2005


[I'm moving this part of this thread from the Cairo mailing list. The
original threads begins at
http://lists.freedesktop.org/archives/cairo/2005-May/003957.html .]

On Sun, 2005-05-15 at 21:01 -0400, Owen Taylor wrote:
> On Sun, 2005-05-15 at 12:14 -0700, Jamey Sharp wrote:
> > On Sun, 2005-05-15 at 11:13 -0400, Owen Taylor wrote:
> > > On Sat, 2005-05-14 at 19:37 -0700, Jamey Sharp wrote:
> > > > You may want to be using Vincent Torri's XCBImage library, which is a
> > > > port of XImage to XCB. The code is available from the xcb-util module of
> > > > XCB CVS. It includes the XImage functions from Xlib as well as the XShm
> > > > functions.
> > > > 
> > > > I seem to recall the XYPixmap support doesn't work and we don't
> > > > understand why, but the library is probably worth using regardless.
> > > > XCBImage should let you eliminate a fair amount of code from the Cairo
> > > > XCB backend, while more closely reflecting the Xlib backend; and Cairo
> > > > really shouldn't use XYPixmaps anyway. ;-)
> > > 
> > > I can't imagine us ever wanting to use XYPixmaps.
> > > 
> > > But I don't really don't think Cairo needs anything much from images
> > > beyond for raw X protocol wrappers ...  we don't need the imutil
> > > stuff .... GetPixel/PutPixel, because we have libpixman.
> > 
> > Yeah, GetPixel and PutPixel are pretty pointless, at least here.
> > 
> > But when I first wrote the Cairo XCB backend, I copied and pasted code
> > out of XImage for things like the bits_per_pixel function, and I got
> > them wrong (Keith fixed them later). The XCBImage code is pretty slim
> > anyway, and doesn't do much more than I think Cairo actually needs; the
> > text section is 4K after I chopped out a bunch of "optimizations" that
> > were in XImage. (It was 7K or so before, as I recall.)
> 
> Extra shared library dependencies are actually pretty costly ... vastly
> more so than extra code in an existing library. (ELF symbol lookups
> involve a linear scan in the list of open libraries, more or less.)
> So, shared libraries with 4k of text are pretty discouraged.

Well, ick.

I desperately want to avoid re-inventing Xlib, where something like 20
notionally distinct APIs all got thrown together into a giant glob. It
isn't obvious to me that there's some other functionality that belongs
together with XCBImage. But it's code that I don't want to see people
reinventing. What else can I do? Ship it as a static library only? I
have this same problem with a bunch of different small APIs I'd like to
provide on top of XCB.

--Jamey



More information about the xcb mailing list