Evas GL: Add support for fence_sync and similar extensions

This should add support for the following EGL extensions:
- EGL_KHR_fence_sync
- EGL_KHR_reusable_sync (eglSignalSyncKHR)
- EGL_KHR_wait_sync (eglWaitSyncKHR)

@feature
This commit is contained in:
Jean-Philippe Andre 2014-09-19 14:53:01 +09:00
parent 6848cf40b6
commit 81bf993c6c
3 changed files with 149 additions and 0 deletions

View File

@ -1838,6 +1838,39 @@ EvasGLImage *img = glapi->evasglCreateImageForContext
EvasGLImage (*evasglCreateImageForContext) (Evas_GL *evas_gl, Evas_GL_Context *ctx, int target, void* buffer, const int* attrib_list) EINA_WARN_UNUSED_RESULT;
/*------- EvasGL / EGL-related functions -------*/
/**
* @name Evas GL Sync object functions
* @since_tizen 2.3
* @{ */
/**
* @anchor evasglCreateSync
* @brief Requires the extension @c EGL_KHR_fence_sync, similar to eglCreateSyncKHR.
*/
EvasGLSync (*evasglCreateSync) (Evas_GL *evas_gl, unsigned int type, const int *attrib_list);
/** @anchor evasglDestroySync
* @brief Requires the extension @c EGL_KHR_fence_sync, similar to eglDestroySyncKHR.
*/
Eina_Bool (*evasglDestroySync) (Evas_GL *evas_gl, EvasGLSync sync);
/** @anchor evasglClientWaitSync
* @brief Requires the extension @c EGL_KHR_fence_sync, similar to eglClientWaitSyncKHR.
*/
int (*evasglClientWaitSync) (Evas_GL *evas_gl, EvasGLSync sync, int flags, EvasGLTime timeout);
/** @anchor evasglSignalSync
* @brief Requires the extension @c EGL_KHR_reusable_sync, similar to eglSignalSyncKHR.
*/
Eina_Bool (*evasglSignalSync) (Evas_GL *evas_gl, EvasGLSync sync, unsigned mode);
/** @anchor evasglGetSyncAttrib
* @brief Requires the extension @c EGL_KHR_fence_sync, similar to eglGetSyncAttribKHR.
*/
Eina_Bool (*evasglGetSyncAttrib) (Evas_GL *evas_gl, EvasGLSync sync, int attribute, int *value);
/** @anchor evasglWaitSync
* @brief Requires the extension @c EGL_KHR_wait_sync, similar to eglWaitSyncKHR.
*/
int (*evasglWaitSync) (Evas_GL *evas_gl, EvasGLSync sync, int flags);
/** @} */
/* future calls will be added down here for expansion */
};

View File

@ -179,6 +179,60 @@ evgl_glEvasGLImageTargetRenderbufferStorage(GLenum target, EvasGLImage image)
EXT_FUNC(glEGLImageTargetRenderbufferStorageOES)(target, image);
}
static EvasGLSync
evgl_evasglCreateSync(Evas_GL *evas_gl EINA_UNUSED,
unsigned int type, const int *attrib_list)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return NULL;
return EXT_FUNC(eglCreateSyncKHR)(dpy, type, attrib_list);
}
static Eina_Bool
evgl_evasglDestroySync(Evas_GL *evas_gl EINA_UNUSED, EvasGLSync sync)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return EINA_FALSE;
return EXT_FUNC(eglDestroySyncKHR)(dpy, sync);
}
static int
evgl_evasglClientWaitSync(Evas_GL *evas_gl EINA_UNUSED,
EvasGLSync sync, int flags, EvasGLTime timeout)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return EINA_FALSE;
return EXT_FUNC(eglClientWaitSyncKHR)(dpy, sync, flags, timeout);
}
static Eina_Bool
evgl_evasglSignalSync(Evas_GL *evas_gl EINA_UNUSED,
EvasGLSync sync, unsigned mode)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return EINA_FALSE;
return EXT_FUNC(eglSignalSyncKHR)(dpy, sync, mode);
}
static Eina_Bool
evgl_evasglGetSyncAttrib(Evas_GL *evas_gl EINA_UNUSED,
EvasGLSync sync, int attribute, int *value)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return EINA_FALSE;
return EXT_FUNC(eglGetSyncAttribKHR)(dpy, sync, attribute, value);
}
static int
evgl_evasglWaitSync(Evas_GL *evas_gl EINA_UNUSED,
EvasGLSync sync, int flags)
{
EGLDisplay dpy = EGLDISPLAY_GET();
if (!dpy) return EINA_FALSE;
return EXT_FUNC(eglWaitSyncKHR)(dpy, sync, flags);
}
#else
#endif

View File

@ -565,6 +565,67 @@ _EVASGL_EXT_BEGIN(EGL_KHR_gl_renderbuffer_image)
#endif
_EVASGL_EXT_END()
_EVASGL_EXT_BEGIN(EGL_KHR_fence_sync)
_EVASGL_EXT_DRVNAME(EGL_KHR_fence_sync)
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(void *, eglCreateSyncKHR, (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglCreateSyncKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglDestroySyncKHR, (EGLDisplay dpy, EGLSyncKHR sync))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglDestroySyncKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLint, eglClientWaitSyncKHR, (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglClientWaitSyncKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglGetSyncAttribKHR, (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglGetSyncAttribKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_BEGIN(EvasGLSync, evasglCreateSync, (Evas_GL *evas_gl, unsigned int type, const int *attrib_list))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglCreateSync)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglDestroySync, (Evas_GL *evas_gl, EvasGLSync sync))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglDestroySync)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_FUNCTION_BEGIN(int, evasglClientWaitSync, (Evas_GL *evas_gl, EvasGLSync sync, int flags, EvasGLTime timeout))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglClientWaitSync)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglGetSyncAttrib, (Evas_GL *evas_gl, EvasGLSync sync, int attribute, int *value))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglGetSyncAttrib)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_END()
_EVASGL_EXT_BEGIN(EGL_KHR_reusable_sync)
_EVASGL_EXT_DRVNAME(EGL_KHR_reusable_sync)
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLBoolean, eglSignalSyncKHR, (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglSignalSyncKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_BEGIN(Eina_Bool, evasglSignalSync, (Evas_GL *evas_gl, EvasGLSync sync, unsigned mode))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglSignalSync)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_END()
_EVASGL_EXT_BEGIN(EGL_KHR_wait_sync)
_EVASGL_EXT_DRVNAME(EGL_KHR_wait_sync)
_EVASGL_EXT_FUNCTION_PRIVATE_BEGIN(EGLint, eglWaitSyncKHR, (EGLDisplay dpy, EGLSyncKHR sync, int flags))
_EVASGL_EXT_FUNCTION_DRVFUNC(GETPROCADDR("eglWaitSyncKHR"))
_EVASGL_EXT_FUNCTION_PRIVATE_END()
_EVASGL_EXT_FUNCTION_BEGIN(int, evasglWaitSync, (Evas_GL *evas_gl, EvasGLSync sync, int flags))
_EVASGL_EXT_FUNCTION_DRVFUNC(evgl_evasglWaitSync)
_EVASGL_EXT_FUNCTION_END()
_EVASGL_EXT_END()
#if 0
_EVASGL_EXT_BEGIN(EGL_SEC_map_image)
_EVASGL_EXT_DRVNAME(EGL_SEC_map_image)
@ -578,6 +639,7 @@ _EVASGL_EXT_BEGIN(EGL_SEC_map_image)
_EVASGL_EXT_END()
#endif
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////