[Xcb] XCBImage

Jamey Sharp jamey at minilop.net
Mon Feb 28 09:49:15 PST 2005


On Fri, Feb 25, 2005 at 11:38:41PM +0100, Vincent Torri wrote:
> Hello,

Hi Vincent!

> i've added some stuff about shared memory:
> 
> xcb_shm_image_create
> xcb_shm_image_destroy
> xcb_shm_image_put
> xcb_shm_image_get

Cool.

> but i miss the offset that i have to pass to XCBShmPutImage and
> XCBShmGetImage. In the Xlib stuff, it's computed thanks to the
> address in client (shmaddr member of a XShmSegmentInfo). I've not found
> it. Does someone has an idea about how to get this address ?

As far as I can tell, under Xlib the application was expected to
allocate a sufficiently large shared memory segment with shmget(2), and
store the returned shmid in the XShmSegmentInfo. Then it could ask the
server to shmat(2) using XShmAttach, and finally XShmPutImage. The
reason for the offset, if I'm not mistaken, is that multiple images
could be stored in the same segment. If you know the base address of the
segment, you can compute the offset the way Xlib does.

I could have sworn Xlib would automatically do this for XPutImage calls
if SHM was supported, but I can't find any evidence of that now. Looks
like I was thinking of Xlib's Font.c, which can sometimes use shared
memory for querying fonts.

You did find Xext/XShm.c and XExtensions/XShm.h in fd.o CVS, right? I
assume that's what you based your implementation on...

--Jamey


More information about the xcb mailing list