102f4aeb0Sopenharmony_ciName
202f4aeb0Sopenharmony_ci
302f4aeb0Sopenharmony_ci    KHR_lock_surface3
402f4aeb0Sopenharmony_ci
502f4aeb0Sopenharmony_ciName Strings
602f4aeb0Sopenharmony_ci
702f4aeb0Sopenharmony_ci    EGL_KHR_lock_surface3
802f4aeb0Sopenharmony_ci
902f4aeb0Sopenharmony_ciContributors
1002f4aeb0Sopenharmony_ci
1102f4aeb0Sopenharmony_ci    Mark Callow
1202f4aeb0Sopenharmony_ci    Gary King
1302f4aeb0Sopenharmony_ci    Jon Leech
1402f4aeb0Sopenharmony_ci    Marko Lukat
1502f4aeb0Sopenharmony_ci    Alon Or-bach
1602f4aeb0Sopenharmony_ci    Tim Renouf
1702f4aeb0Sopenharmony_ci
1802f4aeb0Sopenharmony_ciContacts
1902f4aeb0Sopenharmony_ci
2002f4aeb0Sopenharmony_ci    Jon Leech (jon 'at' alumni.caltech.edu)
2102f4aeb0Sopenharmony_ci
2202f4aeb0Sopenharmony_ciNotice
2302f4aeb0Sopenharmony_ci
2402f4aeb0Sopenharmony_ci    Copyright (c) 2006-2013 The Khronos Group Inc. Copyright terms at
2502f4aeb0Sopenharmony_ci        http://www.khronos.org/registry/speccopyright.html
2602f4aeb0Sopenharmony_ci
2702f4aeb0Sopenharmony_ciStatus
2802f4aeb0Sopenharmony_ci
2902f4aeb0Sopenharmony_ci    Complete.
3002f4aeb0Sopenharmony_ci    Approved by the EGL Working Group on December 4, 2013.
3102f4aeb0Sopenharmony_ci
3202f4aeb0Sopenharmony_ciVersion
3302f4aeb0Sopenharmony_ci
3402f4aeb0Sopenharmony_ci    Version 4, 2014/09/17 
3502f4aeb0Sopenharmony_ci
3602f4aeb0Sopenharmony_ciNumber
3702f4aeb0Sopenharmony_ci
3802f4aeb0Sopenharmony_ci    EGL Extension #64
3902f4aeb0Sopenharmony_ci
4002f4aeb0Sopenharmony_ciDependencies
4102f4aeb0Sopenharmony_ci
4202f4aeb0Sopenharmony_ci    EGL 1.4 is required.
4302f4aeb0Sopenharmony_ci
4402f4aeb0Sopenharmony_ci    This extension is based on the EGL_KHR_lock_surface2 extension and
4502f4aeb0Sopenharmony_ci    almost all language is copied from that extension. However, it is
4602f4aeb0Sopenharmony_ci    standalone extension. The specification language has been re-based
4702f4aeb0Sopenharmony_ci    against the EGL 1.4 Specification.
4802f4aeb0Sopenharmony_ci
4902f4aeb0Sopenharmony_ci    Khronos recommends obsoleting and replacing implementations of
5002f4aeb0Sopenharmony_ci    EGL_KHR_lock_surface2 and EGL_KHR_lock_surface with this extension as
5102f4aeb0Sopenharmony_ci    soon as possible.
5202f4aeb0Sopenharmony_ci
5302f4aeb0Sopenharmony_ciOverview
5402f4aeb0Sopenharmony_ci
5502f4aeb0Sopenharmony_ci    This extension allows mapping color buffers of EGL surfaces into the
5602f4aeb0Sopenharmony_ci    client address space. This is useful primarily for software
5702f4aeb0Sopenharmony_ci    rendering on low-end devices which do not support EGL client
5802f4aeb0Sopenharmony_ci    rendering APIs, although it may be implemented efficiently on more
5902f4aeb0Sopenharmony_ci    capable devices as well.
6002f4aeb0Sopenharmony_ci
6102f4aeb0Sopenharmony_ci    This extension is functionally identical to EGL_KHR_lock_surface2, but
6202f4aeb0Sopenharmony_ci    is intended to replace that extension. It defines a new EGL type,
6302f4aeb0Sopenharmony_ci    EGLAttribKHR, which is an integer type guaranteed to be large enough to
6402f4aeb0Sopenharmony_ci    hold a pointer. A new surface query, eglQuerySurface64KHR, is defined to
6502f4aeb0Sopenharmony_ci    query surface attributes which may not fit in than EGLint, such as a
6602f4aeb0Sopenharmony_ci    mapped surface pointer.
6702f4aeb0Sopenharmony_ci
6802f4aeb0Sopenharmony_ci    The changes over EGL_KHR_lock_surface2 include:
6902f4aeb0Sopenharmony_ci
7002f4aeb0Sopenharmony_ci      * EGL_KHR_lock_surface3 defines the type EGLAttribKHR and the
7102f4aeb0Sopenharmony_ci        command eglQuerySurface64KHR.
7202f4aeb0Sopenharmony_ci      * eglQuerySurface64KHR must be used to query the
7302f4aeb0Sopenharmony_ci        EGL_BITMAP_POINTER_KHR property of surfaces. 
7402f4aeb0Sopenharmony_ci
7502f4aeb0Sopenharmony_ciNew Types
7602f4aeb0Sopenharmony_ci
7702f4aeb0Sopenharmony_ci    /*
7802f4aeb0Sopenharmony_ci     * EGLAttribKHR is a integer type used to pass arrays of attribute
7902f4aeb0Sopenharmony_ci     * name/value pairs which may include pointer and handle attribute
8002f4aeb0Sopenharmony_ci     * values.
8102f4aeb0Sopenharmony_ci     */
8202f4aeb0Sopenharmony_ci    #include <khrplatform.h>
8302f4aeb0Sopenharmony_ci    typedef intptr_t EGLAttribKHR;
8402f4aeb0Sopenharmony_ci
8502f4aeb0Sopenharmony_ciNew Procedures and Functions
8602f4aeb0Sopenharmony_ci
8702f4aeb0Sopenharmony_ci    EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface,
8802f4aeb0Sopenharmony_ci                                 const EGLint *attrib_list);
8902f4aeb0Sopenharmony_ci    EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy,
9002f4aeb0Sopenharmony_ci                                   EGLSurface surface);
9102f4aeb0Sopenharmony_ci    EGLBoolean eglQuerySurface64KHR(EGLDisplay dpy,
9202f4aeb0Sopenharmony_ci                                    EGLSurface surface,
9302f4aeb0Sopenharmony_ci                                    EGLint attribute,
9402f4aeb0Sopenharmony_ci                                    EGLAttribKHR *value);
9502f4aeb0Sopenharmony_ci
9602f4aeb0Sopenharmony_ciNew Tokens
9702f4aeb0Sopenharmony_ci
9802f4aeb0Sopenharmony_ci    Returned in the EGL_SURFACE_TYPE bitmask attribute of EGLConfigs:
9902f4aeb0Sopenharmony_ci
10002f4aeb0Sopenharmony_ci        EGL_LOCK_SURFACE_BIT_KHR            0x0080
10102f4aeb0Sopenharmony_ci        EGL_OPTIMAL_FORMAT_BIT_KHR          0x0100
10202f4aeb0Sopenharmony_ci
10302f4aeb0Sopenharmony_ci    Accepted as an attribute name in the <attrib_list> argument of
10402f4aeb0Sopenharmony_ci    eglChooseConfig, and the <attribute> argument of eglGetConfigAttrib:
10502f4aeb0Sopenharmony_ci
10602f4aeb0Sopenharmony_ci        EGL_MATCH_FORMAT_KHR                0x3043
10702f4aeb0Sopenharmony_ci
10802f4aeb0Sopenharmony_ci    Accepted as attribute values for the EGL_MATCH_FORMAT_KHR attribute
10902f4aeb0Sopenharmony_ci    of eglChooseConfig, and defined as possible values of that attribute
11002f4aeb0Sopenharmony_ci    when querying it:
11102f4aeb0Sopenharmony_ci
11202f4aeb0Sopenharmony_ci        EGL_FORMAT_RGB_565_EXACT_KHR        0x30C0
11302f4aeb0Sopenharmony_ci        EGL_FORMAT_RGBA_8888_EXACT_KHR      0x30C2
11402f4aeb0Sopenharmony_ci
11502f4aeb0Sopenharmony_ci    Accepted as attribute values for the EGL_MATCH_FORMAT_KHR attribute
11602f4aeb0Sopenharmony_ci    of eglChooseConfig:
11702f4aeb0Sopenharmony_ci
11802f4aeb0Sopenharmony_ci        EGL_FORMAT_RGB_565_KHR              0x30C1
11902f4aeb0Sopenharmony_ci        EGL_FORMAT_RGBA_8888_KHR            0x30C3
12002f4aeb0Sopenharmony_ci
12102f4aeb0Sopenharmony_ci    Accepted as attribute names in the <attrib_list> argument of
12202f4aeb0Sopenharmony_ci    eglLockSurfaceKHR:
12302f4aeb0Sopenharmony_ci
12402f4aeb0Sopenharmony_ci        EGL_MAP_PRESERVE_PIXELS_KHR         0x30C4
12502f4aeb0Sopenharmony_ci        EGL_LOCK_USAGE_HINT_KHR             0x30C5
12602f4aeb0Sopenharmony_ci
12702f4aeb0Sopenharmony_ci    Accepted as bit values in the EGL_LOCK_USAGE_HINT_KHR bitmask attribute
12802f4aeb0Sopenharmony_ci    of eglLockSurfaceKHR:
12902f4aeb0Sopenharmony_ci
13002f4aeb0Sopenharmony_ci        EGL_READ_SURFACE_BIT_KHR            0x0001
13102f4aeb0Sopenharmony_ci        EGL_WRITE_SURFACE_BIT_KHR           0x0002
13202f4aeb0Sopenharmony_ci
13302f4aeb0Sopenharmony_ci    Accepted by the <attribute> parameter of eglQuerySurface and
13402f4aeb0Sopenharmony_ci    eglQuerySurface64KHR:
13502f4aeb0Sopenharmony_ci
13602f4aeb0Sopenharmony_ci        EGL_BITMAP_PITCH_KHR                0x30C7
13702f4aeb0Sopenharmony_ci        EGL_BITMAP_ORIGIN_KHR               0x30C8
13802f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_RED_OFFSET_KHR     0x30C9
13902f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR   0x30CA
14002f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR    0x30CB
14102f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR   0x30CC
14202f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
14302f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_SIZE_KHR           0x3110
14402f4aeb0Sopenharmony_ci
14502f4aeb0Sopenharmony_ci    Accepted by the <attribute> parameter of eglQuerySurface64KHR:
14602f4aeb0Sopenharmony_ci        EGL_BITMAP_POINTER_KHR              0x30C6
14702f4aeb0Sopenharmony_ci
14802f4aeb0Sopenharmony_ci    Returns in the *<value> parameter of eglQuerySurface when
14902f4aeb0Sopenharmony_ci    <attribute> is EGL_BITMAP_ORIGIN_KHR:
15002f4aeb0Sopenharmony_ci
15102f4aeb0Sopenharmony_ci        EGL_LOWER_LEFT_KHR                  0x30CE
15202f4aeb0Sopenharmony_ci        EGL_UPPER_LEFT_KHR                  0x30CF
15302f4aeb0Sopenharmony_ci
15402f4aeb0Sopenharmony_ciAdditions to Chapter 2 of the EGL 1.4 Specification (EGL Operation)
15502f4aeb0Sopenharmony_ci
15602f4aeb0Sopenharmony_ci    Add to the end of section 2.2.2:
15702f4aeb0Sopenharmony_ci
15802f4aeb0Sopenharmony_ci        Finally, some surfaces may be <locked>, which allows the
15902f4aeb0Sopenharmony_ci        implementation to map buffers of that surface into client memory
16002f4aeb0Sopenharmony_ci        for use by software renderers(fn). Locked surfaces cannot be
16102f4aeb0Sopenharmony_ci        used for any other purpose. When a locked surface is <unlocked>,
16202f4aeb0Sopenharmony_ci        any changes to the mapped buffer(s) are reflected in the actual
16302f4aeb0Sopenharmony_ci        graphics or system memory containing the surface.
16402f4aeb0Sopenharmony_ci
16502f4aeb0Sopenharmony_ci           [fn: on implementations not supporting mapping graphics
16602f4aeb0Sopenharmony_ci            memory, or which do not wish to take the stability and
16702f4aeb0Sopenharmony_ci            security risks that entail, mapping may be done using
16802f4aeb0Sopenharmony_ci            copy-out and copy-in behavior.]
16902f4aeb0Sopenharmony_ci
17002f4aeb0Sopenharmony_ciAdditions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
17102f4aeb0Sopenharmony_ci
17202f4aeb0Sopenharmony_ci    Add to the description of the EGL_BAD_ACCESS error in section 3.1:
17302f4aeb0Sopenharmony_ci
17402f4aeb0Sopenharmony_ci       "... (for example, a context is bound in another thread, or a
17502f4aeb0Sopenharmony_ci       surface is locked). Any command accessing ..."
17602f4aeb0Sopenharmony_ci
17702f4aeb0Sopenharmony_ci    Add to table 3.2 ("Types of surfaces supported by an EGLConfig")
17802f4aeb0Sopenharmony_ci
17902f4aeb0Sopenharmony_ci        EGL Token Name              Description
18002f4aeb0Sopenharmony_ci        --------------------        ------------------------------------
18102f4aeb0Sopenharmony_ci        EGL_LOCK_SURFACE_BIT_KHR    EGLConfig allows locking surfaces
18202f4aeb0Sopenharmony_ci        EGL_OPTIMAL_FORMAT_BIT_KHR  This format is considered optimal
18302f4aeb0Sopenharmony_ci                                    (preferred) when locking / mapping /
18402f4aeb0Sopenharmony_ci                                    unlocking is being done.
18502f4aeb0Sopenharmony_ci
18602f4aeb0Sopenharmony_ci    Change the first paragraph under "Other EGLConfig Attribute
18702f4aeb0Sopenharmony_ci    Descriptions" on p. 16:
18802f4aeb0Sopenharmony_ci
18902f4aeb0Sopenharmony_ci       "EGL_SURFACE_TYPE is a mask indicating both the surface types
19002f4aeb0Sopenharmony_ci        that can be created by the corresponding EGLConfig (the config
19102f4aeb0Sopenharmony_ci        is said to <support> those surface types), and the optional
19202f4aeb0Sopenharmony_ci        behaviors such surfaces may allow. The valid bit settings are
19302f4aeb0Sopenharmony_ci        shown in Table 3.2."
19402f4aeb0Sopenharmony_ci
19502f4aeb0Sopenharmony_ci    Add a new paragraph following the second paragraph of the same
19602f4aeb0Sopenharmony_ci    section:
19702f4aeb0Sopenharmony_ci
19802f4aeb0Sopenharmony_ci       "If EGL_LOCK_SURFACE_BIT_KHR is set in EGL_SURFACE_TYPE, then
19902f4aeb0Sopenharmony_ci        a surface created from the EGLConfig may be locked, mapped into
20002f4aeb0Sopenharmony_ci        client memory, and unlocked. Locking is described in section
20102f4aeb0Sopenharmony_ci        3.5.5ls. If EGL_OPTIMAL_FORMAT_BIT_KHR is set in
20202f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE, then the surface is considered optimal (by
20302f4aeb0Sopenharmony_ci        the implementation) from a performance standpoint when buffer
20402f4aeb0Sopenharmony_ci        mapping is being done."
20502f4aeb0Sopenharmony_ci
20602f4aeb0Sopenharmony_ci    Replace the second paragraph of section 3.3 "EGL Versioning":
20702f4aeb0Sopenharmony_ci
20802f4aeb0Sopenharmony_ci       "The EGL_CLIENT_APIS string describes which client rendering APIs are
20902f4aeb0Sopenharmony_ci        supported. It is zero-terminated and contains a space-separated list
21002f4aeb0Sopenharmony_ci        of API names, which must include at least one of ``OpenGL'',
21102f4aeb0Sopenharmony_ci        ``OpenGL_ES'', or OpenGL ES. If no client APIs are supported, then
21202f4aeb0Sopenharmony_ci        the empty string is returned."
21302f4aeb0Sopenharmony_ci
21402f4aeb0Sopenharmony_ci    Insert a new paragraph and table in section 3.4.1.1 "Querying
21502f4aeb0Sopenharmony_ci    Configurations", following the description of
21602f4aeb0Sopenharmony_ci    EGL_MATCH_NATIVE_PIXMAP on page 24:
21702f4aeb0Sopenharmony_ci
21802f4aeb0Sopenharmony_ci       "If EGL_MATCH_FORMAT_KHR is specified in <attrib_list>, it must
21902f4aeb0Sopenharmony_ci        be followed by one of the attribute values EGL_DONT_CARE,
22002f4aeb0Sopenharmony_ci        EGL_NONE, or one of the format tokens in table
22102f4aeb0Sopenharmony_ci        [locksurf.format].
22202f4aeb0Sopenharmony_ci
22302f4aeb0Sopenharmony_ci        When EGL_MATCH_FORMAT_KHR has the value EGL_NONE, only configs
22402f4aeb0Sopenharmony_ci        which cannot be locked or mapped will match. Such configs must
22502f4aeb0Sopenharmony_ci        not have the EGL_LOCK_SURFACE_BIT_KHR set in EGL_SURFACE_TYPE.
22602f4aeb0Sopenharmony_ci
22702f4aeb0Sopenharmony_ci        When EGL_MATCH_FORMAT_KHR has the value EGL_DONT_CARE, it is
22802f4aeb0Sopenharmony_ci        ignored.
22902f4aeb0Sopenharmony_ci
23002f4aeb0Sopenharmony_ci        When EGL_MATCH_FORMAT_KHR has one of the values in table
23102f4aeb0Sopenharmony_ci        [locksurf.format], only EGLConfigs describing surfaces whose
23202f4aeb0Sopenharmony_ci        color buffers have the specified format, when mapped with
23302f4aeb0Sopenharmony_ci        eglLockSurface, will match this attribute. In this case, the
23402f4aeb0Sopenharmony_ci        EGL_<component>_SIZE attributes of resulting configs must agree
23502f4aeb0Sopenharmony_ci        with the specific component sizes specified by the format."
23602f4aeb0Sopenharmony_ci
23702f4aeb0Sopenharmony_ci        Specific Format Name            Description
23802f4aeb0Sopenharmony_ci        --------------------            -----------
23902f4aeb0Sopenharmony_ci        EGL_FORMAT_RGB_565_EXACT_KHR    RGB565 fields in order from MSB to LSB within a 16-bit integer
24002f4aeb0Sopenharmony_ci        EGL_FORMAT_RGB_565_KHR          RGB565 fields in implementation-chosen order within a 16-bit integer
24102f4aeb0Sopenharmony_ci        EGL_FORMAT_RGBA_8888_EXACT_KHR  RGBA8888 fields in B, G, R, A byte order in memory
24202f4aeb0Sopenharmony_ci        EGL_FORMAT_RGBA_8888_KHR        RGBA8888 fields in implementation-chosen order within a 32-bit integer
24302f4aeb0Sopenharmony_ci        ------------------------------------------------------------------------------------------------------
24402f4aeb0Sopenharmony_ci        Table [locksurf.format]: Specific formats for mapped pixels.
24502f4aeb0Sopenharmony_ci
24602f4aeb0Sopenharmony_ci    Add to table 3.4 ("Default values and match critera for EGLConfig
24702f4aeb0Sopenharmony_ci    attributes") on page 25:
24802f4aeb0Sopenharmony_ci
24902f4aeb0Sopenharmony_ci        Attribute            Default         Selection   Sort    Sort
25002f4aeb0Sopenharmony_ci                                             Criteria    Order   Priority
25102f4aeb0Sopenharmony_ci        -------------------- -------------   ---------   -----   --------
25202f4aeb0Sopenharmony_ci        EGL_MATCH_FORMAT_KHR EGL_DONT_CARE   Exact       None    -
25302f4aeb0Sopenharmony_ci
25402f4aeb0Sopenharmony_ci    Add EGL_MATCH_FORMAT_KHR to the last paragraph in section 3.4.1 on
25502f4aeb0Sopenharmony_ci    p. 26, describing attributes not used for sorting EGLConfigs.
25602f4aeb0Sopenharmony_ci
25702f4aeb0Sopenharmony_ci    Add a new paragraph to the end of section 3.4.3 "Querying Configuration
25802f4aeb0Sopenharmony_ci    Attributes":
25902f4aeb0Sopenharmony_ci
26002f4aeb0Sopenharmony_ci       "Querying the EGL_MATCH_FORMAT_KHR attribute results in EGL_NONE
26102f4aeb0Sopenharmony_ci        for an EGLConfig that is not lockable, one of the "exact" formats
26202f4aeb0Sopenharmony_ci        (EGL_FORMAT_RGB_565_EXACT_KHR, EGL_FORMAT_RGBA_8888_EXACT_KHR)
26302f4aeb0Sopenharmony_ci        if the color buffer matches that format when mapped with
26402f4aeb0Sopenharmony_ci        eglLockSurface, or for any other format a value that is not
26502f4aeb0Sopenharmony_ci        EGL_NONE or EGL_DONT_CARE but is otherwise undefined. In particular,
26602f4aeb0Sopenharmony_ci        the color buffer format matching one of the "inexact" formats
26702f4aeb0Sopenharmony_ci        does not guarantee that that EGL_FORMAT_* value is returned."
26802f4aeb0Sopenharmony_ci
26902f4aeb0Sopenharmony_ci    In section 3.5.1 "Creating On-Screen Rendering Surfaces", add to the
27002f4aeb0Sopenharmony_ci    second paragraph on p. 28 listing attributes that can be set in
27102f4aeb0Sopenharmony_ci    attrib_list:
27202f4aeb0Sopenharmony_ci
27302f4aeb0Sopenharmony_ci       "<attrib_list> specifies a list of attributes ... and
27402f4aeb0Sopenharmony_ci       EGL_SWAP_BEHAVIOR."
27502f4aeb0Sopenharmony_ci
27602f4aeb0Sopenharmony_ci    and add preceding the paragraph starting "EGL_VG_COLORSPACE specifies
27702f4aeb0Sopenharmony_ci    ..." on p. 28:
27802f4aeb0Sopenharmony_ci
27902f4aeb0Sopenharmony_ci       "EGL_SWAP_BEHAVIOR specifies the initial value of the
28002f4aeb0Sopenharmony_ci        EGL_SWAP_BEHAVIOR surface attribute (section 3.5.6), and is thus
28102f4aeb0Sopenharmony_ci        either EGL_BUFFER_PRESERVED or EGL_BUFFER_DESTROYED. This setting
28202f4aeb0Sopenharmony_ci        of EGL_SWAP_BEHAVIOR at surface creation time is supported only
28302f4aeb0Sopenharmony_ci        for a lockable surface, i.e. where the EGLConfig has
28402f4aeb0Sopenharmony_ci        EGL_LOCK_SURFACE_BIT_KHR set in EGL_SURFACE_TYPE.
28502f4aeb0Sopenharmony_ci
28602f4aeb0Sopenharmony_ci       "For such a lockable surface, whether it is possible to change
28702f4aeb0Sopenharmony_ci        the EGL_SWAP_BEHAVIOR attribute after surface creation is
28802f4aeb0Sopenharmony_ci        determined by EGL_SWAP_BEHAVIOR_PRESERVED_BIT in the
28902f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE EGLConfig attribute."
29002f4aeb0Sopenharmony_ci
29102f4aeb0Sopenharmony_ci    Add a new section following the current section 3.5.5:
29202f4aeb0Sopenharmony_ci
29302f4aeb0Sopenharmony_ci       "3.5.5ls Locking and Mapping Rendering Surfaces
29402f4aeb0Sopenharmony_ci
29502f4aeb0Sopenharmony_ci        A rendering surface may be <locked> by calling
29602f4aeb0Sopenharmony_ci
29702f4aeb0Sopenharmony_ci            EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy,
29802f4aeb0Sopenharmony_ci                                         EGLSurface surface,
29902f4aeb0Sopenharmony_ci                                         const EGLint *attrib_list);
30002f4aeb0Sopenharmony_ci
30102f4aeb0Sopenharmony_ci        While a surface is locked, only two operations can be performed
30202f4aeb0Sopenharmony_ci        on it. First, a surface attribute may be queried using
30302f4aeb0Sopenharmony_ci        the query commands in section 3.5.6. This includes the case of
30402f4aeb0Sopenharmony_ci        querying EGL_BITMAP_POINTER_KHR, which causes the surface to be
30502f4aeb0Sopenharmony_ci        <mapped> (if not already mapped) and gives a pointer into client
30602f4aeb0Sopenharmony_ci        memory corresponding to the memory of the mapped buffer. Second,
30702f4aeb0Sopenharmony_ci        the surface may be unlocked. Any attempts to use a locked surface
30802f4aeb0Sopenharmony_ci        in other EGL APIs will fail and generate an EGL_BAD_ACCESS error.
30902f4aeb0Sopenharmony_ci
31002f4aeb0Sopenharmony_ci        While a surface is locked, its dimensions (the values of the EGL_WIDTH
31102f4aeb0Sopenharmony_ci        and EGL_HEIGHT surface attributes) do not change. They may change
31202f4aeb0Sopenharmony_ci        at any other time, therefore an application must query these
31302f4aeb0Sopenharmony_ci        attributes <after> the call to eglLockSurfaceKHR to ensure that it has
31402f4aeb0Sopenharmony_ci        the correct size of the mapped buffer.
31502f4aeb0Sopenharmony_ci
31602f4aeb0Sopenharmony_ci        <attrib_list> specifies additional parameters affecting the locking
31702f4aeb0Sopenharmony_ci        operation. The list has the same structure as described for
31802f4aeb0Sopenharmony_ci        eglChooseConfig. Attributes that may be defined are shown in table
31902f4aeb0Sopenharmony_ci        [locksurf.attr], together with their default values if not specified
32002f4aeb0Sopenharmony_ci        in <attrib_list>, and possible values which may be specified for
32102f4aeb0Sopenharmony_ci        them in <attrib_list>.
32202f4aeb0Sopenharmony_ci
32302f4aeb0Sopenharmony_ci        Attribute Name              Type    Default Value              Possible Values
32402f4aeb0Sopenharmony_ci        -----------------------     ------- -------------              -------------------------
32502f4aeb0Sopenharmony_ci        EGL_MAP_PRESERVE_PIXELS_KHR boolean EGL_FALSE                  EGL_TRUE / EGL_FALSE
32602f4aeb0Sopenharmony_ci        EGL_LOCK_USAGE_HINT_KHR     bitmask EGL_READ_SURFACE_BIT_KHR | Any combination of
32702f4aeb0Sopenharmony_ci                                            EGL_WRITE_SURFACE_BIT_KHR  EGL_READ_SURFACE_BIT_KHR
32802f4aeb0Sopenharmony_ci                                                                       and EGL_WRITE_SURFACE_BIT_KHR
32902f4aeb0Sopenharmony_ci        --------------------------------------------------------------
33002f4aeb0Sopenharmony_ci        Table [locksurf.attr]: eglLockSurfaceKHR attribute names,
33102f4aeb0Sopenharmony_ci        default values, and possible values.
33202f4aeb0Sopenharmony_ci
33302f4aeb0Sopenharmony_ci        On failure, the surface is unaffected and eglLockSurfaceKHR
33402f4aeb0Sopenharmony_ci        returns EGL_FALSE. An EGL_BAD_ACCESS error is generated if any
33502f4aeb0Sopenharmony_ci        of these condition, are true:
33602f4aeb0Sopenharmony_ci
33702f4aeb0Sopenharmony_ci          * <surface> was created with an EGLConfig whose
33802f4aeb0Sopenharmony_ci            EGL_SURFACE_TYPE attribute does not contain
33902f4aeb0Sopenharmony_ci            EGL_LOCK_SURFACE_BIT_KHR.
34002f4aeb0Sopenharmony_ci          * <surface> is already locked.
34102f4aeb0Sopenharmony_ci          * Any client API is current to <surface>.
34202f4aeb0Sopenharmony_ci
34302f4aeb0Sopenharmony_ci        An EGL_BAD_ATTRIBUTE error is generated if an attribute or
34402f4aeb0Sopenharmony_ci        attribute value not described in table [locksurf.attr] is
34502f4aeb0Sopenharmony_ci        specified.
34602f4aeb0Sopenharmony_ci
34702f4aeb0Sopenharmony_ci        Mapping Buffers of a Locked Surface
34802f4aeb0Sopenharmony_ci        -----------------------------------
34902f4aeb0Sopenharmony_ci
35002f4aeb0Sopenharmony_ci        The color buffer of a locked surface can be <mapped> by calling
35102f4aeb0Sopenharmony_ci        eglQuerySurface64KHR (see section 3.5.6) with <attribute>
35202f4aeb0Sopenharmony_ci        EGL_BITMAP_POINTER_KHR(fn). The query returns a pointer to a
35302f4aeb0Sopenharmony_ci        buffer in client memory corresponding to the color buffer of
35402f4aeb0Sopenharmony_ci        <surface>. In the case of a back-buffered surface, color buffer
35502f4aeb0Sopenharmony_ci        refers to the back buffer.
35602f4aeb0Sopenharmony_ci
35702f4aeb0Sopenharmony_ci           [fn: "mapped" only means that the pointer returned is
35802f4aeb0Sopenharmony_ci            intended to *correspond* to graphics memory. Implementation
35902f4aeb0Sopenharmony_ci            are not required to return an actual pointer into graphics
36002f4aeb0Sopenharmony_ci            memory, and often will not.]
36102f4aeb0Sopenharmony_ci
36202f4aeb0Sopenharmony_ci
36302f4aeb0Sopenharmony_ci        The contents of the mapped buffer are initially undefined(fn)
36402f4aeb0Sopenharmony_ci        unless either the EGL_MAP_PRESERVE_PIXELS_KHR attribute of
36502f4aeb0Sopenharmony_ci        eglLockSurfaceKHR is set to EGL_TRUE, or (for a window surface)
36602f4aeb0Sopenharmony_ci        the EGL_SWAP_BEHAVIOR surface attribute is set to
36702f4aeb0Sopenharmony_ci        EGL_BUFFER_PRESERVE, in which case the contents
36802f4aeb0Sopenharmony_ci        of the buffer are taken from the contents of <surface>'s color
36902f4aeb0Sopenharmony_ci        buffer. The default value of EGL_MAP_PRESERVE_PIXELS_KHR is
37002f4aeb0Sopenharmony_ci        EGL_FALSE.
37102f4aeb0Sopenharmony_ci
37202f4aeb0Sopenharmony_ci           [fn: In order to avoid pipeline stalls and readback delays on
37302f4aeb0Sopenharmony_ci            accelerated implementations, we do not mandate that the
37402f4aeb0Sopenharmony_ci            current contents of a color buffer appear when it's mapped
37502f4aeb0Sopenharmony_ci            to client memory, unless the EGL_MAP_PRESERVE_PIXELS_KHR
37602f4aeb0Sopenharmony_ci            flag is set or (for a window surface) EGL_SWAP_BEHAVIOR is
37702f4aeb0Sopenharmony_ci            set to EGL_BUFFER_PRESERVE. Applications using mapped
37802f4aeb0Sopenharmony_ci            buffers which are not
37902f4aeb0Sopenharmony_ci            preserved must write to every pixel of the buffer before
38002f4aeb0Sopenharmony_ci            unlocking the surface. This constraint is considered
38102f4aeb0Sopenharmony_ci            acceptable for the intended usage scenario (full-frame
38202f4aeb0Sopenharmony_ci            software renderers). Such an application may lock-render-unlock 
38302f4aeb0Sopenharmony_ci            multiple times per frame (i.e. per eglSwapBuffers) by setting
38402f4aeb0Sopenharmony_ci            EGL_MAP_PRESERVE_PIXELS_KHR to EGL_TRUE for the second and
38502f4aeb0Sopenharmony_ci            subsequent locks.
38602f4aeb0Sopenharmony_ci
38702f4aeb0Sopenharmony_ci            Note that EGL_SWAP_BEHAVIOR also controls whether the color
38802f4aeb0Sopenharmony_ci            buffer contents are preserved over a call to eglSwapBuffers.]
38902f4aeb0Sopenharmony_ci
39002f4aeb0Sopenharmony_ci        The EGL_LOCK_USAGE_HINT_KHR attribute of eglLockSurfaceKHR is a
39102f4aeb0Sopenharmony_ci        bitmask describing the intended use of the mapped buffer. If the
39202f4aeb0Sopenharmony_ci        mask contains EGL_READ_SURFACE_BIT_KHR, data will be read from
39302f4aeb0Sopenharmony_ci        the mapped buffer. If the mask contains
39402f4aeb0Sopenharmony_ci        EGL_WRITE_SURFACE_BIT_KHR, data will be written to the mapped
39502f4aeb0Sopenharmony_ci        buffer. Implementations must support both reading and writing to
39602f4aeb0Sopenharmony_ci        a mapped buffer regardless of the value of
39702f4aeb0Sopenharmony_ci        EGL_LOCK_USAGE_HINT_KHR, but performance may be better if the
39802f4aeb0Sopenharmony_ci        hint is consistent with the actual usage of the buffer. The
39902f4aeb0Sopenharmony_ci        default value of EGL_LOCK_USAGE_HINT_KHR hints that both reads
40002f4aeb0Sopenharmony_ci        and writes to the mapped buffer will be done.
40102f4aeb0Sopenharmony_ci
40202f4aeb0Sopenharmony_ci        Other attributes of the mapped buffer describe the format of
40302f4aeb0Sopenharmony_ci        pixels it contains, including its pitch (EGL_BITMAP_PITCH_KHR),
40402f4aeb0Sopenharmony_ci        origin (EGL_BITMAP_ORIGIN_KHR), and the bit location of each color
40502f4aeb0Sopenharmony_ci        component within a pixel (EGL_BITMAP_PIXEL_x_OFFSET_KHR). These
40602f4aeb0Sopenharmony_ci        attributes may be queried using eglQuerySurface, and are described
40702f4aeb0Sopenharmony_ci        in more detail in section 3.5.6.
40802f4aeb0Sopenharmony_ci
40902f4aeb0Sopenharmony_ci        The EGL_BITMAP_POINTER_KHR and EGL_BITMAP_PITCH_KHR attributes
41002f4aeb0Sopenharmony_ci        of a locked surface may change following successive calls to
41102f4aeb0Sopenharmony_ci        eglLockSurfaceKHR(fn), so they must be queried each time a
41202f4aeb0Sopenharmony_ci        buffer is mapped. Other attributes of a mapped buffer (listed in
41302f4aeb0Sopenharmony_ci        the paragraph above) are invariant and need be queried only once
41402f4aeb0Sopenharmony_ci        following surface creation.
41502f4aeb0Sopenharmony_ci
41602f4aeb0Sopenharmony_ci           [fn: The pointer and pitch of a mapped buffer may change due
41702f4aeb0Sopenharmony_ci            to display mode changes, for example.]
41802f4aeb0Sopenharmony_ci
41902f4aeb0Sopenharmony_ci        Mapping will not suceed if client memory to map the surface into
42002f4aeb0Sopenharmony_ci        cannot be allocated. In this case, calling eglQuerySurface64KHR
42102f4aeb0Sopenharmony_ci        with <attribute> EGL_BITMAP_POINTER_KHR will fail and generate an
42202f4aeb0Sopenharmony_ci        EGL error.
42302f4aeb0Sopenharmony_ci
42402f4aeb0Sopenharmony_ci        Unlocking Surfaces
42502f4aeb0Sopenharmony_ci        ------------------
42602f4aeb0Sopenharmony_ci
42702f4aeb0Sopenharmony_ci        A rendering surface may be <unlocked> by calling
42802f4aeb0Sopenharmony_ci
42902f4aeb0Sopenharmony_ci            EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy,
43002f4aeb0Sopenharmony_ci                                           EGLSurface surface);
43102f4aeb0Sopenharmony_ci
43202f4aeb0Sopenharmony_ci        Any mapped buffers of <surface> become unmapped following
43302f4aeb0Sopenharmony_ci        eglUnlockSurfaceKHR. Any changes made to mapped buffers of
43402f4aeb0Sopenharmony_ci        <surface> which it was locked are reflected in the surface after
43502f4aeb0Sopenharmony_ci        unlocking(fn).
43602f4aeb0Sopenharmony_ci
43702f4aeb0Sopenharmony_ci           [fn: This language enables implementations to either map
43802f4aeb0Sopenharmony_ci            video memory, or copy from a separate buffer in client
43902f4aeb0Sopenharmony_ci            memory.]
44002f4aeb0Sopenharmony_ci
44102f4aeb0Sopenharmony_ci        If <surface> was created with an EGLConfig whose
44202f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE attribute contains EGL_OPTIMAL_FORMAT_BIT_KHR,
44302f4aeb0Sopenharmony_ci        then the surface is considered optimal (by the implementation)
44402f4aeb0Sopenharmony_ci        from a performance standpoint when buffer mapping is being
44502f4aeb0Sopenharmony_ci        done(fn).
44602f4aeb0Sopenharmony_ci
44702f4aeb0Sopenharmony_ci           [fn: This often means that the format of all mapped buffers
44802f4aeb0Sopenharmony_ci            corresponds directly to the format of those buffers in
44902f4aeb0Sopenharmony_ci            <surface>, so no format conversions are required during
45002f4aeb0Sopenharmony_ci            unmapping. This results in a high-performance software
45102f4aeb0Sopenharmony_ci            rendering path. But "optimal format" is really just a hint
45202f4aeb0Sopenharmony_ci            from EGL that this config is preferred, whatever the actual
45302f4aeb0Sopenharmony_ci            reason.]
45402f4aeb0Sopenharmony_ci
45502f4aeb0Sopenharmony_ci        On failure, eglUnlockSurfaceKHR returns EGL_FALSE. An
45602f4aeb0Sopenharmony_ci        EGL_BAD_ACCESS error is generated if any of these conditions are
45702f4aeb0Sopenharmony_ci        true:
45802f4aeb0Sopenharmony_ci
45902f4aeb0Sopenharmony_ci          * <surface> is already unlocked.
46002f4aeb0Sopenharmony_ci          * A display mode change occurred while the surface was locked,
46102f4aeb0Sopenharmony_ci            and the implementation was unable to reflect mapped buffer
46202f4aeb0Sopenharmony_ci            state(fn). In this case, <surface> will still be unlocked.
46302f4aeb0Sopenharmony_ci            However, the contents of the previously mapped buffers of
46402f4aeb0Sopenharmony_ci            <surface> become undefined, rather than reflecting changes
46502f4aeb0Sopenharmony_ci            made in the mapped buffers in client memory.
46602f4aeb0Sopenharmony_ci
46702f4aeb0Sopenharmony_ci           [fn: Usually this may only occur with window surfaces which
46802f4aeb0Sopenharmony_ci            have been mapped. EGL does not have an event mechanism to
46902f4aeb0Sopenharmony_ci            indicate display mode changes. If such a mechanism exists
47002f4aeb0Sopenharmony_ci            (using native platform events or the OpenKODE event system),
47102f4aeb0Sopenharmony_ci            applications should respond to mode changes by regenerating
47202f4aeb0Sopenharmony_ci            all visible window content, including re-doing any software
47302f4aeb0Sopenharmony_ci            rendering overlapping the mode change.]"
47402f4aeb0Sopenharmony_ci
47502f4aeb0Sopenharmony_ci    Modify table 3.5 ("Queryable surface attributes and types")
47602f4aeb0Sopenharmony_ci    to add a new column "64-bit". Add new entries to table 3.5:
47702f4aeb0Sopenharmony_ci
47802f4aeb0Sopenharmony_ci        Attribute               Type    Description                 64-bit
47902f4aeb0Sopenharmony_ci        ---------               ------- --------------------------  ---------
48002f4aeb0Sopenharmony_ci        EGL_BITMAP_POINTER_KHR  pointer Address of a mapped color   [checked]
48102f4aeb0Sopenharmony_ci                                        buffer (MCB).
48202f4aeb0Sopenharmony_ci        EGL_BITMAP_PITCH_KHR    integer Number of bytes between     -
48302f4aeb0Sopenharmony_ci                                        the start of adjacent rows 
48402f4aeb0Sopenharmony_ci                                        in an MCB.
48502f4aeb0Sopenharmony_ci        EGL_BITMAP_ORIGIN_KHR   enum    Bitmap origin & direction   -
48602f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_x_-    integer Bit location of each color  -
48702f4aeb0Sopenharmony_ci          OFFSET_KHR                    buffer component within a 
48802f4aeb0Sopenharmony_ci                                        pixel in an MCB.
48902f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_-      integer Bits per pixel              -
49002f4aeb0Sopenharmony_ci          SIZE_KHR
49102f4aeb0Sopenharmony_ci
49202f4aeb0Sopenharmony_ci    All previously existing entries in table 3.5 are given a "-" entry in
49302f4aeb0Sopenharmony_ci    the new "64-bit" column.
49402f4aeb0Sopenharmony_ci
49502f4aeb0Sopenharmony_ci    In the description of eglSurfaceAttrib properties that can be set in
49602f4aeb0Sopenharmony_ci    section 3.5.6, add to the description of EGL_SWAP_BEHAVIOR:
49702f4aeb0Sopenharmony_ci
49802f4aeb0Sopenharmony_ci       "It <attribute> is EGL_SWAP_BEHAVIOR ... The value of
49902f4aeb0Sopenharmony_ci        EGL_SWAP_BEHAVIOR also affects the semantics of eglLockSurfaceKHR
50002f4aeb0Sopenharmony_ci        for a lockable window surface. See section 3.5.6."
50102f4aeb0Sopenharmony_ci
50202f4aeb0Sopenharmony_ci    And modify the paragraph descirbing the initial value of
50302f4aeb0Sopenharmony_ci    EGL_SWAP_BEHAVIOR:
50402f4aeb0Sopenharmony_ci
50502f4aeb0Sopenharmony_ci       "The initial value of EGL_SWAP_BEHAVIOR is chosen by the
50602f4aeb0Sopenharmony_ci        implementation, except for a lockable window surface (i.e. where the
50702f4aeb0Sopenharmony_ci        EGLConfig has both EGL_LOCK_SURFACE_BIT_KHR and EGL_WINDOW_BIT set in
50802f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE). For a lockable window surface the default is
50902f4aeb0Sopenharmony_ci        EGL_BUFFER_PRESERVED, but it may be overridden by specifying
51002f4aeb0Sopenharmony_ci        EGL_SWAP_BEHAVIOR to eglCreateWindowSurface."
51102f4aeb0Sopenharmony_ci
51202f4aeb0Sopenharmony_ci    Add the prototype of the new surface query function immediately
51302f4aeb0Sopenharmony_ci    following the prototype for eglQuerySurface on p. 37:
51402f4aeb0Sopenharmony_ci
51502f4aeb0Sopenharmony_ci        EGLBoolean eglQuerySurface64KHR(EGLDisplay dpy,
51602f4aeb0Sopenharmony_ci                                        EGLSurface surface,
51702f4aeb0Sopenharmony_ci                                        EGLint attribute,
51802f4aeb0Sopenharmony_ci                                        EGLAttribKHR *value)
51902f4aeb0Sopenharmony_ci
52002f4aeb0Sopenharmony_ci    Modify the following paragraph:
52102f4aeb0Sopenharmony_ci
52202f4aeb0Sopenharmony_ci       "eglQuerySurface and eglQuerySurface64KHR return in <value> the
52302f4aeb0Sopenharmony_ci        value of <attribute> for <surface>. <attribute> must be set to one
52402f4aeb0Sopenharmony_ci        of the attributes in table 3.5. Attributes whose ``64-bit'' entry
52502f4aeb0Sopenharmony_ci        is checked in table 3.5 may only be queried with
52602f4aeb0Sopenharmony_ci        eglQuerySurface64KHR."
52702f4aeb0Sopenharmony_ci
52802f4aeb0Sopenharmony_ci    Add to the description of eglQuerySurface properties on p. 38:
52902f4aeb0Sopenharmony_ci
53002f4aeb0Sopenharmony_ci       "Properties of a bitmap surface which may be queried include:
53102f4aeb0Sopenharmony_ci          * EGL_BITMAP_POINTER_KHR, which maps the color buffer of a
53202f4aeb0Sopenharmony_ci            locked surface and returns the address in client memory of
53302f4aeb0Sopenharmony_ci            the mapped buffer.
53402f4aeb0Sopenharmony_ci          * EGL_BITMAP_PITCH_KHR, which returns the number of bytes
53502f4aeb0Sopenharmony_ci            between successive rows of a mapped buffer.
53602f4aeb0Sopenharmony_ci          * EGL_BITMAP_ORIGIN_KHR, which describes the way in which a
53702f4aeb0Sopenharmony_ci            mapped color buffer is displayed on the screen. Possible
53802f4aeb0Sopenharmony_ci            values are either EGL_LOWER_LEFT_KHR or EGL_UPPER_LEFT_KHR,
53902f4aeb0Sopenharmony_ci            indicating that the first pixel of the mapped buffer
54002f4aeb0Sopenharmony_ci            corresponds to the lower left or upper left of a visible
54102f4aeb0Sopenharmony_ci            window, respectively.
54202f4aeb0Sopenharmony_ci          * EGL_BITMAP_PIXEL_<x>_OFFSET_KHR, which describes the bit
54302f4aeb0Sopenharmony_ci            location of the least significant bit of each color
54402f4aeb0Sopenharmony_ci            component of a pixel within a mapped buffer. <x> is one of
54502f4aeb0Sopenharmony_ci            RED, GREEN, BLUE, ALPHA, or LUMINANCE.
54602f4aeb0Sopenharmony_ci
54702f4aeb0Sopenharmony_ci            The offset for a color component should be treated as the
54802f4aeb0Sopenharmony_ci            number of bits to left shift the component value to place it
54902f4aeb0Sopenharmony_ci            within a n-bit
55002f4aeb0Sopenharmony_ci            integer containing the pixel, where n is the number of bits
55102f4aeb0Sopenharmony_ci            per pixel. If a color
55202f4aeb0Sopenharmony_ci            component does not exist in the mapped buffer, then the bit
55302f4aeb0Sopenharmony_ci            offset of that component is zero. If a color component
55402f4aeb0Sopenharmony_ci            does exist but not in a single contiguous range of bits,
55502f4aeb0Sopenharmony_ci            then the value of the attribute is EGL_UNKNOWN.
55602f4aeb0Sopenharmony_ci
55702f4aeb0Sopenharmony_ci          * EGL_BITMAP_PIXEL_SIZE_KHR, which returns the number of bits
55802f4aeb0Sopenharmony_ci            per pixel, assumed to be least significant leftmost if there
55902f4aeb0Sopenharmony_ci            are multiple pixels per byte. The attribute takes the value
56002f4aeb0Sopenharmony_ci            EGL_UNKNOWN if this assumption is not true, or if pixels are not
56102f4aeb0Sopenharmony_ci            laid out left to right in memory (for example pairs of 16-bit
56202f4aeb0Sopenharmony_ci            pixels are swapped in memory).
56302f4aeb0Sopenharmony_ci
56402f4aeb0Sopenharmony_ci        In addition to these attributes, the number of bits for each
56502f4aeb0Sopenharmony_ci        color component of a pixel within a mapped buffer is obtained by
56602f4aeb0Sopenharmony_ci        querying the EGL_<x>_SIZE attribute of the EGLConfig used to
56702f4aeb0Sopenharmony_ci        create the surface, where <x> is <x> is one of RED, GREEN, BLUE,
56802f4aeb0Sopenharmony_ci        ALPHA, or LUMINANCE.
56902f4aeb0Sopenharmony_ci
57002f4aeb0Sopenharmony_ci        Querying EGL_BITMAP_POINTER_KHR and EGL_BITMAP_PITCH_KHR is only
57102f4aeb0Sopenharmony_ci        allowed when <surface> is mapped (see section 3.5.5ls). Querying
57202f4aeb0Sopenharmony_ci        either of these attributes for the first time after calling
57302f4aeb0Sopenharmony_ci        eglLockSurfaceKHR causes the color buffer of the locked surface
57402f4aeb0Sopenharmony_ci        to be mapped. Querying them again before unlocking the surface
57502f4aeb0Sopenharmony_ci        will return the same values as the first time. However, after
57602f4aeb0Sopenharmony_ci        calling eglUnlockSurfaceKHR, these properties become undefined.
57702f4aeb0Sopenharmony_ci        After a second call to eglLockSurfaceKHR, these properties may
57802f4aeb0Sopenharmony_ci        again be queried, but their values may have changed.
57902f4aeb0Sopenharmony_ci
58002f4aeb0Sopenharmony_ci        Other properties of the mapped color buffer of a surface
58102f4aeb0Sopenharmony_ci        (in the list above) are
58202f4aeb0Sopenharmony_ci        invariant, and need be queried only once following surface
58302f4aeb0Sopenharmony_ci        creation. If <surface> was created with an EGLConfig whose
58402f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE attribute does not contain
58502f4aeb0Sopenharmony_ci        EGL_LOCK_SURFACE_BIT_KHR, queries of EGL_BITMAP_ORIGIN_KHR,
58602f4aeb0Sopenharmony_ci        EGL_BITMAP_PIXEL_<x>_OFFSET_KHR and EGL_BITMAP_PIXEL_SIZE_KHR
58702f4aeb0Sopenharmony_ci        return undefined values."
58802f4aeb0Sopenharmony_ci
58902f4aeb0Sopenharmony_ci    Add to the description of eglQuerySurface errors in the last
59002f4aeb0Sopenharmony_ci    paragraph of section 3.5.6:
59102f4aeb0Sopenharmony_ci
59202f4aeb0Sopenharmony_ci       "eglQuerySurface and eglQuerySurface64KHR return EGL_FALSE on
59302f4aeb0Sopenharmony_ci        failure ... If <attribute> is one of the attributes whose
59402f4aeb0Sopenharmony_ci        ``64-bit'' entry is checked in table 3.5, then an
59502f4aeb0Sopenharmony_ci        EGL_BAD_ATTRIBUTE error is generated if eglQuerySurface is called;
59602f4aeb0Sopenharmony_ci        only eglQuerySurface64KHR is allowed for such attributes. If
59702f4aeb0Sopenharmony_ci        <attribute> is either EGL_BITMAP_POINTER_KHR or
59802f4aeb0Sopenharmony_ci        EGL_BITMAP_PITCH_KHR, and either <surface> is not locked using
59902f4aeb0Sopenharmony_ci        eglLockSurfaceKHR, or <surface> is locked but mapping fails, then
60002f4aeb0Sopenharmony_ci        an EGL_BAD_ACCESS error is generated. "
60102f4aeb0Sopenharmony_ci
60202f4aeb0Sopenharmony_ci    In section 3.9.3 Posting Semantics on page 53, append to the first
60302f4aeb0Sopenharmony_ci    paragraph:
60402f4aeb0Sopenharmony_ci
60502f4aeb0Sopenharmony_ci       "<surface> must be bound to the calling thread's current context
60602f4aeb0Sopenharmony_ci        ... This restriction does not apply to lockable surfaces; for such
60702f4aeb0Sopenharmony_ci        a surface, eglSwapBuffers and eglCopyBuffers may be called for a
60802f4aeb0Sopenharmony_ci        surface not bound to any client API context(fn).
60902f4aeb0Sopenharmony_ci
61002f4aeb0Sopenharmony_ci           [fn: Normally this would only be done when using methods other
61102f4aeb0Sopenharmony_ci            than client API rendering to specify the color buffer contents,
61202f4aeb0Sopenharmony_ci            such as software rendering to a locked surface.]"
61302f4aeb0Sopenharmony_ci
61402f4aeb0Sopenharmony_ci    Replace the second paragraph ("If <dpy> and <surface> ... not be
61502f4aeb0Sopenharmony_ci    executed until posting is completed.") with:
61602f4aeb0Sopenharmony_ci
61702f4aeb0Sopenharmony_ci       "If <surface> is bound to a current client API context for the calling
61802f4aeb0Sopenharmony_ci        thread, eglSwapBuffers and eglCopyBuffers perform an implicit flush
61902f4aeb0Sopenharmony_ci        operation on the context (glFlush for an OpenGL or OpenGL ES context,
62002f4aeb0Sopenharmony_ci        vgFlush for an OpenVG context). Subsequent client API commands can be
62102f4aeb0Sopenharmony_ci        issued immediately, but will not be executed until posting is
62202f4aeb0Sopenharmony_ci        completed.
62302f4aeb0Sopenharmony_ci
62402f4aeb0Sopenharmony_ci        If <surface> is current to a client API context in any thread other
62502f4aeb0Sopenharmony_ci        than the calling thread, eglSwapBuffers and eglCopyBuffers will fail.
62602f4aeb0Sopenharmony_ci
62702f4aeb0Sopenharmony_ci    Append following the prototype for eglSwapInterval:
62802f4aeb0Sopenharmony_ci
62902f4aeb0Sopenharmony_ci       "specifies the minimum number of video frame periods ... The swap
63002f4aeb0Sopenharmony_ci        interval has no effect on eglSwapBuffers for a surface not bound
63102f4aeb0Sopenharmony_ci        to a current client API context."
63202f4aeb0Sopenharmony_ci
63302f4aeb0Sopenharmony_ci    In 3.9.4 Posting Errors, change the first paragraph:
63402f4aeb0Sopenharmony_ci
63502f4aeb0Sopenharmony_ci       "eglSwapBuffers and eglCopyBuffers return EGL_FALSE on failure. If
63602f4aeb0Sopenharmony_ci        <surface> is not a valid EGL surface, an EGL_BAD_SURFACE error is
63702f4aeb0Sopenharmony_ci        generated. If <surface> is bound to a current context in a thread
63802f4aeb0Sopenharmony_ci        other than the calling thread, an EGL_BAD_SURFACE error is
63902f4aeb0Sopenharmony_ci        generated." If <target> is not a valid native pixmap handle ..."
64002f4aeb0Sopenharmony_ci
64102f4aeb0Sopenharmony_ciSample Code
64202f4aeb0Sopenharmony_ci
64302f4aeb0Sopenharmony_ci    None
64402f4aeb0Sopenharmony_ci
64502f4aeb0Sopenharmony_ciConformance Tests
64602f4aeb0Sopenharmony_ci
64702f4aeb0Sopenharmony_ci    None yet
64802f4aeb0Sopenharmony_ci
64902f4aeb0Sopenharmony_ciIssues
65002f4aeb0Sopenharmony_ci
65102f4aeb0Sopenharmony_ci    The issues lists of EGL_KHR_lock_surface and EGL_KHR_lock_surface2 also
65202f4aeb0Sopenharmony_ci    apply to this extension. In addition, issues related only to the reason
65302f4aeb0Sopenharmony_ci    for defining the EGLAttribKHR and interfaces using that type may be
65402f4aeb0Sopenharmony_ci    found in issues 1-3 of the EGL_KHR_cl_event2 extension specification.
65502f4aeb0Sopenharmony_ci
65602f4aeb0Sopenharmony_ci    1) Is this extension backwards-compatible with EGL_KHR_lock_surface2?
65702f4aeb0Sopenharmony_ci
65802f4aeb0Sopenharmony_ci    RESOLVED: No. Querying the bitmap pointer must be done with the new
65902f4aeb0Sopenharmony_ci    command eglQuerySurface64KHR when using this extension, to guide
66002f4aeb0Sopenharmony_ci    developers down the right path even when writing 32-bit code.
66102f4aeb0Sopenharmony_ci
66202f4aeb0Sopenharmony_ci    However, if both lock_surface2 and this extension are supported, it is
66302f4aeb0Sopenharmony_ci    possible to query the bitmap pointer using older calls, with the risk
66402f4aeb0Sopenharmony_ci    that executing such code on a 64-bit platform will probably fail.
66502f4aeb0Sopenharmony_ci
66602f4aeb0Sopenharmony_ciRevision History
66702f4aeb0Sopenharmony_ci
66802f4aeb0Sopenharmony_ci    Version 4, 2014/09/17 (Jon Leech) - Fix bogus return type for
66902f4aeb0Sopenharmony_ci    eglQuerySurface64KHR in New Functions section.
67002f4aeb0Sopenharmony_ci
67102f4aeb0Sopenharmony_ci    Version 3, 20130/12/04 (Jon Leech) - Minor cleanup for public release.
67202f4aeb0Sopenharmony_ci    Change formal parameter names from 'display' to 'dpy' to match other EGL
67302f4aeb0Sopenharmony_ci    APIs.
67402f4aeb0Sopenharmony_ci
67502f4aeb0Sopenharmony_ci    Version 2, 20130/10/16 (Jon Leech) - add Dependencies and Overview text
67602f4aeb0Sopenharmony_ci    noting that this extension obsoletes and should replace
67702f4aeb0Sopenharmony_ci    EGL_KHR_lock_surface2 and EGL_KHR_lock_surface.
67802f4aeb0Sopenharmony_ci
67902f4aeb0Sopenharmony_ci    Version 1, 2013/10/15 - Branched from approved EGL_KHR_lock_surface2.
680