sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // eglsynchelper.c sl@0: // sl@0: sl@0: #ifndef __eglsynchelper_h_ sl@0: #define __eglsynchelper_h_ sl@0: sl@0: #include sl@0: #include sl@0: #include "KHR/khrplatform.h" sl@0: sl@0: sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: #ifndef EGL_EGLEXT_PROTOTYPES sl@0: sl@0: /* sl@0: * EGLSyncKHR is an opaque handle to an EGL sync object sl@0: */ sl@0: typedef void* EGLSyncKHR; sl@0: sl@0: sl@0: typedef khronos_utime_nanoseconds_t EGLTimeKHR; sl@0: sl@0: /* API functions */ sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Create a sync object for the specified display. sl@0: * \ingroup api sl@0: * \param dpy Identifier of the display which will own the sync object sl@0: * \param type Type of the sync object. EGL_SYNC_REUSABLE_KHR is only supported sl@0: * \param attrib_list Attribute-value list specifying attributes of the sync sl@0: * object, terminated by an attribute entry EGL_NONE sl@0: * \return Handle for the created sync object if successful, EGL_NO_SYNC_KHR otherwise sl@0: * \error EGL_BAD_DISPLAY if is not a name of a valid EGLDisplay; sl@0: * EGL_NOT_INITIALIZED if the display object associated with the has not been initialized; sl@0: * EGL_BAD_ATTRIBUTE if is neither NULL nor empty (containing only EGL_NONE) or sl@0: * if is not a supported type of sync object; sl@0: * EGL_BAD_ALLOC if the memory allocation related to sync object is not successful sl@0: * \note If is EGL_SYNC_REUSABLE_KHR, a reusable sync object is created. sl@0: * In this case must be NULL or empty (containing only EGL_NONE). sl@0: * *//*-------------------------------------------------------------------*/ sl@0: EGLSyncKHR eglCreateSyncKHR( EGLDisplay dpy, sl@0: EGLenum condition, sl@0: const EGLint *attrib_list ); sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Destroy a sync object and free memory associated with it sl@0: * \ingroup api sl@0: * \param dpy Identifier of the display which owns the sync object sl@0: * \param sync Sync object handle. sl@0: * \return EGL_TRUE if deletion was successful and EGL_FALSE otherwise sl@0: * \error EGL_BAD_DISPLAY if is not a name of a valid EGLDisplay; sl@0: * EGL_NOT_INITIALIZED if the display object associated with the has not been initialized; sl@0: * EGL_BAD_PARAMETER if is not a valid sync object for sl@0: * \note If any eglClientWaitSyncKHR commands are blocking on when sl@0: * eglDestroySyncKHR is called, they will be woken up, as if were signaled. sl@0: * If no errors are generated, will no longer be the handle of a valid sync object. sl@0: *//*-------------------------------------------------------------------*/ sl@0: EGLBoolean eglDestroySyncKHR( EGLDisplay dpy, EGLSyncKHR sync ); sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Blocks the calling thread until the specified sync object sl@0: * is signaled, or until nanoseconds have passed. sl@0: * \ingroup api sl@0: * \param dpy Identifier of the display which owns the sync object. sl@0: * \param sync Sync object handle. sl@0: * \param flags If the EGL_FLUSH_COMMANDS_BIT_KHR bit is set in sl@0: * and is unsignaled when the function is called, then the equivalent sl@0: * of Flush() will be performed for the current API context. sl@0: * \param timeout The thread will be unblocked when is expired. sl@0: * If the is to zero, the function just test the current status sl@0: * of the sync object. If the is set to EGL_FOREVER_KHR, then the sl@0: * function does not time out. For all other values, is adjusted to sl@0: * the closest value which may be substantially longer than one nanosecond. sl@0: * \return EGL_CONDITION_SATISFIED if was signaled before sl@0: * the timeout expired, which includes the case when was already sl@0: * signaled when eglClientWaitSyncKHR was called; EGL_TIMEOUT_EXPIRED_KHR if the sl@0: * specified timeout period expired before was signaled; sl@0: * EGL_FALSE if an error occurs. sl@0: * \error EGL_BAD_DISPLAY if is not a name of a valid EGLDisplay; sl@0: * EGL_NOT_INITIALIZED if the display object associated with the has not been initialized; sl@0: * EGL_BAD_PARAMETER if is not a valid sync object for or sl@0: * if does not equal to 0 or EGL_SYNC_FLUSH_COMMAND_BIT_KHR sl@0: * Note\ More than one eglClientWaitSyncKHR may be outstanding on the same at any given time. sl@0: * When there are multiple threads blocked on the same and the sync object is signaled, sl@0: * all such threads are released, but the order in which they are released is not defined. sl@0: * If a sync object is destroyed while an eglClientWaitSyncKHR is blocking on that object, sl@0: * eglClientWaitSyncKHR will unblock and return immediately, just as if the sync object sl@0: * had been signaled prior to being destroyed. sl@0: *//*-------------------------------------------------------------------*/ sl@0: EGLint eglClientWaitSyncKHR( EGLDisplay dpy, sl@0: EGLSyncKHR sync, sl@0: EGLint flags, sl@0: EGLTimeKHR timeout ); sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Signals or unsignals the reusable sync object. sl@0: * \ingroup api sl@0: * \param dpy Identifier of the display which owns the sync object. sl@0: * \param sync Sync object handle. sl@0: * \param mode Status of the sync object. There are two possible states: sl@0: * EGL_SIGNALED_KHR and EGL_UNSIGNALED_KHR. sl@0: * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise. sl@0: * \note The error code returned from eglSignalSyncImpl() will be generated sl@0: *//*-------------------------------------------------------------------*/ sl@0: EGLBoolean eglSignalSyncKHR( EGLDisplay dpy, sl@0: EGLSyncKHR sync, sl@0: EGLenum mode ); sl@0: sl@0: sl@0: sl@0: /*-------------------------------------------------------------------*//*! sl@0: * \brief Query an attribute of the sync object sl@0: * \ingroup api sl@0: * \param dpy Identifier of the display which owns the sync object sl@0: * \param sync Sync object handle. sl@0: * \param attribute An attribute to be retrieved. sl@0: * \param value Pointer to the value for the requested attribute which will be filled on function return. sl@0: * \return EGL_TRUE if an operation was successful and EGL_FALSE otherwise sl@0: * \error EGL_BAD_DISPLAY if is not a name of a valid EGLDisplay; sl@0: * EGL_NOT_INITIALIZED if the display object associated with the has not been initialized; sl@0: * EGL_BAD_PARAMETER if is not a valid sync object for or if is not sl@0: * a valid pointer; EGL_BAD_ATTRIBUTE if does not lie within expected range; sl@0: * EGL_BAD_MATCH if is not supported for the type of sync object passed in sl@0: *//*-------------------------------------------------------------------*/ sl@0: EGLBoolean eglGetSyncAttribKHR( EGLDisplay dpy, sl@0: EGLSyncKHR sync, sl@0: EGLint attribute, sl@0: EGLint *value ); sl@0: #endif sl@0: sl@0: sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: sl@0: sl@0: #endif /* __eglsynchelper_h_ */