summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-04-10 13:16:30 +0200
committerMarek Olšák <[email protected]>2015-04-30 14:38:38 +0200
commit290a3eb7507f7f2949753a77c425ed2bb6fd0dd1 (patch)
tree3fba0561b8e7fd13910930c0ac326a8bb63d3bea /src/egl/drivers/dri2/egl_dri2.c
parenta8617cc0428dcc8340cb85776e122c6534a0fa11 (diff)
egl/dri2: implement EGL_KHR_cl_event2 (v2)
v2: fix the SYNC_CONDITION query
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index e096a7df282..34d6bfeefac 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -531,6 +531,8 @@ dri2_setup_screen(_EGLDisplay *disp)
if (dri2_dpy->fence) {
disp->Extensions.KHR_fence_sync = EGL_TRUE;
disp->Extensions.KHR_wait_sync = EGL_TRUE;
+ if (dri2_dpy->fence->get_fence_from_cl_event)
+ disp->Extensions.KHR_cl_event2 = EGL_TRUE;
}
if (dri2_dpy->image) {
@@ -2207,7 +2209,8 @@ dri2_egl_unref_sync(struct dri2_egl_display *dri2_dpy,
static _EGLSync *
dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
- EGLenum type, const EGLint *attrib_list)
+ EGLenum type, const EGLint *attrib_list,
+ const EGLAttribKHR *attrib_list64)
{
_EGLContext *ctx = _eglGetCurrentContext();
struct dri2_egl_display *dri2_dpy = dri2_egl_display(dpy);
@@ -2220,7 +2223,8 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
return NULL;
}
- if (!_eglInitSync(&dri2_sync->base, dpy, type, attrib_list)) {
+ if (!_eglInitSync(&dri2_sync->base, dpy, type, attrib_list,
+ attrib_list64)) {
free(dri2_sync);
return NULL;
}
@@ -2229,6 +2233,23 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
case EGL_SYNC_FENCE_KHR:
dri2_sync->fence = dri2_dpy->fence->create_fence(dri2_ctx->dri_context);
break;
+
+ case EGL_SYNC_CL_EVENT_KHR:
+ dri2_sync->fence = dri2_dpy->fence->get_fence_from_cl_event(
+ dri2_dpy->dri_screen,
+ dri2_sync->base.CLEvent);
+ /* this can only happen if the cl_event passed in is invalid. */
+ if (!dri2_sync->fence) {
+ _eglError(EGL_BAD_ATTRIBUTE, "eglCreateSyncKHR");
+ free(dri2_sync);
+ return NULL;
+ }
+
+ /* the initial status must be "signaled" if the cl_event is signaled */
+ if (dri2_dpy->fence->client_wait_sync(dri2_ctx->dri_context,
+ dri2_sync->fence, 0, 0))
+ dri2_sync->base.SyncStatus = EGL_SIGNALED_KHR;
+ break;
}
p_atomic_set(&dri2_sync->refcount, 1);