I'm trying to use the EGL_KHR_fence_sync extension to monitor when GL has finished rendering, by inserting a fence into the command stream after all rendering commands, and before the buffer is used as a dispmanx element. It looks like this extension doesn't work correctly - instead of signalling when all prior commands are complete, it signals as soon as the fence is dispatched. This causes dispmanx to start reading from the GL buffer before it has finished rendering, causing tearing towards the top of the screen (as the GL hardware seems to render bottom-to-top). eglClientWaitSyncKHR will return EGL_CONDITION_SATISFIED_KHR, but eglGetSyncAttribKHR(EGL_SYNC_STATUS_KHR) always returns EGL_UNSIGNALED_KHR (there is no code in userland to set the sync status).
Am I correct in surmising that this extension is broken? Is there another way to ensure that GL is no longer working on a buffer (other than glFinish/eglWaitClient, which flushes the pipeline)? EGL_KHR_resuable_sync is not implemented by userland, nor are GLES3 sync objects.