Imagination PowerVR SDK Blog

CPU never waits inside eglSwapBuffers


#1

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)