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