glFinish is busy waiting?

I have a program that calls glFinish after every glXSwapBuffers. It uses 100% CPU when it is running at the maximum frame rate possible (60hz, because I have vsync).

perf shows it spend majority of its time calling sched_yield, and that call seems to originate from glFinish.

So, is glFinish busy waiting? Is there an alternative that doesn’t?

I think you can use environment variable to work around your issue.
See “OpenGL yield behavior” section at the following url for details:

That environment variable only change how nvidia yield, it doesn’t change the fact that nvidia driver is doing busy wait.

I also tried glClientWaitSync, and it busy waits too.

I’m disappointed.

This is expected, glXSwapBuffers is put on the pipeline, glFinish forces execution of the pipeline and returns only when it’s done which is when glXSwapBuffers finishes, on vsync. So glFinish has to wait.

Yes, of course it has to wait. The problem is the busy waiting, which takes excessive amount of CPU, when it could just block.

This significantly reduced the usefulness of glFinish and glClientWaitSync, wish NVIDIA can fix this soon.