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