1

I examine a Compiz performance when it draws desktops using expo plugin. VSync in Compiz and nvidia-settings is enabled. I measure a time this way:

paint()
{   
   //get time
   //all opengl commands
   glFlush();
   glFinish();
   //get time
   //calculate paint time

   //get time
   glXSwapBuffers (mDpy, mOutput);
   glFlush();
   glFinish();
   //get time
   //calculate sync/swap time
}

When paint commands take 8 ms, sync/swap time is equal about 7 ms because using glFinish after glXSwapBuffers should blocks when vsync is on. When I run more opengl windows in the expo mode then paint commands take 18 ms and sync/swap time is about 13 ms. How to explain that ? Why glXSwapBuffers is so slow ?

Also when I turn off vsync in nvidia-settings and Compiz and generate drawing commands which take 28 ms then sync/swap time is about 14 ms.

Irbis
  • 11,537
  • 6
  • 39
  • 68

1 Answers1

1

Well, you probably drive your display with 60Hz, so waiting for vblank can take up to 16.67ms.

The render time and the wait time at the swap buffers should always add up to a multiple of the frame time of 16.67 ms (assuming that drawing begins right after the previous buffer swap). Both 8+7=15 as well as 18+13=31 are close enough for that. When your drawing takes 18ms, you of course will miss one vblank interval and have to wait for the next.

What is going on in your "vsync off" case, I don't know. The swap buffer call itself should not take a significant amount of time in that case.

derhass
  • 43,833
  • 2
  • 57
  • 78
  • Compositing window manager creates GL textures from offscreen pixmaps, so maybe those offscreen pixmaps create a back buffer ? – Irbis Apr 22 '15 at 07:47