summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-09-25 22:48:00 +0200
committerMarek Olšák <[email protected]>2015-10-03 22:06:08 +0200
commit18123a732b8593bb7add03d1529ace464f46a7ac (patch)
tree0530ddf4fa1efd9d9c066a573dc6daa652ca3a45 /src/egl
parentb78336085bce4d1f36c8d9c72fd3fa41643e3cd1 (diff)
egl/dri2: don't require a context for ClientWaitSync (v2)
The spec doesn't require it. This fixes a crash on Android. v2: don't set any flags if ctx == NULL v3: add the spec note Cc: 10.6 11.0 <[email protected]> Reviewed-by: Albert Freeman <[email protected]> Reviewed-by: Frank Binns <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1740ee3dc47..53f21a8eab1 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -2424,13 +2424,18 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
unsigned wait_flags = 0;
EGLint ret = EGL_CONDITION_SATISFIED_KHR;
- if (flags & EGL_SYNC_FLUSH_COMMANDS_BIT_KHR)
+ /* The EGL_KHR_fence_sync spec states:
+ *
+ * "If no context is current for the bound API,
+ * the EGL_SYNC_FLUSH_COMMANDS_BIT_KHR bit is ignored.
+ */
+ if (dri2_ctx && flags & EGL_SYNC_FLUSH_COMMANDS_BIT_KHR)
wait_flags |= __DRI2_FENCE_FLAG_FLUSH_COMMANDS;
/* the sync object should take a reference while waiting */
dri2_egl_ref_sync(dri2_sync);
- if (dri2_dpy->fence->client_wait_sync(dri2_ctx->dri_context,
+ if (dri2_dpy->fence->client_wait_sync(dri2_ctx ? dri2_ctx->dri_context : NULL,
dri2_sync->fence, wait_flags,
timeout))
dri2_sync->base.SyncStatus = EGL_SIGNALED_KHR;