<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <font size="-1">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.<br>
      <br>
      The first reading is in a case where performance is somewhat okay.<br>
    </font>
    <pre>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</pre>
    "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.<br>
    <pre>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</pre>
    As it is visible here swap buffers eats suddenly 66ms!<br>
    <br>
    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).<br>
    <br>
    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.<br>
    <br>
    x11-base/xorg-server: 1.8.2<br>
    x11-drivers/ati-drivers: 10.9-r1<br>
    <br>
    <div class="moz-signature">-- <br>
      Mit freundlichen Grüssen<br>
      Plüss Roland<br>
      <br>
      Leader und Head Programmer<br>
      - Game: Epsylon ( <a class="moz-txt-link-freetext" href="http://www.indiedb.com/games/epsylon">http://www.indiedb.com/games/epsylon</a> ,
      <a class="moz-txt-link-freetext" href="http://epsylon.rptd.ch">http://epsylon.rptd.ch</a> )<br>
      - Game Engine: Drag[en]gine (
      <a class="moz-txt-link-freetext" href="http://www.indiedb.com/engines/dragengine">http://www.indiedb.com/engines/dragengine</a> ,
      <a class="moz-txt-link-freetext" href="http://dragengine.rptd.ch">http://dragengine.rptd.ch</a> )<br>
      - Normal Map Generator: DENormGen (
      <a class="moz-txt-link-freetext" href="http://epsylon.rptd.ch/denormgen.php">http://epsylon.rptd.ch/denormgen.php</a> ) and others<br>
    </div>
  </body>
</html>