Bug 855178. Use WaitSync instead of ClientWaitSync in SharedSurfaceGL. r=jgilbert

This is better than waiting/spinning. WaitSync will make the GPU do the
waiting for us and we can continue on.

Banana bench before:
gameplay: 98.554 total seconds
gameplay: 70.097 JS seconds

after:
gameplay: 77.188 total seconds
gameplay: 70.33 JS seconds

--HG--
extra : rebase_source : 6eca32668d828a9f312500cfb900c53b107357a1
This commit is contained in:
Jeff Muizelaar 2013-03-26 22:29:07 -07:00
parent 69dbfea188
commit 6f4a25af41

View File

@ -365,22 +365,14 @@ SharedSurface_GLTexture::WaitSync()
// We must have used glFinish instead of glFenceSync.
return true;
}
MOZ_ASSERT(mGL->IsExtensionSupported(GLContext::ARB_sync));
mConsGL->MakeCurrent();
MOZ_ASSERT(mConsGL->IsExtensionSupported(GLContext::ARB_sync));
GLuint64 waitMS = 500;
const GLuint64 nsPerMS = 1000 * 1000;
GLuint64 waitNS = waitMS * nsPerMS;
GLenum status = mGL->fClientWaitSync(mSync,
0,
waitNS);
mConsGL->fWaitSync(mSync,
0,
LOCAL_GL_TIMEOUT_IGNORED);
if (status != LOCAL_GL_CONDITION_SATISFIED &&
status != LOCAL_GL_ALREADY_SIGNALED)
{
return false;
}
mGL->fDeleteSync(mSync);
mConsGL->fDeleteSync(mSync);
mSync = 0;
return true;