[Xcb] XCBImage

Vincent Torri Vincent.Torri at iecn.u-nancy.fr
Sat Mar 5 02:33:47 PST 2005

On Sat, 5 Mar 2005, Jamey Sharp wrote:

> On Fri, Mar 04, 2005 at 02:23:53PM -0800, Barton C Massey wrote:
> > Just talking off the top of my head here, but it seems to me
> > that the XShmSegmentInfo.{shmseg,shmaddr} might normally be
> > reused with different images.
> Absolutely. But for a given image, the shmseg and its associated
> client-side shmaddr are fixed, AFAICT. I can't see how one could switch
> shared memory segments without also changing the client-side address of
> the image data, let alone why one would want to.
> I suppose the client could call XCBShmDetach, allocate a new XCBShmSEG
> XID, then call XCBShmAttach with it, without changing the shmaddr or the
> image data buffer. But that's just silly...
> If the XCBImage bits could efficiently look up the XCBShmSEG using the
> base address of the segment, then only the base address need be stored.
> If it could use any address contained within the segment, then no extra
> data is necessary -- in fact, any XCBImage could be automatically sent
> using MIT-SHM by simply looking up whether it was already in shared
> memory.
> Perhaps we could usefully provide an allocator for shared memory, in
> order to track the above information and to allow users to efficiently
> manage shared memory as easily as with malloc and free.
> > Build it however to start with, and
> > we'll write/port some code to use it and see how it goes.
> Yup, sounds like a good plan to me.
> On Sat, Mar 05, 2005 at 08:10:57AM +0100, Vincent Torri wrote:
> > I think that i'll leave the xcbimage like it is right now, create a
> > XCBShminfo struct that contains shmseg, shmid and shmaddr.
> It's up to you, naturally. But nothing needs the shmid once the attach
> is done, right?

i am not a master of xlib, nor of xcb. My aim is first to make something
that works. After that, if there is things that have to be modified, and
the design is one of them, no problem. I don't want to fix it.

for the shmid, i use it in shmctl, after the attach. That's all. Look at
the shm test prog (see below).

I have put the code with shm stuff there :


i have separate the test code to the lib
there are 2 shell scripts to build each test program (standard and shm

The standard test is the reflection of the window. It works only in
ZPixmap format.

the shm one is small and just put a white pixel in the middle of a black
window. I think it's enough to make more sophisticated code.



More information about the xcb mailing list