glXSwapBuffers very slow, potential problems?

Roland Plüss roland at rptd.ch
Tue Oct 5 08:05:47 PDT 2010


 I'm running here into a heavy performance problem on both ATI and
nVidia cards and the culprit is the glXSwapBuffers call. I've got here
two performance readings showing the problem.

The first reading is in a case where performance is somewhat okay.

II [OpenGL] OpenGL Timer: BeginFrame: Run Optimizers = 3ys
II [OpenGL] OpenGL Timer: BeginFrame: Make Current = 57ys
II [OpenGL] OpenGL Timer: BeginFrame: Activate primary GC = 7ys
II [OpenGL] OpenGL Timer: EndFrame: Entering = 2312ys
II [OpenGL] OpenGL Timer: EndFrame: Activate primary GC = 28ys
II [OpenGL] OpenGL Timer: EndFrame: Flush = 27ys
II [OpenGL] OpenGL Timer: EndFrame: Swap Buffers = 4238ys
II [OpenGL] OpenGL Timer-Total End Frame = 6694ys

"EndFrame: Entering" is the time for all rendering for the window (hence
the time between leaving BeginFrame and entering EndFrame calls). The
flush there is only to make sure it is a problem with glXSwapBuffers.
4ms for a swap I would consider a bit high if the rendering itself is
done in <3ms but maybe this is normal, I don't know. But when I
show/hide the window to switch to another window rendering the same 3D
scene (for testing purpose) and switching back (always only one of the
two windows visible, aka mapped to the screen) performance breaks down
horribly.

II [OpenGL] OpenGL Timer: BeginFrame: Run Optimizers = 4ys
II [OpenGL] OpenGL Timer: BeginFrame: Make Current = 59ys
II [OpenGL] OpenGL Timer: BeginFrame: Activate primary GC = 14ys
II [OpenGL] OpenGL Timer: EndFrame: Entering = 2560ys
II [OpenGL] OpenGL Timer: EndFrame: Activate primary GC = 37ys
II [OpenGL] OpenGL Timer: EndFrame: Flush = 45ys
II [OpenGL] OpenGL Timer: EndFrame: Swap Buffers = 66642ys
II [OpenGL] OpenGL Timer-Total End Frame = 69401ys

As it is visible here swap buffers eats suddenly 66ms!

This is on the ATI system. On the nVidia system there is no difference
between the two situations but swap buffer always consumes 48ms. Any
ideas what can cause glXSwapBuffer to horribly slow down like this? The
DE is KDE4 with compositing present but disabled (so it should not have
any influence).

I read somewhere that somebody tried placing glXSwapBuffers in a
separate thread. Would this not cause troubles with the X-server?
(meaning, is X thread safe?). But even if this would work 68ms for a
swap is brutal.

x11-base/xorg-server: 1.8.2
x11-drivers/ati-drivers: 10.9-r1

-- 
Mit freundlichen Grüssen
Plüss Roland

Leader und Head Programmer
- Game: Epsylon ( http://www.indiedb.com/games/epsylon ,
http://epsylon.rptd.ch )
- Game Engine: Drag[en]gine ( http://www.indiedb.com/engines/dragengine
, http://dragengine.rptd.ch )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php
) and others
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20101005/8f1a0bd8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg/attachments/20101005/8f1a0bd8/attachment.pgp>


More information about the xorg mailing list