Hi Mark,

I wrote a benchmark, and got similar results as you
did.  When the machine is unloaded even my longest
read is under the 13ms barrier, and the avg read is
about 10ms, for an aggregate rate around 140MB/s. 
This number roughly equivalent to the DMA performance
I get going to out of the machine via the 64bit PCI
slot.

When the machine is loaded with another program
displaying in a GL buffer (the one I need to capture),
the average read is about 14ms, with the longest read
taking around 28ms.

Hmmm.  It looks like I may be stuck.  I'll try
grabbing the server to see if I can come up with
anything different.

Thanks for your suggestions,
David


--- Mark Vojkovich <[EMAIL PROTECTED]> wrote:
> On Fri, 4 Apr 2003, David N. wrote:
> 
> > Billy,
> > 
> > Thanks -- that works and solves one of my
> problems.
> > 
> > The other part of my problem is that I'm trying to
> > grab complete images off of the screen using
> > XShmGetImage().  Despite synchronizing on with
> > vertical refresh like you suggested, I'm finding
> that
> > the buffers that I capture with XShmGetImage()
> have
> > tearing in them - i.e. it looks like the next
> frame is
> > getting drawn into X's buffer before XShmGetImage
> is
> > done retrieving them.
> 
>    OpenGL and X rendering are allowed to be
> completely asynchronous,
> and in the case of NVIDIA's binary drivers, they
> are.  If the
> same app is doing the grabbing and OpenGL rendering
> you should
> either use OpenGL for everything (glReadPixels
> instead of XShmGetImage)
> or if you use XShmGetImage you have to use GLX's
> synchronization
> primitives: glXWaitGL and glXWaitX.  Call glXWaitGL
> before 
> XShmGetImage to ensure that all GL rendering has
> finished. 
> 
>    If the grabber and GL renderer are separate
> applications,
> there's not much you can do.  You can grab the
> server before
> doing the XShmGetImage to ensure that nobody is
> going to be
> rendering while you are doing the XShmGetImage, but
> that isn't
> going to give you OpenGL flip synchronization on the
> GetImage. 
> 
> 
> > 
> > In these cases I notice that XShmGetImage is
> taking
> > longer than 13.3ms to complete.  Do you have any
> ideas
> > on a quicker way to get a copy of X's output
> buffer?
> 
>    It only takes that long because it's sharing the
> hardware
> with the simultanous OpenGL rendering.  The above
> two mechanisms
> will serialize X and GL rendering.
> 
> 
>                       Mark.
> 
> > 
> > Kind regards,
> > David
> > 
> > > 
> > > 
> > >   This is currently video card specific.  With
> > > nVidia cards and the
> > > binary drivers, you can use poll() on
> > > /dev/nvidia[0-x] to have your
> > > process block until the next refresh.  With mga,
> > > radeon, r128, i830,
> > > (what else?) drivers, using the new DRM for
> X4.3,
> > > there is a DRM ioctl
> > > you can use to get information about the refresh
> > > rate.  Look for
> > > drmWaitVBlank and associated code in libGL for
> how
> > > to use the ioctl.
> > > 
> > >   Other then that, there are a bunch of
> > > card-specific codes around
> > > providing refresh interrupts as kernel modules. 
> In
> > > new versions of
> > > svgalib, they include a kernel module to provide
> > > this functionality
> > > through their API, although it's unclear if it
> is
> > > 'safe' for use along
> > > with X.  As well, the mplayer program includes
> some
> > > kernel module
> > > drivers for overlay surfaces which includes some
> > > refresh sync code, but
> > > it's not really used by them currently to my
> > > knowledge.
> > > 
> > >   I'm working on some sort of library to
> abstract
> > > the nvidia binary
> > > drivers and the new DRM method, and maybe other
> > > methods if they are
> > > clean.  If anyone else is interested in helping
> out
> > > with this, let me
> > > know.
> > > 
> > >   Hope that helps,
> > >   -Billy
> > > 
> > > -- 
> > > Billy Biggs
> > > [EMAIL PROTECTED]
> > > _______________________________________________
> > > XFree86 mailing list
> > > [EMAIL PROTECTED]
> > > http://XFree86.Org/mailman/listinfo/xfree86
> > 
> > 
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - File online, calculators,
> forms, and more
> > http://tax.yahoo.com
> > _______________________________________________
> > XFree86 mailing list
> > [EMAIL PROTECTED]
> > http://XFree86.Org/mailman/listinfo/xfree86
> > 
> 
> _______________________________________________
> XFree86 mailing list
> [EMAIL PROTECTED]
> http://XFree86.Org/mailman/listinfo/xfree86


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com
_______________________________________________
XFree86 mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xfree86

Reply via email to