|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // eglsynchelper.c |
|
15 // |
|
16 |
|
17 #ifndef __eglsynchelper_h_ |
|
18 #define __eglsynchelper_h_ |
|
19 |
|
20 #include <EGL/eglext.h> |
|
21 #include <EGL/egl.h> |
|
22 #include "KHR/khrplatform.h" |
|
23 |
|
24 |
|
25 |
|
26 #ifdef __cplusplus |
|
27 extern "C" { |
|
28 #endif |
|
29 |
|
30 #ifndef EGL_EGLEXT_PROTOTYPES |
|
31 |
|
32 /* |
|
33 * EGLSyncKHR is an opaque handle to an EGL sync object |
|
34 */ |
|
35 typedef void* EGLSyncKHR; |
|
36 |
|
37 |
|
38 typedef khronos_utime_nanoseconds_t EGLTimeKHR; |
|
39 |
|
40 /* API functions */ |
|
41 |
|
42 /*-------------------------------------------------------------------*//*! |
|
43 * \brief Create a sync object for the specified display. |
|
44 * \ingroup api |
|
45 * \param dpy Identifier of the display which will own the sync object |
|
46 * \param type Type of the sync object. EGL_SYNC_REUSABLE_KHR is only supported |
|
47 * \param attrib_list Attribute-value list specifying attributes of the sync |
|
48 * object, terminated by an attribute entry EGL_NONE |
|
49 * \return Handle for the created sync object if successful, EGL_NO_SYNC_KHR otherwise |
|
50 * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; |
|
51 * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; |
|
52 * EGL_BAD_ATTRIBUTE if <attrib_list> is neither NULL nor empty (containing only EGL_NONE) or |
|
53 * if <type> is not a supported type of sync object; |
|
54 * EGL_BAD_ALLOC if the memory allocation related to sync object is not successful |
|
55 * \note If <type> is EGL_SYNC_REUSABLE_KHR, a reusable sync object is created. |
|
56 * In this case <attrib_list> must be NULL or empty (containing only EGL_NONE). |
|
57 * *//*-------------------------------------------------------------------*/ |
|
58 EGLSyncKHR eglCreateSyncKHR( EGLDisplay dpy, |
|
59 EGLenum condition, |
|
60 const EGLint *attrib_list ); |
|
61 |
|
62 /*-------------------------------------------------------------------*//*! |
|
63 * \brief Destroy a sync object and free memory associated with it |
|
64 * \ingroup api |
|
65 * \param dpy Identifier of the display which owns the sync object |
|
66 * \param sync Sync object handle. |
|
67 * \return EGL_TRUE if deletion was successful and EGL_FALSE otherwise |
|
68 * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; |
|
69 * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; |
|
70 * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> |
|
71 * \note If any eglClientWaitSyncKHR commands are blocking on <sync> when |
|
72 * eglDestroySyncKHR is called, they will be woken up, as if <sync> were signaled. |
|
73 * If no errors are generated, <sync> will no longer be the handle of a valid sync object. |
|
74 *//*-------------------------------------------------------------------*/ |
|
75 EGLBoolean eglDestroySyncKHR( EGLDisplay dpy, EGLSyncKHR sync ); |
|
76 |
|
77 /*-------------------------------------------------------------------*//*! |
|
78 * \brief Blocks the calling thread until the specified sync object |
|
79 * is signaled, or until <timeout> nanoseconds have passed. |
|
80 * \ingroup api |
|
81 * \param dpy Identifier of the display which owns the sync object. |
|
82 * \param sync Sync object handle. |
|
83 * \param flags If the EGL_FLUSH_COMMANDS_BIT_KHR bit is set in <flags> |
|
84 * and <sync> is unsignaled when the function is called, then the equivalent |
|
85 * of Flush() will be performed for the current API context. |
|
86 * \param timeout The thread will be unblocked when <timeout> is expired. |
|
87 * If the <timeout> is to zero, the function just test the current status |
|
88 * of the sync object. If the <timeout> is set to EGL_FOREVER_KHR, then the |
|
89 * function does not time out. For all other values, <timeout> is adjusted to |
|
90 * the closest value which may be substantially longer than one nanosecond. |
|
91 * \return EGL_CONDITION_SATISFIED if <sync> was signaled before |
|
92 * the timeout expired, which includes the case when <sync> was already |
|
93 * signaled when eglClientWaitSyncKHR was called; EGL_TIMEOUT_EXPIRED_KHR if the |
|
94 * specified timeout period expired before <sync> was signaled; |
|
95 * EGL_FALSE if an error occurs. |
|
96 * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; |
|
97 * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; |
|
98 * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or |
|
99 * if <flags> does not equal to 0 or EGL_SYNC_FLUSH_COMMAND_BIT_KHR |
|
100 * Note\ More than one eglClientWaitSyncKHR may be outstanding on the same <sync> at any given time. |
|
101 * When there are multiple threads blocked on the same <sync> and the sync object is signaled, |
|
102 * all such threads are released, but the order in which they are released is not defined. |
|
103 * If a sync object is destroyed while an eglClientWaitSyncKHR is blocking on that object, |
|
104 * eglClientWaitSyncKHR will unblock and return immediately, just as if the sync object |
|
105 * had been signaled prior to being destroyed. |
|
106 *//*-------------------------------------------------------------------*/ |
|
107 EGLint eglClientWaitSyncKHR( EGLDisplay dpy, |
|
108 EGLSyncKHR sync, |
|
109 EGLint flags, |
|
110 EGLTimeKHR timeout ); |
|
111 |
|
112 /*-------------------------------------------------------------------*//*! |
|
113 * \brief Signals or unsignals the reusable sync object. |
|
114 * \ingroup api |
|
115 * \param dpy Identifier of the display which owns the sync object. |
|
116 * \param sync Sync object handle. |
|
117 * \param mode Status of the sync object. There are two possible states: |
|
118 * EGL_SIGNALED_KHR and EGL_UNSIGNALED_KHR. |
|
119 * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise. |
|
120 * \note The error code returned from eglSignalSyncImpl() will be generated |
|
121 *//*-------------------------------------------------------------------*/ |
|
122 EGLBoolean eglSignalSyncKHR( EGLDisplay dpy, |
|
123 EGLSyncKHR sync, |
|
124 EGLenum mode ); |
|
125 |
|
126 |
|
127 |
|
128 /*-------------------------------------------------------------------*//*! |
|
129 * \brief Query an attribute of the sync object |
|
130 * \ingroup api |
|
131 * \param dpy Identifier of the display which owns the sync object |
|
132 * \param sync Sync object handle. |
|
133 * \param attribute An attribute to be retrieved. |
|
134 * \param value Pointer to the value for the requested attribute which will be filled on function return. |
|
135 * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise |
|
136 * \error EGL_BAD_DISPLAY if <dpy> is not a name of a valid EGLDisplay; |
|
137 * EGL_NOT_INITIALIZED if the display object associated with the <dpy> has not been initialized; |
|
138 * EGL_BAD_PARAMETER if <sync> is not a valid sync object for <dpy> or if <value> is not |
|
139 * a valid pointer; EGL_BAD_ATTRIBUTE if <attribute> does not lie within expected range; |
|
140 * EGL_BAD_MATCH if <attribute> is not supported for the type of sync object passed in <sync> |
|
141 *//*-------------------------------------------------------------------*/ |
|
142 EGLBoolean eglGetSyncAttribKHR( EGLDisplay dpy, |
|
143 EGLSyncKHR sync, |
|
144 EGLint attribute, |
|
145 EGLint *value ); |
|
146 #endif |
|
147 |
|
148 |
|
149 #ifdef __cplusplus |
|
150 } |
|
151 #endif |
|
152 |
|
153 |
|
154 #endif /* __eglsynchelper_h_ */ |