# CPU never waits inside eglSwapBuffers

**URL:** <https://forums.imgtec.com/t/cpu-never-waits-inside-eglswapbuffers/1228>\
**Category:** PowerVR Insider\
**Created:** [November 1, 2011, 9:29pm UTC](https://forums.imgtec.com/t/cpu-never-waits-inside-eglswapbuffers/1228 "2011-11-01T21:29:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andoma](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.imgtec.com/andoma/32/124_2.png) [@andoma](https://forums.imgtec.com/u/andoma)\
**Post date:** [November 1, 2011, 9:29pm UTC](https://forums.imgtec.com/t/cpu-never-waits-inside-eglswapbuffers/1228/1 "2011-11-01T21:29:40Z")

</div>

Hi  
  
  
  
  
  
I’m using an omap4 device (pandaboard) running OpenGL ES 2.0 directly on the framebuffer using libpvrPVR2D\_FLIPWSEGL.so.  
  
  
  
  
  
My rendering code looks something like this:  
  
  
  
  
  
while(1) {  
  
  
  
  
  
 glClear(GL\_COLOR\_BUFFER\_BIT);  
  
  
  
  
  
 mutex\_lock(&sceneMutex);  
  
  
 render\_the\_scene()  
  
  
 mutex\_unlock(&sceneMutex);  
  
  
  
  
  
 eglSwapBuffers(display, window);  
  
  
}  
  
  
  
  
  
After instrumenting the code I realize that the eglSwapBuffers() usually takes ~30Âµs and the wait that makes the app redraw the scene at the actual display framerate happens during rendering inside glDrawArrays(). The CPU load is ~1% according to ‘top’ so it’s not that it has too much work to do but rather waiting (for the GPU I guess).  
  
  
  
  
  
This is unfortunate as inside render\_the\_scene() the sceneMutex is held and all other threads in my app are not able to do any updates to the scene.  
  
  
  
  
  
I’m a bit puzzled as this is different from all other OpenGL implementations my application is running on. Is this how it’s supposed to work or am I doing something wrong here?  
  
  
  
  
  
Any ideas or hints are welcome.  
  
  
  
  
  
This is using SDK\_4\_04\_00\_03 (as downloaded from TI)
