static EGLSync
-_eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLint *attrib_list,
- const EGLAttrib *attrib_list64, EGLBoolean is64,
+_eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLAttrib *attrib_list,
+ EGLBoolean orig_is_EGLAttrib,
EGLenum invalid_type_error)
{
_EGLContext *ctx = _eglGetCurrentContext();
_EGL_CHECK_DISPLAY(disp, EGL_NO_SYNC_KHR, drv);
- if (!disp->Extensions.KHR_cl_event2 && is64) {
+ if (!disp->Extensions.KHR_cl_event2 && orig_is_EGLAttrib) {
/* There exist two EGLAttrib variants of eglCreateSync*:
* eglCreateSync64KHR which requires EGL_KHR_cl_event2, and eglCreateSync
* which requires EGL 1.5. Here we use the presence of EGL_KHR_cl_event2
RETURN_EGL_ERROR(disp, invalid_type_error, EGL_NO_SYNC_KHR);
}
- sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list, attrib_list64);
+ sync = drv->API.CreateSyncKHR(drv, disp, type, attrib_list);
ret = (sync) ? _eglLinkSync(sync) : EGL_NO_SYNC_KHR;
RETURN_EGL_EVAL(disp, ret);
static EGLSync EGLAPIENTRY
-eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
+eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *int_list)
{
_EGLDisplay *disp = _eglLockDisplay(dpy);
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
- return _eglCreateSync(disp, type, attrib_list, NULL, EGL_FALSE,
+
+ EGLSync sync;
+ EGLAttrib *attrib_list;
+ EGLint err;
+
+ if (sizeof(int_list[0]) == sizeof(attrib_list[0])) {
+ attrib_list = (EGLAttrib *) int_list;
+ } else {
+ err = _eglConvertIntsToAttribs(int_list, &attrib_list);
+ if (err != EGL_SUCCESS)
+ RETURN_EGL_ERROR(disp, err, EGL_NO_SYNC);
+ }
+
+ sync = _eglCreateSync(disp, type, attrib_list, EGL_FALSE,
EGL_BAD_ATTRIBUTE);
+
+ if (sizeof(int_list[0]) != sizeof(attrib_list[0]))
+ free(attrib_list);
+
+ /* Don't double-unlock the display. _eglCreateSync already unlocked it. */
+ return sync;
}
{
_EGLDisplay *disp = _eglLockDisplay(dpy);
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
- return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE,
+ return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
EGL_BAD_ATTRIBUTE);
}
{
_EGLDisplay *disp = _eglLockDisplay(dpy);
_EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE);
- return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE,
+ return _eglCreateSync(disp, type, attrib_list, EGL_TRUE,
EGL_BAD_PARAMETER);
}
* Parse the list of sync attributes and return the proper error code.
*/
static EGLint
-_eglParseSyncAttribList(_EGLSync *sync, const EGLint *attrib_list)
-{
- EGLint i;
-
- if (!attrib_list)
- return EGL_SUCCESS;
-
- for (i = 0; attrib_list[i] != EGL_NONE; i++) {
- EGLint attr = attrib_list[i++];
- EGLint val = attrib_list[i];
- EGLint err = EGL_SUCCESS;
-
- switch (attr) {
- default:
- (void) val;
- err = EGL_BAD_ATTRIBUTE;
- break;
- }
-
- if (err != EGL_SUCCESS) {
- _eglLog(_EGL_DEBUG, "bad sync attribute 0x%04x", attr);
- return err;
- }
- }
-
- return EGL_SUCCESS;
-}
-
-
-static EGLint
-_eglParseSyncAttribList64(_EGLSync *sync, const EGLAttrib *attrib_list)
+_eglParseSyncAttribList(_EGLSync *sync, const EGLAttrib *attrib_list)
{
EGLint i;
EGLBoolean
_eglInitSync(_EGLSync *sync, _EGLDisplay *dpy, EGLenum type,
- const EGLint *attrib_list, const EGLAttrib *attrib_list64)
+ const EGLAttrib *attrib_list)
{
EGLint err;
sync->SyncCondition = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
}
- if (attrib_list64)
- err = _eglParseSyncAttribList64(sync, attrib_list64);
- else
- err = _eglParseSyncAttribList(sync, attrib_list);
-
+ err = _eglParseSyncAttribList(sync, attrib_list);
if (err != EGL_SUCCESS)
return _eglError(err, "eglCreateSyncKHR");