Based on my reading of the MIT-SHM documentation, I believe you might
be able to do the following:
1. mmap your input buffer to any address you want.
2. call shmget() to obtain a shmid for the shared segment:
shmid = shmget(IPC_PRIVATE, imageSize,
IPC_CREAT | 0777);
3. Attach the shm segment to the mmap'd buffer by calling:
shmaddr = shmat(shmid, buffer, 0);
If the returned shmaddr != buffer, then the system wasn't able to
attach the shared segment at the right address. You'll have to fall
back to memcpy() in this case (after remembering to unmap/unattach the
segment if necessary).
4. If shmaddr == buffer, you are ready to create the ShmImage:
image = XShmCreateImage(display, visual, depth, format, NULL,
shminfo, width, height);
shminfo.shmid = shmid;
shminfo.shmaddr = image->data = shmaddr;
XShmAttach(display, shminfo);
I *think* that's right...
Scott
On Thu, 5 Sep 2002 18:32:34 +1000 (EST)
Brian W Grasby <[EMAIL PROTECTED]> wrote:
>Hello all,
>
>I'm writing a program that captures images from a bttv video capture
>card
>and processes them then outputs to the screen and i need real-time
>performance. Currently I'm using XImages to display on screen but i
>want
>to use MIT-SHM extension and XShmPutImage. My problem is that the
>data is
>coming from mmap()'ed buffers and i don't know how to get it into the
>XImage without doing memcopy. Currently I use
>
>XImage->data = &buffer[i];
>XPutImage(...
>
>Can i do this with SHM or can i mmap the same segment as i use for a
>SHM
>XImage? Or is it faster with memcopy?
>
>THanks
>Brian
>
>_______________________________________________
>Xpert mailing list
>[EMAIL PROTECTED]
>http://XFree86.Org/mailman/listinfo/xpert
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert