4 #include "eglcurrent.h"
8 #ifdef EGL_KHR_reusable_sync
12 * Parse the list of sync attributes and return the proper error code.
15 _eglParseSyncAttribList(_EGLSync
*sync
, const EGLint
*attrib_list
)
17 EGLint i
, err
= EGL_SUCCESS
;
22 for (i
= 0; attrib_list
[i
] != EGL_NONE
; i
++) {
23 EGLint attr
= attrib_list
[i
++];
24 EGLint val
= attrib_list
[i
];
29 err
= EGL_BAD_ATTRIBUTE
;
33 if (err
!= EGL_SUCCESS
) {
34 _eglLog(_EGL_DEBUG
, "bad sync attribute 0x%04x", attr
);
44 _eglInitSync(_EGLSync
*sync
, _EGLDisplay
*dpy
, EGLenum type
,
45 const EGLint
*attrib_list
)
49 if (!(type
== EGL_SYNC_REUSABLE_KHR
&& dpy
->Extensions
.KHR_reusable_sync
) &&
50 !(type
== EGL_SYNC_FENCE_KHR
&& dpy
->Extensions
.KHR_fence_sync
))
51 return _eglError(EGL_BAD_ATTRIBUTE
, "eglCreateSyncKHR");
53 _eglInitResource(&sync
->Resource
, sizeof(*sync
), dpy
);
55 sync
->SyncStatus
= EGL_UNSIGNALED_KHR
;
56 sync
->SyncCondition
= EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR
;
58 err
= _eglParseSyncAttribList(sync
, attrib_list
);
59 if (err
!= EGL_SUCCESS
)
60 return _eglError(err
, "eglCreateSyncKHR");
67 _eglGetSyncAttribKHR(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLSync
*sync
,
68 EGLint attribute
, EGLint
*value
)
71 return _eglError(EGL_BAD_PARAMETER
, "eglGetConfigs");
74 case EGL_SYNC_TYPE_KHR
:
77 case EGL_SYNC_STATUS_KHR
:
78 *value
= sync
->SyncStatus
;
80 case EGL_SYNC_CONDITION_KHR
:
81 if (sync
->Type
!= EGL_SYNC_FENCE_KHR
)
82 return _eglError(EGL_BAD_ATTRIBUTE
, "eglGetSyncAttribKHR");
83 *value
= sync
->SyncCondition
;
86 return _eglError(EGL_BAD_ATTRIBUTE
, "eglGetSyncAttribKHR");
94 #endif /* EGL_KHR_reusable_sync */