opengl support in wine
tom at dbservice.com
Thu Dec 1 16:49:32 CST 2005
Stefan Dösinger wrote:
> * The fglrx driver: glReadPixels, glWritePixels, glTexImage2D and friends are
> _terribly_ slow with this driver( 1 fps when accessing the back buffer). Just
> follow the Direct3D discussions or search the archives, this problem has been
> discussed before, and it will come up again(At least when my DX7 patches are
> ready). Your glReadPixels approach won't work for radeon cards. I don't know
> a fix / workaround. If you have one, I'd really be glad!
My approach wont work on older cards anyway. I'm using FBOs (which have
been introduced recently) and maybe other features that require the
latest drivers. My approach will also require a dual core or HT-enabled CPU.
My approach is:
create a set (4 or 8) of objects, each holding a reference to a FBO and
a PBO. This set is used for asynchronous readback.
When the application calls glXSwapBuffers(), copy the frontbuffer to the
FBO and issue an asynchronous glReadPixels() to the PBO. Then pass the
object to the second thread and return so the app can continue. This is
to reduce the time spent in glXSwapBuffers(), the FBO is used to create
a consisten snapshot of the frontbuffer. The second thread maps the PBO
(making the glReadPixels() transfer finish), uses the lzo compression
algorithm to compress the pixels and writes the pixels (along with a
timestamp, Window XID, dimensions (width,height) and probably other
infos) to a file. For best performance, the destination file would be
mapped to memory (mmap) and the lzo compression function would write the
compressed data directly to the file.
I see that there are still some unresolved issues (thread
synchronization when accessing PBOs) but that is only a minor issue ;)
One note though, just one week ago I've had a nVidia 6800 on a 8x AGP
bus. And I still could get ~500MB/s readback using glReadPixels(), that
makes ~100 fps. This 1fps glReadPixels() is clearly an ATI issue. That's
also why I would never buy an ATI card, because, honestly, they suck
(I've had one, and it sucked badly, their drivers crashed the whole
computer hardly when I've tried to play World of Warcraft).
More information about the wine-devel