15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    KHR_fence_sync
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    EGL_KHR_fence_sync
85bd8deadSopenharmony_ci    GL_OES_EGL_sync
95bd8deadSopenharmony_ci    VG_KHR_EGL_sync
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ciContributors
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ci    Acorn Pooley
145bd8deadSopenharmony_ci    Gary King
155bd8deadSopenharmony_ci    Gregory Prisament
165bd8deadSopenharmony_ci    Jon Leech
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciContacts
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Acorn Pooley, NVIDIA Corporation (apooley 'at' nvidia.com)
215bd8deadSopenharmony_ci    Gary King, NVIDIA Corporation (gking 'at' nvidia.com)
225bd8deadSopenharmony_ci    Gregory Prisament, NVIDIA Corporation (gprisament 'at' nvidia.com)
235bd8deadSopenharmony_ci    Jon Leech (jon 'at' alumni.caltech.edu)
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ciNotice
265bd8deadSopenharmony_ci
275bd8deadSopenharmony_ci    Copyright (c) 2006-2013 The Khronos Group Inc. Copyright terms at
285bd8deadSopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciSpecification Update Policy
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    Khronos-approved extension specifications are updated in response to
335bd8deadSopenharmony_ci    issues and bugs prioritized by the Khronos OpenGL Working Group. For
345bd8deadSopenharmony_ci    extensions which have been promoted to a core Specification, fixes will
355bd8deadSopenharmony_ci    first appear in the latest version of that core Specification, and will
365bd8deadSopenharmony_ci    eventually be backported to the extension document. This policy is
375bd8deadSopenharmony_ci    described in more detail at
385bd8deadSopenharmony_ci        https://www.khronos.org/registry/OpenGL/docs/update_policy.php
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ciStatus
415bd8deadSopenharmony_ci
425bd8deadSopenharmony_ci    Complete. Approved by the EGL Working Group on March 3, 2010.
435bd8deadSopenharmony_ci    Approved by the Khronos Board of Promoters on April 30, 2010.
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ciVersion
465bd8deadSopenharmony_ci
475bd8deadSopenharmony_ci    Version 24, January 31, 2014
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ciNumber
505bd8deadSopenharmony_ci
515bd8deadSopenharmony_ci    EGL Extension #20
525bd8deadSopenharmony_ci    OpenGL ES Extension #75
535bd8deadSopenharmony_ci    OpenVG Extension #7
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ciDependencies
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Requires EGL 1.1
585bd8deadSopenharmony_ci
595bd8deadSopenharmony_ci    This extension is written against the wording of the EGL 1.2
605bd8deadSopenharmony_ci    Specification.
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ciOverview
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    This extension introduces the concept of "sync objects" into EGL.
655bd8deadSopenharmony_ci    Sync objects are a synchronization primitive, representing events
665bd8deadSopenharmony_ci    whose completion can be tested or waited upon.  This extension
675bd8deadSopenharmony_ci    borrows heavily from the GL_ARB_sync extension and introduces a type
685bd8deadSopenharmony_ci    of sync object known as a "fence sync object" comparable to the
695bd8deadSopenharmony_ci    OpenGL fence sync object. The specification is designed to allow
705bd8deadSopenharmony_ci    additional types of sync objects to be easily introduced in later
715bd8deadSopenharmony_ci    extensions.
725bd8deadSopenharmony_ci
735bd8deadSopenharmony_ci    Fence sync objects have corresponding fence commands, which are
745bd8deadSopenharmony_ci    inserted into a client API command stream at the time the fence sync
755bd8deadSopenharmony_ci    is created. A fence sync object is used to wait for completion of
765bd8deadSopenharmony_ci    the corresponding fence command. This allows applications to request
775bd8deadSopenharmony_ci    a partial Finish of an API command stream, wherein all commands
785bd8deadSopenharmony_ci    issued in a particular client API context will be forced to complete
795bd8deadSopenharmony_ci    before control is returned to the calling thread.
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    This document describes three different extension strings
825bd8deadSopenharmony_ci    collectively. The "EGL_KHR_fence_sync" string indicates that fence
835bd8deadSopenharmony_ci    syncs and the corresponding interfaces (to create and place a fence,
845bd8deadSopenharmony_ci    destroy, query, and wait on) are supported.
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    The remaining extensions list valid client APIs for fence syncs. The
875bd8deadSopenharmony_ci    "GL_OES_EGL_sync" string indicates that a fence sync object can be
885bd8deadSopenharmony_ci    created in association with a fence command placed in the command
895bd8deadSopenharmony_ci    stream of a bound OpenGL ES context. The "VG_KHR_EGL_sync" string
905bd8deadSopenharmony_ci    indicates the same thing for a bound OpenVG context.
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ciNew Types
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    /*
955bd8deadSopenharmony_ci     * EGLSyncKHR is an opaque handle to an EGL sync object
965bd8deadSopenharmony_ci     */
975bd8deadSopenharmony_ci    typedef void* EGLSyncKHR;
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    /*
1005bd8deadSopenharmony_ci     * EGLTimeKHR is a 64-bit unsigned integer representing intervals
1015bd8deadSopenharmony_ci     * in nanoseconds.
1025bd8deadSopenharmony_ci     */
1035bd8deadSopenharmony_ci    #include <khrplatform.h>
1045bd8deadSopenharmony_ci    typedef khronos_utime_nanoseconds_t EGLTimeKHR;
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ciNew Procedures and Functions
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci    EGLSyncKHR eglCreateSyncKHR(
1105bd8deadSopenharmony_ci                        EGLDisplay dpy,
1115bd8deadSopenharmony_ci                        EGLenum type,
1125bd8deadSopenharmony_ci                        const EGLint *attrib_list);
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci    EGLBoolean eglDestroySyncKHR(
1155bd8deadSopenharmony_ci                        EGLDisplay dpy,
1165bd8deadSopenharmony_ci                        EGLSyncKHR sync);
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    EGLint eglClientWaitSyncKHR(
1195bd8deadSopenharmony_ci                        EGLDisplay dpy,
1205bd8deadSopenharmony_ci                        EGLSyncKHR sync,
1215bd8deadSopenharmony_ci                        EGLint flags,
1225bd8deadSopenharmony_ci                        EGLTimeKHR timeout);
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci    EGLBoolean eglGetSyncAttribKHR(
1255bd8deadSopenharmony_ci                        EGLDisplay dpy,
1265bd8deadSopenharmony_ci                        EGLSyncKHR sync,
1275bd8deadSopenharmony_ci                        EGLint attribute,
1285bd8deadSopenharmony_ci                        EGLint *value);
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci
1315bd8deadSopenharmony_ciNew Tokens
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    Accepted by the <type> parameter of eglCreateSyncKHR, and returned
1345bd8deadSopenharmony_ci    in <value> when eglGetSyncAttribKHR is called with <attribute>
1355bd8deadSopenharmony_ci    EGL_SYNC_TYPE_KHR:
1365bd8deadSopenharmony_ci
1375bd8deadSopenharmony_ci    EGL_SYNC_FENCE_KHR                      0x30F9
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    Accepted by the <attribute> parameter of eglGetSyncAttribKHR:
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ci    EGL_SYNC_TYPE_KHR                       0x30F7
1425bd8deadSopenharmony_ci    EGL_SYNC_STATUS_KHR                     0x30F1
1435bd8deadSopenharmony_ci    EGL_SYNC_CONDITION_KHR                  0x30F8
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ci    Returned in <value> when eglGetSyncAttribKHR is called with
1465bd8deadSopenharmony_ci    <attribute> EGL_SYNC_STATUS_KHR:
1475bd8deadSopenharmony_ci
1485bd8deadSopenharmony_ci    EGL_SIGNALED_KHR                        0x30F2
1495bd8deadSopenharmony_ci    EGL_UNSIGNALED_KHR                      0x30F3
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    Returned in <value> when eglGetSyncAttribKHR is called with
1525bd8deadSopenharmony_ci    <attribute> EGL_SYNC_CONDITION_KHR:
1535bd8deadSopenharmony_ci
1545bd8deadSopenharmony_ci    EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR    0x30F0
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    Accepted in the <flags> parameter of eglClientWaitSyncKHR:
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    EGL_SYNC_FLUSH_COMMANDS_BIT_KHR         0x0001
1595bd8deadSopenharmony_ci
1605bd8deadSopenharmony_ci    Accepted in the <timeout> parameter of eglClientWaitSyncKHR:
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    EGL_FOREVER_KHR                         0xFFFFFFFFFFFFFFFFull
1635bd8deadSopenharmony_ci
1645bd8deadSopenharmony_ci    Returned by eglClientWaitSyncKHR:
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci    EGL_TIMEOUT_EXPIRED_KHR                 0x30F5
1675bd8deadSopenharmony_ci    EGL_CONDITION_SATISFIED_KHR             0x30F6
1685bd8deadSopenharmony_ci
1695bd8deadSopenharmony_ci    Returned by eglCreateSyncKHR in the event of an error:
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    EGL_NO_SYNC_KHR                         ((EGLSyncKHR)0)
1725bd8deadSopenharmony_ci
1735bd8deadSopenharmony_ciChanges to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors)
1745bd8deadSopenharmony_ci
1755bd8deadSopenharmony_ci    Add a new subsection at the end of Section 3.8, page 43
1765bd8deadSopenharmony_ci    (Synchronization Primitives)
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci    "3.8.1  Sync Objects
1795bd8deadSopenharmony_ci
1805bd8deadSopenharmony_ci    In addition to the aforementioned synchronization functions, which
1815bd8deadSopenharmony_ci    provide an efficient means of serializing client and native API
1825bd8deadSopenharmony_ci    operations within a thread, <sync objects> are provided to enable
1835bd8deadSopenharmony_ci    synchronization of client API operations between threads and/or
1845bd8deadSopenharmony_ci    between API contexts. Sync objects may be tested or waited upon by
1855bd8deadSopenharmony_ci    application threads.
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ci    Sync objects have a status with two possible states: <signaled> and
1885bd8deadSopenharmony_ci    <unsignaled>. Initially, sync objects are unsignaled. EGL may be
1895bd8deadSopenharmony_ci    asked to wait for a sync object to become signaled, or a sync
1905bd8deadSopenharmony_ci    object's status may be queried.
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci    Depending on the type of a sync object, its status may be changed
1935bd8deadSopenharmony_ci    either by an external event, or by explicitly signaling and
1945bd8deadSopenharmony_ci    unsignaling the sync.
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    Sync objects are associated with an EGLDisplay when they are
1975bd8deadSopenharmony_ci    created, and have <attributes> defining additional aspects of the
1985bd8deadSopenharmony_ci    sync object. All sync objects include attributes for their type and
1995bd8deadSopenharmony_ci    their status. Additional attributes are discussed below
2005bd8deadSopenharmony_ci    for different types of sync objects.
2015bd8deadSopenharmony_ci
2025bd8deadSopenharmony_ci    <Fence sync objects> are created in association with a <fence
2035bd8deadSopenharmony_ci    command> in a client API. When the client API executes the fence
2045bd8deadSopenharmony_ci    command, an event is generated which signals the corresponding fence
2055bd8deadSopenharmony_ci    sync object. Fence sync objects may not be explicitly signaled, and
2065bd8deadSopenharmony_ci    may only change their status once, from the initial unsignaled
2075bd8deadSopenharmony_ci    status to signaled. Fence sync objects may be used to wait for
2085bd8deadSopenharmony_ci    partial completion of a client API command stream, as a more
2095bd8deadSopenharmony_ci    flexible form of glFinish / vgFinish.
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    The command
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci        EGLSyncKHR eglCreateSyncKHR(
2145bd8deadSopenharmony_ci                            EGLDisplay dpy,
2155bd8deadSopenharmony_ci                            EGLenum type,
2165bd8deadSopenharmony_ci                            const EGLint *attrib_list);
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    creates a sync object of the specified <type> associated with the
2195bd8deadSopenharmony_ci    specified display <dpy>, and returns a handle to the new object.
2205bd8deadSopenharmony_ci    <attrib_list> is an attribute-value list specifying other attributes
2215bd8deadSopenharmony_ci    of the sync object, terminated by an attribute entry EGL_NONE.
2225bd8deadSopenharmony_ci    Attributes not specified in the list will be assigned their default
2235bd8deadSopenharmony_ci    values.
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci    If <type> is EGL_SYNC_FENCE_KHR, a fence sync object is created. In
2265bd8deadSopenharmony_ci    this case <attrib_list> must be NULL or empty (containing only
2275bd8deadSopenharmony_ci    EGL_NONE). Attributes of the fence sync object are
2285bd8deadSopenharmony_ci    set as follows:
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci      Attribute Name         Initial Attribute Value(s)
2315bd8deadSopenharmony_ci      ---------------        --------------------------
2325bd8deadSopenharmony_ci      EGL_SYNC_TYPE_KHR      EGL_SYNC_FENCE_KHR
2335bd8deadSopenharmony_ci      EGL_SYNC_STATUS_KHR    EGL_UNSIGNALED_KHR
2345bd8deadSopenharmony_ci      EGL_SYNC_CONDITION_KHR EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR
2355bd8deadSopenharmony_ci
2365bd8deadSopenharmony_ci    When a fence sync object is created, eglCreateSyncKHR also inserts a
2375bd8deadSopenharmony_ci    fence command into the command stream of the bound client API's
2385bd8deadSopenharmony_ci    current context (i.e., the context returned by
2395bd8deadSopenharmony_ci    eglGetCurrentContext), and associates it with the newly created sync
2405bd8deadSopenharmony_ci    object.
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci    When the condition of the sync object is satisfied by the fence
2435bd8deadSopenharmony_ci    command, the sync is signaled by the associated client API context,
2445bd8deadSopenharmony_ci    causing any eglClientWaitSyncKHR commands (see below) blocking on
2455bd8deadSopenharmony_ci    <sync> to unblock. The only condition currently supported is
2465bd8deadSopenharmony_ci    EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR, which is satisfied by
2475bd8deadSopenharmony_ci    completion of the fence command corresponding to the sync object,
2485bd8deadSopenharmony_ci    and all preceding commands in the associated client API context's
2495bd8deadSopenharmony_ci    command stream. The sync object will not be signaled until all
2505bd8deadSopenharmony_ci    effects from these commands on the client API's internal and
2515bd8deadSopenharmony_ci    framebuffer state are fully realized. No other state is affected by
2525bd8deadSopenharmony_ci    execution of the fence command.
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    Each client API which supports fence commands indicates this support
2555bd8deadSopenharmony_ci    in the form of a client API extension. If the GL_OES_EGL_sync
2565bd8deadSopenharmony_ci    extension is supported by OpenGL ES (either version 1.x or 2.0), a
2575bd8deadSopenharmony_ci    fence sync object may be created when the currently bound API is
2585bd8deadSopenharmony_ci    OpenGL ES. If the VG_KHR_EGL_sync extension is supported by OpenVG,
2595bd8deadSopenharmony_ci    a fence sync object may be created when the currently bound API is
2605bd8deadSopenharmony_ci    OpenVG.
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ci    Errors
2635bd8deadSopenharmony_ci    ------
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci      * If <dpy> is not the name of a valid, initialized EGLDisplay,
2665bd8deadSopenharmony_ci        EGL_NO_SYNC_KHR is returned and an EGL_BAD_DISPLAY error is
2675bd8deadSopenharmony_ci        generated.
2685bd8deadSopenharmony_ci      * If <attrib_list> is neither NULL nor empty (containing only
2695bd8deadSopenharmony_ci        EGL_NONE), EGL_NO_SYNC_KHR is returned and an EGL_BAD_ATTRIBUTE
2705bd8deadSopenharmony_ci        error is generated.
2715bd8deadSopenharmony_ci      * If <type> is not a supported type of sync object,
2725bd8deadSopenharmony_ci        EGL_NO_SYNC_KHR is returned and an EGL_BAD_ATTRIBUTE error is
2735bd8deadSopenharmony_ci        generated.
2745bd8deadSopenharmony_ci      * If <type> is EGL_SYNC_FENCE_KHR and no context is current for
2755bd8deadSopenharmony_ci        the bound API (i.e., eglGetCurrentContext returns
2765bd8deadSopenharmony_ci        EGL_NO_CONTEXT), EGL_NO_SYNC_KHR is returned and an
2775bd8deadSopenharmony_ci        EGL_BAD_MATCH error is generated.
2785bd8deadSopenharmony_ci      * If <type> is EGL_SYNC_FENCE_KHR and <dpy> does not match the
2795bd8deadSopenharmony_ci        EGLDisplay of the currently bound context for the currently
2805bd8deadSopenharmony_ci        bound client API (the EGLDisplay returned by
2815bd8deadSopenharmony_ci        eglGetCurrentDisplay()) then EGL_NO_SYNC_KHR is returned and an
2825bd8deadSopenharmony_ci        EGL_BAD_MATCH error is generated.
2835bd8deadSopenharmony_ci      * If <type> is EGL_SYNC_FENCE_KHR and the currently bound client
2845bd8deadSopenharmony_ci        API does not support the client API extension indicating it can
2855bd8deadSopenharmony_ci        place fence commands, then EGL_NO_SYNC_KHR is returned and an
2865bd8deadSopenharmony_ci        EGL_BAD_MATCH error is generated.
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci    The command
2895bd8deadSopenharmony_ci
2905bd8deadSopenharmony_ci        EGLint eglClientWaitSyncKHR(
2915bd8deadSopenharmony_ci                            EGLDisplay dpy,
2925bd8deadSopenharmony_ci                            EGLSyncKHR sync,
2935bd8deadSopenharmony_ci                            EGLint flags,
2945bd8deadSopenharmony_ci                            EGLTimeKHR timeout);
2955bd8deadSopenharmony_ci
2965bd8deadSopenharmony_ci    blocks the calling thread until the specified sync object <sync> is
2975bd8deadSopenharmony_ci    signaled, or until <timeout> nanoseconds have passed.
2985bd8deadSopenharmony_ci
2995bd8deadSopenharmony_ci    More than one eglClientWaitSyncKHR may be outstanding on the same
3005bd8deadSopenharmony_ci    <sync> at any given time. When there are multiple threads blocked on
3015bd8deadSopenharmony_ci    the same <sync> and the sync object is signaled, all such threads
3025bd8deadSopenharmony_ci    are released, but the order in which they are released is not
3035bd8deadSopenharmony_ci    defined.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci    If the value of <timeout> is zero, then eglClientWaitSyncKHR simply
3065bd8deadSopenharmony_ci    tests the current status of <sync>. If the value of <timeout> is the
3075bd8deadSopenharmony_ci    special value EGL_FOREVER_KHR, then eglClientWaitSyncKHR does not
3085bd8deadSopenharmony_ci    time out. For all other values, <timeout> is adjusted to the closest
3095bd8deadSopenharmony_ci    value allowed by the implementation-dependent timeout accuracy,
3105bd8deadSopenharmony_ci    which may be substantially longer than one nanosecond.
3115bd8deadSopenharmony_ci
3125bd8deadSopenharmony_ci    eglClientWaitSyncKHR returns one of three status values describing
3135bd8deadSopenharmony_ci    the reason for returning. A return value of EGL_TIMEOUT_EXPIRED_KHR
3145bd8deadSopenharmony_ci    indicates that the specified timeout period expired before <sync>
3155bd8deadSopenharmony_ci    was signaled, or if <timeout> is zero, indicates that <sync> is
3165bd8deadSopenharmony_ci    not signaled. A return value of EGL_CONDITION_SATISFIED_KHR
3175bd8deadSopenharmony_ci    indicates that <sync> was signaled before the timeout expired, which
3185bd8deadSopenharmony_ci    includes the case when <sync> was already signaled when
3195bd8deadSopenharmony_ci    eglClientWaitSyncKHR was called. If an error occurs then an error is
3205bd8deadSopenharmony_ci    generated and EGL_FALSE is returned.
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    If the sync object being blocked upon will not be signaled in finite
3235bd8deadSopenharmony_ci    time (for example, by an associated fence command issued previously,
3245bd8deadSopenharmony_ci    but not yet flushed to the graphics pipeline), then
3255bd8deadSopenharmony_ci    eglClientWaitSyncKHR may wait forever. To help prevent this behavior
3265bd8deadSopenharmony_ci    (footnote1), if the EGL_SYNC_FLUSH_COMMANDS_BIT_KHR bit is set in
3275bd8deadSopenharmony_ci    <flags>, and <sync> is unsignaled when eglClientWaitSyncKHR is
3285bd8deadSopenharmony_ci    called, then the equivalent of Flush() will be performed for the
3295bd8deadSopenharmony_ci    current API context (i.e., the context returned by
3305bd8deadSopenharmony_ci    eglGetCurrentContext()) before blocking on <sync>. If no context is
3315bd8deadSopenharmony_ci    current for the bound API, the EGL_SYNC_FLUSH_COMMANDS_BIT_KHR bit
3325bd8deadSopenharmony_ci    is ignored.
3335bd8deadSopenharmony_ci
3345bd8deadSopenharmony_ci       [footnote 1: The simple Flush behavior defined by
3355bd8deadSopenharmony_ci        EGL_SYNC_FLUSH_COMMANDS_BIT_KHR will not help when waiting for a
3365bd8deadSopenharmony_ci        fence command issued in a different context's command stream.
3375bd8deadSopenharmony_ci        Applications which block on a fence sync object must take
3385bd8deadSopenharmony_ci        additional steps to ensure that the context from which the
3395bd8deadSopenharmony_ci        associated fence command was issued has flushed that command to
3405bd8deadSopenharmony_ci        the graphics pipeline.]
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci    Errors
3435bd8deadSopenharmony_ci    ------
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci      * If <sync> is not a valid sync object for <dpy>, EGL_FALSE is
3465bd8deadSopenharmony_ci        returned and an EGL_BAD_PARAMETER error is generated.
3475bd8deadSopenharmony_ci      * If <dpy> does not match the EGLDisplay passed to
3485bd8deadSopenharmony_ci        eglCreateSyncKHR when <sync> was created, the behaviour is
3495bd8deadSopenharmony_ci        undefined.
3505bd8deadSopenharmony_ci
3515bd8deadSopenharmony_ci
3525bd8deadSopenharmony_ci    The command
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci        EGLBoolean eglGetSyncAttribKHR(
3555bd8deadSopenharmony_ci                            EGLDisplay dpy,
3565bd8deadSopenharmony_ci                            EGLSyncKHR sync,
3575bd8deadSopenharmony_ci                            EGLint attribute,
3585bd8deadSopenharmony_ci                            EGLint *value);
3595bd8deadSopenharmony_ci
3605bd8deadSopenharmony_ci    is used to query attributes of the sync object <sync>. Legal values
3615bd8deadSopenharmony_ci    for <attribute> depend on the type of sync object, as shown in table
3625bd8deadSopenharmony_ci    3.cc. Assuming no errors are generated, EGL_TRUE is returned and the
3635bd8deadSopenharmony_ci    value of the queried attribute is returned in <value>.
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    Attribute              Description                Supported Sync Objects
3665bd8deadSopenharmony_ci    -----------------      -----------------------    ----------------------
3675bd8deadSopenharmony_ci    EGL_SYNC_TYPE_KHR      Type of the sync object    All
3685bd8deadSopenharmony_ci    EGL_SYNC_STATUS_KHR    Status of the sync object  All
3695bd8deadSopenharmony_ci    EGL_SYNC_CONDITION_KHR Signaling condition        EGL_SYNC_FENCE_KHR only
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    Table 3.cc  Attributes Accepted by eglGetSyncAttribKHR Command
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci    Errors
3745bd8deadSopenharmony_ci    ------
3755bd8deadSopenharmony_ci
3765bd8deadSopenharmony_ci      * If <sync> is not a valid sync object for <dpy>, EGL_FALSE is
3775bd8deadSopenharmony_ci        returned and an EGL_BAD_PARAMETER error is generated.
3785bd8deadSopenharmony_ci      * If <dpy> does not match the display passed to eglCreateSyncKHR
3795bd8deadSopenharmony_ci        when <sync> was created, the behaviour is undefined.
3805bd8deadSopenharmony_ci      * If <attribute> is not one of the attributes in table 3.cc,
3815bd8deadSopenharmony_ci        EGL_FALSE is returned and an EGL_BAD_ATTRIBUTE error is
3825bd8deadSopenharmony_ci        generated.
3835bd8deadSopenharmony_ci      * If <attribute> is not supported for the type of sync object
3845bd8deadSopenharmony_ci        passed in <sync>, EGL_FALSE is returned and an EGL_BAD_MATCH
3855bd8deadSopenharmony_ci        error is generated.
3865bd8deadSopenharmony_ci
3875bd8deadSopenharmony_ci    If any error occurs, <*value> is not modified.
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ci    The command
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci        EGLBoolean eglDestroySyncKHR(
3925bd8deadSopenharmony_ci                            EGLDisplay dpy,
3935bd8deadSopenharmony_ci                            EGLSyncKHR sync);
3945bd8deadSopenharmony_ci
3955bd8deadSopenharmony_ci    is used to destroy an existing sync object.
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ci    If any eglClientWaitSyncKHR commands are blocking on <sync> when
3985bd8deadSopenharmony_ci    eglDestroySyncKHR is called, <sync> is flagged for deletion and will
3995bd8deadSopenharmony_ci    be deleted when it is no longer associated with any fence command
4005bd8deadSopenharmony_ci    and is no longer blocking any eglClientWaitSyncKHR command.
4015bd8deadSopenharmony_ci
4025bd8deadSopenharmony_ci    If no errors are generated, EGL_TRUE is returned, and <sync> will no
4035bd8deadSopenharmony_ci    longer be the handle of a valid sync object.
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ci    Errors
4065bd8deadSopenharmony_ci    ------
4075bd8deadSopenharmony_ci
4085bd8deadSopenharmony_ci      * If <sync> is not a valid sync object for <dpy>, EGL_FALSE is
4095bd8deadSopenharmony_ci        returned and an EGL_BAD_PARAMETER error is generated.
4105bd8deadSopenharmony_ci      * If <dpy> does not match the display passed to eglCreateSyncKHR
4115bd8deadSopenharmony_ci        when <sync> was created, the behaviour is undefined.
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ciIssues
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    Note about the Issues
4165bd8deadSopenharmony_ci    ---------------------
4175bd8deadSopenharmony_ci    The wording for this extension was originally written as a single
4185bd8deadSopenharmony_ci    extension defining two types of sync object; a "reusable sync
4195bd8deadSopenharmony_ci    object" and a "fence sync object". That extension was split to
4205bd8deadSopenharmony_ci    produce standalone extensions for each type of sync object, and
4215bd8deadSopenharmony_ci    references to the other type removed from the specification
4225bd8deadSopenharmony_ci    language. This issues list has been simplied to remove references to
4235bd8deadSopenharmony_ci    reusable sync objects but is otherwise very similar to the
4245bd8deadSopenharmony_ci    EGL_KHR_reusable_sync extension issues list.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    1. [REMOVED - found in the reusable_sync extension.]
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ci    2. [REMOVED - found in the reusable_sync extension.]
4295bd8deadSopenharmony_ci
4305bd8deadSopenharmony_ci    3. What does this extension provide that can not be accomplished
4315bd8deadSopenharmony_ci    with the existing, more efficient eglWaitClient and eglWaitNative
4325bd8deadSopenharmony_ci    API functions?
4335bd8deadSopenharmony_ci
4345bd8deadSopenharmony_ci    RESPONSE: eglWaitClient and eglWaitNative may be implemented in
4355bd8deadSopenharmony_ci    extremely lightweight manners, in some cases not blocking the
4365bd8deadSopenharmony_ci    calling thread at all; however, they can not be used to synchronize
4375bd8deadSopenharmony_ci    between client API contexts and native APIs executing in separate
4385bd8deadSopenharmony_ci    threads (or simply between client API contexts executing in separate
4395bd8deadSopenharmony_ci    threads), such as between a thread with an active OpenGL context and
4405bd8deadSopenharmony_ci    a second thread performing video decode.
4415bd8deadSopenharmony_ci
4425bd8deadSopenharmony_ci    4. What does this extension provide that could not be accomplished
4435bd8deadSopenharmony_ci    with native platform synchronization primitives and the existing
4445bd8deadSopenharmony_ci    client API Finish commands?
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ci    RESPONSE: This extension provides a lighter-weight mechanism for
4475bd8deadSopenharmony_ci    synchronizing an application with client API command streams than
4485bd8deadSopenharmony_ci    the all-or-nothing Finish commands, enabling applications to block
4495bd8deadSopenharmony_ci    until a subset of issued client API commands have completed.
4505bd8deadSopenharmony_ci
4515bd8deadSopenharmony_ci    5. [REMOVED - found in the reusable_sync extension.]
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    6. Please provide a more detailed description of how
4545bd8deadSopenharmony_ci    eglClientWaitSyncKHR behaves.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    RESOLVED: eglClientWaitSyncKHR blocks until the status of the sync
4575bd8deadSopenharmony_ci    object transitions to the signaled state. Sync object status is
4585bd8deadSopenharmony_ci    either signaled or unsignaled. More detailed rules describing
4595bd8deadSopenharmony_ci    signalling follow (these may need to be imbedded into the actual
4605bd8deadSopenharmony_ci    spec language):
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci      * A fence sync object has two possible status values: signaled or
4635bd8deadSopenharmony_ci        unsignaled.
4645bd8deadSopenharmony_ci      * When created, the status of the sync object is unsignaled.
4655bd8deadSopenharmony_ci      * A fence command is inserted into a command stream. A fence sync
4665bd8deadSopenharmony_ci        object is not.
4675bd8deadSopenharmony_ci      * A fence command, once its condition has been met, will set its
4685bd8deadSopenharmony_ci        associated sync object to the signaled state. The only condition
4695bd8deadSopenharmony_ci        currently supported is EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR.
4705bd8deadSopenharmony_ci      * A wait function, such as ClientWaitSyncKHR, waits on a fence
4715bd8deadSopenharmony_ci        sync object, not on a fence command.
4725bd8deadSopenharmony_ci      * A wait function called on a sync object in the unsignaled state
4735bd8deadSopenharmony_ci        will block. It unblocks (note, not "returns to the application")
4745bd8deadSopenharmony_ci        when the sync object transitions to the signaled state.
4755bd8deadSopenharmony_ci      * A wait function called on a sync object in the signaled state
4765bd8deadSopenharmony_ci        will return immediately.
4775bd8deadSopenharmony_ci
4785bd8deadSopenharmony_ci    7. [REMOVED - found in the reusable_sync extension.]
4795bd8deadSopenharmony_ci
4805bd8deadSopenharmony_ci    8. [REMOVED - found in the reusable_sync extension.]
4815bd8deadSopenharmony_ci
4825bd8deadSopenharmony_ci    9. Should eglDestroySyncKHR release all WaitSyncs placed on a fence
4835bd8deadSopenharmony_ci    sync object?
4845bd8deadSopenharmony_ci
4855bd8deadSopenharmony_ci    RESOLVED: No. (note that this behavior differs from reusable syncs.)
4865bd8deadSopenharmony_ci
4875bd8deadSopenharmony_ci    Fence sync objects are intended to be signalled by the graphics
4885bd8deadSopenharmony_ci    driver within a short period of time (typically less than 1 second
4895bd8deadSopenharmony_ci    after creation) and so should not cause waiting threads to hang
4905bd8deadSopenharmony_ci    forever. To reduce implementation complexity, fence sync objects are
4915bd8deadSopenharmony_ci    defined to not release waiting threads; waiting threads are released
4925bd8deadSopenharmony_ci    normally when their condition is satisfied or their timeout expires.
4935bd8deadSopenharmony_ci    The handle to a fence sync object immediately becomes invalid
4945bd8deadSopenharmony_ci    following a call to eglDestroySyncKHR.
4955bd8deadSopenharmony_ci
4965bd8deadSopenharmony_ciRevision History
4975bd8deadSopenharmony_ci
4985bd8deadSopenharmony_ci#24 (Jon Leech, January 31, 2014)
4995bd8deadSopenharmony_ci    - Clarify return value of ClientWaitSyncKHR when called with <timeout>
5005bd8deadSopenharmony_ci      of zero for an unsignaled <sync> (Bug 11576).
5015bd8deadSopenharmony_ci#23 (Jon Leech, April 23, 2013)
5025bd8deadSopenharmony_ci    - Simplify issues list to remove issues specific to reusable sync
5035bd8deadSopenharmony_ci      objects and general sync object design issues.
5045bd8deadSopenharmony_ci#22 (Jon Leech, June 15, 2010)
5055bd8deadSopenharmony_ci    - Correct minor typos in GL/VG extension names.
5065bd8deadSopenharmony_ci#21 (Jon Leech, May 5, 2010)
5075bd8deadSopenharmony_ci    - Correct minor typos, assign extension numbers for EGL, OpenGL ES,
5085bd8deadSopenharmony_ci      and OpenVG, and publish in the registry,
5095bd8deadSopenharmony_ci#20 (Robert Palmer, July 14, 2009)
5105bd8deadSopenharmony_ci    - Branch wording from draft KHR_sync specification. Remove ability
5115bd8deadSopenharmony_ci      to create "reusable sync objects and all tokens/wording specific
5125bd8deadSopenharmony_ci      to them.
5135bd8deadSopenharmony_ci#19 (Robert Palmer, July 22, 2009)
5145bd8deadSopenharmony_ci    - Replace specific eglCreateSyncKHR error cases for bad <type>
5155bd8deadSopenharmony_ci    argument with extensible catch-all case.
5165bd8deadSopenharmony_ci#18 (Robert Palmer, July 8, 2009)
5175bd8deadSopenharmony_ci    - Issues 8 and 9 declared resolved in EGL meeting 2009-07-08
5185bd8deadSopenharmony_ci#17 (Robert Palmer, July 8, 2009)
5195bd8deadSopenharmony_ci    - Update eglDestroySyncKHR to special-case deletion of fence sync
5205bd8deadSopenharmony_ci      objects.  This is explained in issue 9.
5215bd8deadSopenharmony_ci    - Corrected EGL_REUSABLE_SYNC_KHR -> EGL_SYNC_REUSABLE_KHR
5225bd8deadSopenharmony_ci    - Define value for EGL_SYNC_REUSABLE_KHR
5235bd8deadSopenharmony_ci    - Fix typo and whitespace
5245bd8deadSopenharmony_ci#16 (Jon Leech, July 7, 2009)
5255bd8deadSopenharmony_ci    - Update description of new tokens to match changes to the
5265bd8deadSopenharmony_ci      eglCreateSyncKHR entry point in revision 15.
5275bd8deadSopenharmony_ci#15 (Jon Leech, June 16, 2009)
5285bd8deadSopenharmony_ci    - Define separate one-time fence sync and reusable sync extensions
5295bd8deadSopenharmony_ci      and corresponding extension strings. Remove AUTO_RESET and
5305bd8deadSopenharmony_ci      eglFenceKHR. Rename eglCreateFenceSyncKHR to eglCreateSyncKHR and
5315bd8deadSopenharmony_ci      change initial status of reusable syncs to unsignaled. Clarify
5325bd8deadSopenharmony_ci      which functions apply to which types of sync objects. Update
5335bd8deadSopenharmony_ci      issues list.
5345bd8deadSopenharmony_ci#14 (Jon Leech, April 29, 2009)
5355bd8deadSopenharmony_ci    - Clarify that all waiters are woken up on signalling a sync.
5365bd8deadSopenharmony_ci      Remove tabs to cleanup some formatting issues.
5375bd8deadSopenharmony_ci#13 (Acorn Pooley, April 2, 2009)
5385bd8deadSopenharmony_ci    - Renamed
5395bd8deadSopenharmony_ci        GL_OES_egl_sync -> GL_OES_EGL_sync
5405bd8deadSopenharmony_ci        VG_KHR_egl_sync -> VG_KHR_EGL_sync
5415bd8deadSopenharmony_ci#12 (Jon Leech, April 1, 2009)
5425bd8deadSopenharmony_ci    - Changed sync flags type from EGLuint to EGLint and add issue 7.
5435bd8deadSopenharmony_ci#11 (Acorn Pooley, February 4, 2009)
5445bd8deadSopenharmony_ci    - add error case to eglGetSyncAttribKHR.
5455bd8deadSopenharmony_ci    - fix year on rev 8-10 (2008->2009)
5465bd8deadSopenharmony_ci#10 (Acorn Pooley, February 4, 2009)
5475bd8deadSopenharmony_ci    - clarify some error message descriptions
5485bd8deadSopenharmony_ci#9  (Greg Prisament, January 15, 2009)
5495bd8deadSopenharmony_ci    - Destroy now wakes up all waits (eglClientWaitSyncKHR)
5505bd8deadSopenharmony_ci    - Add EGLDisplay <dpy> as first parameter to all commands
5515bd8deadSopenharmony_ci    - Split into 3 extension strings, EGL_KHR_sync, GL_OES_egl_sync,
5525bd8deadSopenharmony_ci      VG_KHR_egl_sync, all described in this document.
5535bd8deadSopenharmony_ci    - Add attribute AUTO_RESET_KHR
5545bd8deadSopenharmony_ci    - Time type uses the type from khrplatform.h
5555bd8deadSopenharmony_ci    - Remove EGL_ALREADY_SIGNALLED
5565bd8deadSopenharmony_ci#8  (Jon Leech, November 11, 2009)
5575bd8deadSopenharmony_ci   - Assign enum values
5585bd8deadSopenharmony_ci#7   (Acorn Pooley, October 30, 2008)
5595bd8deadSopenharmony_ci   - Fix typos
5605bd8deadSopenharmony_ci   - remove obsolete wording about Native sync objects (see issue 5)
5615bd8deadSopenharmony_ci   - formatting: remove tabs, 80 columns
5625bd8deadSopenharmony_ci#6   (Acorn Pooley, October 27, 2008)
5635bd8deadSopenharmony_ci   - Corrected 'enum' to 'EGLenum' in prototypes.
5645bd8deadSopenharmony_ci#5   (Jon Leech, September 9, 2008)
5655bd8deadSopenharmony_ci   - Removed native sync support (eglCreateNativeSyncKHR and
5665bd8deadSopenharmony_ci     EGL_SYNC_NATIVE_SYNC_KHR), and re-flowed spec to fit in 80 columns.
5675bd8deadSopenharmony_ci#4   (Jon Leech, November 20, 2007)
5685bd8deadSopenharmony_ci   - Corrected 'enum' to 'EGLenum' in prototypes.
5695bd8deadSopenharmony_ci#3   (Jon Leech, April 5, 2007)
5705bd8deadSopenharmony_ci   - Added draft Status and TBD Number
5715bd8deadSopenharmony_ci#2   (November 27, 2006)
5725bd8deadSopenharmony_ci   - Changed OES token to KHR
573