diff options
author | Robert Bragg <robert@linux.intel.com> | 2010-06-16 12:42:22 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-01-16 13:45:27 +0000 |
commit | b851bf8b356a0d1252bddaccbfd30c392352be4c (patch) | |
tree | 43781e184a0fdddb5af78feb76cff748502f0096 | |
parent | 4e4e4c8ba1e7569b0a9ab0ae9b73ef0e18c5357f (diff) |
egl: Adds EGL_INTEL_native_event_objects support
The EGL_INTEL_native_event_objects extension provides a mechanism for
EGL to process events based on the operating system's native event
delivery mechanism.
The extension itself doesn't actually define any events so on its own
it's somewhat benign but it provides a basis to define further extensions
that handle specific events.
Examples of events we'd hope to see become available once this extension
is in place are: Swap buffers complete events to notify when an
asynchronous eglSwapBuffers request has completed and sync object
events to notify when a sync object becomes signaled.
-rw-r--r-- | include/EGL/eglext.h | 12 | ||||
-rw-r--r-- | include/EGL/eglplatform.h | 12 | ||||
-rw-r--r-- | src/egl/main/eglapi.c | 48 | ||||
-rw-r--r-- | src/egl/main/eglapi.h | 12 |
4 files changed, 84 insertions, 0 deletions
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index a7ea2ea2fd..a40165e689 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -328,6 +328,18 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); #endif #endif +#ifndef EGL_INTEL_native_event_objects +#define EGL_INTEL_native_event_objects 1 +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPrepareEventsWaitINTEL(EGLDisplay dpy, EGLNativeEventObjectTypeINTEL *objects, EGLint object_size, EGLint *num_object, EGLint *timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglDispatchEventsINTEL(EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglForwardEventINTEL(EGLDisplay dpy, EGLNativeEventTypeINTEL event); +#endif +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPREPAREEVENTSWAITINTELPROC) (EGLDisplay dpy, EGLNativeEventObjectTypeINTEL *objects, EGLint object_size, EGLint *num_object, EGLint *timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDISPATCHEVENTSINTELPROC) (EGLDisplay dpy); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFORWARDEVENTINTELPROC) (EGLDisplay dpy, EGLNativeEventTypeINTEL event); +#endif /* EGL_INTEL_native_event_objects */ + #include <EGL/eglmesaext.h> #ifdef __cplusplus diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h index 17fdc61146..82096bd9e0 100644 --- a/include/EGL/eglplatform.h +++ b/include/EGL/eglplatform.h @@ -76,24 +76,32 @@ typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; +typedef HANDLE EGLNativeEventObjectTypeINTEL; +typedef void *EGLNativeEventTypeINTEL; #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ typedef int EGLNativeDisplayType; typedef void *EGLNativeWindowType; typedef void *EGLNativePixmapType; +typedef int EGLNativeEventObjectTypeINTEL; +typedef void *EGLNativeEventTypeINTEL; #elif defined(WL_EGL_PLATFORM) typedef struct wl_display *EGLNativeDisplayType; typedef struct wl_egl_pixmap *EGLNativePixmapType; typedef struct wl_egl_window *EGLNativeWindowType; +typedef int EGLNativeEventObjectTypeINTEL; +typedef void *EGLNativeEventTypeINTEL; #elif defined(__GBM__) typedef struct gbm_device *EGLNativeDisplayType; typedef struct gbm_bo *EGLNativePixmapType; typedef void *EGLNativeWindowType; +typedef int EGLNativeEventObjectTypeINTEL; +typedef void *EGLNativeEventTypeINTEL; #elif defined(ANDROID) /* Android */ @@ -111,6 +119,7 @@ typedef void *EGLNativeDisplayType; typedef void *EGLNativeDisplayType; typedef khronos_uint32_t EGLNativePixmapType; typedef khronos_uint32_t EGLNativeWindowType; +typedef void *EGLNativeEventTypeINTEL; #else @@ -121,9 +130,12 @@ typedef khronos_uint32_t EGLNativeWindowType; typedef Display *EGLNativeDisplayType; typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; +typedef XEvent *EGLNativeEventTypeINTEL; #endif /* MESA_EGL_NO_X11_HEADERS */ +typedef int EGLNativeEventObjectTypeINTEL; + #else #error "Platform not recognized" #endif diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index b27aac1674..082a5570c9 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -366,6 +366,54 @@ eglQueryString(EGLDisplay dpy, EGLint name) EGLBoolean EGLAPIENTRY +eglPrepareEventsWaitINTEL(EGLDisplay dpy, + EGLNativeEventObjectTypeINTEL *objects, + EGLint object_size, + EGLint *num_object, + EGLint *timeout) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + ret = drv->API.PrepareEventsWaitINTEL(drv, disp, objects, object_size, + num_object, timeout); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY +eglDispatchEventsINTEL(EGLDisplay dpy) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + ret = drv->API.DispatchEventsINTEL(drv, disp); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY +eglForwardEventINTEL(EGLDisplay dpy, + EGLNativeEventTypeINTEL event) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLDriver *drv; + EGLBoolean ret; + + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + ret = drv->API.ForwardEventINTEL(drv, disp, event); + + RETURN_EGL_EVAL(disp, ret); +} + + +EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) { diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index 14085cb4d8..056da7bad8 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -127,6 +127,12 @@ typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *dis typedef EGLBoolean (*PostSubBufferNV_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, EGLint x, EGLint y, EGLint width, EGLint height); +#ifdef EGL_INTEL_native_event_objects +typedef EGLBoolean (*PrepareEventsWaitINTEL_t) (_EGLDriver *drv, _EGLDisplay *dpy, EGLNativeEventObjectTypeINTEL *objects, EGLint object_size, EGLint *num_object, EGLint *timeout); +typedef EGLBoolean (*DispatchEventsINTEL_t) (_EGLDriver *drv, _EGLDisplay *dpy); +typedef EGLBoolean (*ForwardEventINTEL_t) (_EGLDriver *drv, _EGLDisplay *dpy, EGLNativeEventTypeINTEL event); +#endif /* EGL_INTEL_native_event_objects */ + /** * The API dispatcher jumps through these functions */ @@ -201,6 +207,12 @@ struct _egl_api UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL; #endif +#ifdef EGL_INTEL_native_event_objects + PrepareEventsWaitINTEL_t PrepareEventsWaitINTEL; + DispatchEventsINTEL_t DispatchEventsINTEL; + ForwardEventINTEL_t ForwardEventINTEL; +#endif /* EGL_INTEL_native_event_objects */ + PostSubBufferNV_t PostSubBufferNV; }; |