Skip to content

vrend/egl: ensure robust export of pre-signaled fence and enable EGL fencing for OpenGL contexts

Ryan Neph requested to merge ryanneph/virglrenderer:egl-fencing into master

First commit ensures that a native sync object exists before attempting export of egl->signaled_fence by explicitly issuing glFlush(), which is a requirement stated by the spec:

After associating the fence command with an EGL native fence sync object,
the next Flush() operation performed by the current client API causes a
new native fence object to be created, and the
EGL_SYNC_NATIVE_FENCE_ANDROID attribute of the EGL native fence object is
set to a file descriptor that refers to the new native fence object.

Export without an explicit glFlush() magically works for modern gallium drivers, since dri2_create_fence_fd() forces a context flush under-the-hood, but shouldn't be relied upon.


Second commit relaxes vrend's requirement on GLES context selection to use EGL-based fencing which I believe is not a restriction enforced in any way by either EGL_ANDROID_native_fence_sync or EGL_KHR_fence_sync. We would like to support a virgl_renderer_export_fence()-like API for both GLES and OpenGL context types when the host has EGL and supports these extensions.

/cc @zzyiwei @gerddie @digetx

Merge request reports