On Mon, 22 Oct 2001, trasatti wrote:
> > > I work under X11R6 server with XFree86 4.1.0, using XLib and XToolkit graphic
>libraries.
> > > My program must capture-process-display every frame captured from a video
>source, at the maximum frame rate.
> > > All done without palette transformations.
>
> Thank's to everyone answer my previous post.
> As you know, I'm trying to make a videoprocessor under X11/Xfree86.
>
>
> I've a BTTV driven frame grabber card
> -1- It is programmed to capture frames in RGB565 format (like the display) on a mmap
>shared buffer
> -2- Via a memcpy, the captured frame is copied into a XImage created with
>XShmCreateImage
> -3- Then the sw process this rgb image
> -4- Finally the image is displayed in a window via XShmPutImage
> -5- XSync(display, False)
>
>
> How to speed up these tasks?
> Or decrease CPU load?
>
> task 1 was done by PCI dma, so it was the faster way.
> task 2 may be faster with a DMA accelerated copy instead of memcpy... but how?
I don't know how to do this, but if you could have the BTTV copy to
a real shared memory buffer (as in shmat) you could use that as the
XImage data and skip step 2. I think that would involve making a
shared memory segment out of the memory the kernel locked down for
the BTTV copy. Not sure if that's possible.
> task 3 is a user algorithm, so I must use ASM and MMX instrucions...maybe! :-)
MMX and SSE can help you.
> task 4 XShmPutImage is DMA accelerated, right? so it is the fastest way?
As far as I can tell, only NVIDIA's binary drivers use DMA to accelerate
X(Shm)PutImage. And I probably have more optimizations that I could
do there. I'm not using MMX or SSE.
> task 5 ...what's doing exactly the XSync? Is possible to synchronize with monitor
>VSynch.
>
XSync stalls your application until the X-server has processed all
commands sent before it. It would ensure that the server was through
with the XImage data, for instance. Alternatively you could have
waited for the ShmCompletionEvent that can be sent as an option
to XShmPutImage.
> ---
>
> Another way may be, if is possible, to map directly XImage data memory over the mmap
>captured frame, avoiding the memcpy in task 2.
> Anyone knows how to do it?
Beats me. Maybe requires a kernel modification.
>
> Otherwise, how to blit the captured mmap buffer (after processing it) onto the
>display, even without any XImage or with other functions than XShmPutImage.
>
OpenGL provides an alternative method with glDrawPixels. But
I don't expect that to be much (if at all) faster than XShmPutImage.
I would guess that it's probably slower on most implmentations.
Mark.
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert