From 8b0e1a179836ef4b97879831240db704eae057ae Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Mon, 2 May 2011 13:16:28 +0200 Subject: egl_dri2: Implement EGL_MESA_reusable_sync_eventfd --- src/egl/drivers/dri2/egl_dri2.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index f60b17e60f..7beae1cb39 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -474,6 +474,10 @@ dri2_create_screen(_EGLDisplay *disp) disp->Extensions.KHR_reusable_sync = EGL_TRUE; #endif +#if EGL_MESA_reusable_sync_eventfd + disp->Extensions.MESA_reusable_sync_eventfd = EGL_TRUE; +#endif + return EGL_TRUE; cleanup_dri_screen: @@ -1283,6 +1287,23 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *disp, } #endif +#ifdef EGL_MESA_reusable_sync_eventfd + +static EGLint +dri2_create_sync_eventfd(_EGLDriver *drv, _EGLDisplay *disp, _EGLSync *sync) +{ + struct dri2_egl_sync *dri2_sync = dri2_egl_sync(sync); + + if (dri2_sync->base.Type != EGL_SYNC_REUSABLE_KHR) { + _eglError(EGL_BAD_MATCH, "eglCreateSyncEventfdMESA"); + return -1; + } + + return dup(dri2_sync->epoll_fd); +} + +#endif + static void dri2_unload(_EGLDriver *drv) { @@ -1380,6 +1401,10 @@ _EGL_MAIN(const char *args) dri2_drv->base.API.SignalSyncKHR = dri2_signal_sync; #endif +#ifdef EGL_MESA_reusable_sync_eventfd + dri2_drv->base.API.CreateSyncEventfdMESA = dri2_create_sync_eventfd; +#endif + dri2_drv->base.Name = "DRI2"; dri2_drv->base.Unload = dri2_unload; -- cgit v1.2.3