[Xcb] XCBImage

Jamey Sharp jamey at minilop.net
Mon Feb 28 12:52:47 PST 2005


On Mon, Feb 28, 2005 at 08:01:06PM +0100, Vincent Torri wrote:
> On Mon, 28 Feb 2005, Jamey Sharp wrote:
> > On Fri, Feb 25, 2005 at 11:38:41PM +0100, Vincent Torri wrote:
> > > 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.
> 
> in fact, i was not aware that shmat was not a Xlib function
> so that i could only ask for the returned value of shmat, i think. And
> then, it's easy to implement :) Am i wrong ?

That sounds right to me. But I've never used the SysV-style shared
memory stuff before... :-/

> Of course, the design could be re-written. It's a first attemps. But if it
> works, it would be great.

It'd be nice, as a programmer, to not need to work very hard to use the
higher-performance MIT-SHM stuff. I'd love it if we can provide a simple
interface. I won't be shocked, though, if this is yet another thing that
higher-level libraries (like toolkits) should be responsible for. I was
much more excited about putting convenience functions for MIT-SHM in XCB
when I thought that Xlib was doing something similar. Of course,
providing an external library that makes it easy to port XImage-based
code to XCB is clearly useful.

--Jamey


More information about the xcb mailing list