102f4aeb0Sopenharmony_ciName
202f4aeb0Sopenharmony_ci
302f4aeb0Sopenharmony_ci  EXT_compositor
402f4aeb0Sopenharmony_ci
502f4aeb0Sopenharmony_ciName Strings
602f4aeb0Sopenharmony_ci
702f4aeb0Sopenharmony_ci  EGL_EXT_compositor
802f4aeb0Sopenharmony_ci
902f4aeb0Sopenharmony_ciContributors
1002f4aeb0Sopenharmony_ci
1102f4aeb0Sopenharmony_ci  Marc Moody
1202f4aeb0Sopenharmony_ci  Daniel Herring
1302f4aeb0Sopenharmony_ci
1402f4aeb0Sopenharmony_ciContacts
1502f4aeb0Sopenharmony_ci  
1602f4aeb0Sopenharmony_ci  Marc Moody, Boeing Inc., marc dot d dot moody at boeing dot com
1702f4aeb0Sopenharmony_ci  Daniel Herring, Core Avionics & Industrial Inc., daniel dot herring at ch1group dot com
1802f4aeb0Sopenharmony_ci
1902f4aeb0Sopenharmony_ciStatus
2002f4aeb0Sopenharmony_ci
2102f4aeb0Sopenharmony_ci  Complete
2202f4aeb0Sopenharmony_ci
2302f4aeb0Sopenharmony_ciVersion
2402f4aeb0Sopenharmony_ci  Version 1.0, February 3, 2017
2502f4aeb0Sopenharmony_ci
2602f4aeb0Sopenharmony_ciNumber
2702f4aeb0Sopenharmony_ci
2802f4aeb0Sopenharmony_ci  EGL Extension #116
2902f4aeb0Sopenharmony_ci
3002f4aeb0Sopenharmony_ciDependencies
3102f4aeb0Sopenharmony_ci
3202f4aeb0Sopenharmony_ci  Requires EGL 1.0.
3302f4aeb0Sopenharmony_ci
3402f4aeb0Sopenharmony_ci  This extension is written against the wording of the EGL 1.4
3502f4aeb0Sopenharmony_ci  Specification - April 6, 2011, but may be implemented against earlier
3602f4aeb0Sopenharmony_ci  versions.
3702f4aeb0Sopenharmony_ci
3802f4aeb0Sopenharmony_ciOverview
3902f4aeb0Sopenharmony_ci
4002f4aeb0Sopenharmony_ci  This extension allows for the composition of multiple windows within
4102f4aeb0Sopenharmony_ci  a multi-partition EGL system. The extension allows a primary EGLContext and
4202f4aeb0Sopenharmony_ci  window to be created for each display. All other windows are created using
4302f4aeb0Sopenharmony_ci  non-displayable surfaces. A handle to each off-screen window is provided
4402f4aeb0Sopenharmony_ci  to the primary EGLContext to allow the composition of all non-displayable windows
4502f4aeb0Sopenharmony_ci  on a single display.
4602f4aeb0Sopenharmony_ci
4702f4aeb0Sopenharmony_ci  For each display, there is one EGLContext which has access to create on screen
4802f4aeb0Sopenharmony_ci  windows, this is call the primary context for this display. All other EGLContexts
4902f4aeb0Sopenharmony_ci  are referred to as secondary contexts.
5002f4aeb0Sopenharmony_ci
5102f4aeb0Sopenharmony_ci  This extension requires a multi-partition EGL driver to support asynchronous
5202f4aeb0Sopenharmony_ci  rendering of off screen surfaces.
5302f4aeb0Sopenharmony_ci
5402f4aeb0Sopenharmony_ci  Information assurance is provided by preventing context and surface creation by
5502f4aeb0Sopenharmony_ci  unregistered contexts and by preventing the non-primary contexts and surfaces
5602f4aeb0Sopenharmony_ci  from rendering to the display.
5702f4aeb0Sopenharmony_ci
5802f4aeb0Sopenharmony_ciNew Types
5902f4aeb0Sopenharmony_ci
6002f4aeb0Sopenharmony_ci  None
6102f4aeb0Sopenharmony_ci
6202f4aeb0Sopenharmony_ciNew Procedures and Functions
6302f4aeb0Sopenharmony_ci
6402f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetContextListEXT (const EGLint *external_ref_ids,
6502f4aeb0Sopenharmony_ci                                                EGLint num_entries);
6602f4aeb0Sopenharmony_ci
6702f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetContextAttributesEXT (EGLint external_ref_id,
6802f4aeb0Sopenharmony_ci                                       const EGLint *context_attributes,
6902f4aeb0Sopenharmony_ci                                       EGLint num_entries);
7002f4aeb0Sopenharmony_ci
7102f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetWindowListEXT (EGLint external_ref_id,
7202f4aeb0Sopenharmony_ci                                        const EGLint *external_win_ids,
7302f4aeb0Sopenharmony_ci                                        EGLint num_entries);
7402f4aeb0Sopenharmony_ci
7502f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetWindowAttributesEXT (EGLint external_win_id,
7602f4aeb0Sopenharmony_ci                                       const EGLint *window_attributes,
7702f4aeb0Sopenharmony_ci                                       EGLint num_entries);
7802f4aeb0Sopenharmony_ci
7902f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorBindTexWindowEXT (EGLint external_win_id);
8002f4aeb0Sopenharmony_ci
8102f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetSizeEXT (EGLint external_win_id,
8202f4aeb0Sopenharmony_ci                                      EGLint width, EGLint height);
8302f4aeb0Sopenharmony_ci
8402f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSwapPolicyEXT (EGLint external_win_id,
8502f4aeb0Sopenharmony_ci                                              EGLint policy);
8602f4aeb0Sopenharmony_ci
8702f4aeb0Sopenharmony_ci
8802f4aeb0Sopenharmony_ciNew Tokens
8902f4aeb0Sopenharmony_ci
9002f4aeb0Sopenharmony_ci  New attributes accepted by the <attrib_list> argument of
9102f4aeb0Sopenharmony_ci  eglCreateContext:
9202f4aeb0Sopenharmony_ci
9302f4aeb0Sopenharmony_ci    EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT     0x3460
9402f4aeb0Sopenharmony_ci
9502f4aeb0Sopenharmony_ci  New attributes accepted by the <attrib_list> argument of
9602f4aeb0Sopenharmony_ci  eglCreateContext and eglCreateWindowSurface:
9702f4aeb0Sopenharmony_ci
9802f4aeb0Sopenharmony_ci    EGL_EXTERNAL_REF_ID_EXT                0x3461
9902f4aeb0Sopenharmony_ci
10002f4aeb0Sopenharmony_ci  New attributes accepted by the <policy> argument of
10102f4aeb0Sopenharmony_ci  eglCompositorSwapPolicyHint:
10202f4aeb0Sopenharmony_ci
10302f4aeb0Sopenharmony_ci    EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT   0x3462
10402f4aeb0Sopenharmony_ci
10502f4aeb0Sopenharmony_ci    EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT   0x3463
10602f4aeb0Sopenharmony_ci
10702f4aeb0Sopenharmony_ciModify Section 3.7.1 of the EGL 1.4 Specification, paragraph 2
10802f4aeb0Sopenharmony_ci (Creating Rendering Contexts) on pg. 43
10902f4aeb0Sopenharmony_ci  From:
11002f4aeb0Sopenharmony_ci  If eglCreateContext succeeds, it initializes the context to the initial state defined
11102f4aeb0Sopenharmony_ci  for the current rendering API, and returns a handle to it. The context can be
11202f4aeb0Sopenharmony_ci  used to render to any compatible EGLSurface.
11302f4aeb0Sopenharmony_ci
11402f4aeb0Sopenharmony_ci  To:
11502f4aeb0Sopenharmony_ci  If eglCreateContext succeeds, it initializes the context to the initial state defined
11602f4aeb0Sopenharmony_ci  for the current rendering API, and returns a handle to it. The context can be
11702f4aeb0Sopenharmony_ci  used to render to any compatible off-screen rendering surface (Sections 3.5.2
11802f4aeb0Sopenharmony_ci  and 3.5.4). A secondary context can be used to render to compatible window surfaces
11902f4aeb0Sopenharmony_ci  which have been associated with the context using eglCompositorSetWindowListEXT. A
12002f4aeb0Sopenharmony_ci  non-secondary context can be used to render to any compatible EGLSurface.
12102f4aeb0Sopenharmony_ci
12202f4aeb0Sopenharmony_ciModify Section 3.7.1 of EGL 1.4 Specification, paragraph 5
12302f4aeb0Sopenharmony_ci (Creating Rendering Contexts) on pg. 43
12402f4aeb0Sopenharmony_ci  From:
12502f4aeb0Sopenharmony_ci  attrib_list specifies a list of attributes for the context. The list has the same
12602f4aeb0Sopenharmony_ci  structure as described for eglChooseConfig. The only attribute that can be specified
12702f4aeb0Sopenharmony_ci  in attrib_list is EGL_CONTEXT_CLIENT_VERSION, and this attribute may only
12802f4aeb0Sopenharmony_ci  be specified when creating a OpenGL ES context (e.g. when the current rendering
12902f4aeb0Sopenharmony_ci  API is EGL_OPENGL_ES_API).
13002f4aeb0Sopenharmony_ci
13102f4aeb0Sopenharmony_ci  To:
13202f4aeb0Sopenharmony_ci  attrib_list specifies a list of attributes for the context. The list has the same
13302f4aeb0Sopenharmony_ci  structure as described for eglChooseConfig. The attributes that can be specified
13402f4aeb0Sopenharmony_ci  in attrib_list are EGL_CONTEXT_CLIENT_VERSION, EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT,
13502f4aeb0Sopenharmony_ci  EGL_EXTERNAL_REF_ID_EXT.
13602f4aeb0Sopenharmony_ci
13702f4aeb0Sopenharmony_ciModify Section 3.7.1 of EGL 1.4 Specification, paragraph 7
13802f4aeb0Sopenharmony_ci (Creating Rendering Contexts) on pg. 43
13902f4aeb0Sopenharmony_ci  From:
14002f4aeb0Sopenharmony_ci  EGL_CONTEXT_CLIENT_VERSION determines which version of an OpenGL
14102f4aeb0Sopenharmony_ci  ES context to create. An attribute value of 1 specifies creation of an OpenGL ES
14202f4aeb0Sopenharmony_ci  1.x context. An attribute value of 2 specifies creation of an OpenGL ES 2.x context.
14302f4aeb0Sopenharmony_ci  The default value for EGL_CONTEXT_CLIENT_VERSION is 1.
14402f4aeb0Sopenharmony_ci
14502f4aeb0Sopenharmony_ci  To:
14602f4aeb0Sopenharmony_ci  EGL_CONTEXT_CLIENT_VERSION determines which version of an OpenGL
14702f4aeb0Sopenharmony_ci  ES context to create. An attribute value of 1 specifies creation of an OpenGL ES
14802f4aeb0Sopenharmony_ci  1.x context. An attribute value of 2 specifies creation of an OpenGL ES 2.x context.
14902f4aeb0Sopenharmony_ci  The default value for EGL_CONTEXT_CLIENT_VERSION is 1. EGL_CONTEXT_CLIENT_VERSION
15002f4aeb0Sopenharmony_ci  may only be specified when creating a OpenGL ES context (e.g. when the current
15102f4aeb0Sopenharmony_ci  rendering API is EGL_OPENGL_ES_API).
15202f4aeb0Sopenharmony_ci
15302f4aeb0Sopenharmony_ciAdditions to Section 3.7.1 of the EGL 1.4 Specification (Creating Rendering Contexts).
15402f4aeb0Sopenharmony_ci
15502f4aeb0Sopenharmony_ci  The first call to eglCreateContext with EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT
15602f4aeb0Sopenharmony_ci  set as EGL_TRUE in the <attrib-list> returns an EGLContext handle which will
15702f4aeb0Sopenharmony_ci  act as the primary context for the specified EGLDisplay. This shall be the
15802f4aeb0Sopenharmony_ci  only context on this EGLDisplay which is able to be bound to an on-screen window
15902f4aeb0Sopenharmony_ci  on the EGLDisplay. Subsequent calls to eglCreateContext, for the same display,
16002f4aeb0Sopenharmony_ci  in any address space with EGL_PRIMIARY_COMPOSITOR_CONTEXT_EXT set as EGL_TRUE
16102f4aeb0Sopenharmony_ci  shall return EGL_NO_CONTEXT.
16202f4aeb0Sopenharmony_ci  Subsequent calls, in any address space for the same display, to eglCreateContext
16302f4aeb0Sopenharmony_ci  which do not use EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT should use the the attribute
16402f4aeb0Sopenharmony_ci  EGL_EXTERNAL_REF_ID_EXT and an external reference identifier to create a valid
16502f4aeb0Sopenharmony_ci  EGLContext.
16602f4aeb0Sopenharmony_ci  Subsequent calls, in any address space for the same display, to eglCreateContext
16702f4aeb0Sopenharmony_ci  which do not use EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT and do not use
16802f4aeb0Sopenharmony_ci  EGL_EXTERNAL_REF_ID_EXT shall not create a context and shall return
16902f4aeb0Sopenharmony_ci  EGL_NO_CONTEXT and set the error EGL_BAD_ACCESS.
17002f4aeb0Sopenharmony_ci
17102f4aeb0Sopenharmony_ci  EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT notifies EGL that this context is the only
17202f4aeb0Sopenharmony_ci  context allowed to render to a on screen window surface for this display. This
17302f4aeb0Sopenharmony_ci  attribute is followed in the attribute list by either EGL_TRUE or EGL_FALSE.
17402f4aeb0Sopenharmony_ci  EGL_EXTERNAL_REF_ID_EXT is followed by an external reference identifier which
17502f4aeb0Sopenharmony_ci  associates this context with the list of allowed contexts set by
17602f4aeb0Sopenharmony_ci  eglCompositorSetContextListEXT. If the reference identifier has already been
17702f4aeb0Sopenharmony_ci  used to initiate another call to eglCreateContext in any address space, this
17802f4aeb0Sopenharmony_ci  call shall fail and set the error EGL_BAD_ATTRIBUTE. IF the external reference
17902f4aeb0Sopenharmony_ci  identifier is not a valid identifier the error EGL_BAD_ATTRIBUTE shall be set
18002f4aeb0Sopenharmony_ci  and the call shall fail. If this attribute is set and the primary context has
18102f4aeb0Sopenharmony_ci  not yet been created then the error EGL_BAD_MATCH and the call shall fail.
18202f4aeb0Sopenharmony_ci
18302f4aeb0Sopenharmony_ci  Only when the attributes specified via attrib_list and those specified for this
18402f4aeb0Sopenharmony_ci  context using eglCompositorSetContextAttributesEXT are compatible will the
18502f4aeb0Sopenharmony_ci  context be successfully created.
18602f4aeb0Sopenharmony_ci
18702f4aeb0Sopenharmony_ciModify the list of parameters supported by eglCreateWindowSurface in section 3.5.1
18802f4aeb0Sopenharmony_ci (Creating On-Screen Rendering Surfaces) on p. 27:
18902f4aeb0Sopenharmony_ci
19002f4aeb0Sopenharmony_ci  An external window identifier (EGLuint external_win_id) is associated with
19102f4aeb0Sopenharmony_ci  each off screen window. EGLNativeWindowType shall be EGLint and the
19202f4aeb0Sopenharmony_ci  external window identifier shall be used as the value for the <win> parameter.
19302f4aeb0Sopenharmony_ci  EGL_EXTERNAL_REF_ID_EXT with the context external reference id shall be in the
19402f4aeb0Sopenharmony_ci  attrib_list. If the external window identifier and the external reference identifier
19502f4aeb0Sopenharmony_ci  do not match a pair set using eglCompositorSetWindowListEXT window creation shall
19602f4aeb0Sopenharmony_ci  fail.
19702f4aeb0Sopenharmony_ci
19802f4aeb0Sopenharmony_ciAdd the function: 
19902f4aeb0Sopenharmony_ci
20002f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetContextListEXT(const EGLint *external_ref_ids,
20102f4aeb0Sopenharmony_ci                                            EGLint num_entries);
20202f4aeb0Sopenharmony_ci
20302f4aeb0Sopenharmony_ci    This function is called by the primary context to establish the set of
20402f4aeb0Sopenharmony_ci    all allowable secondary contexts by defining the set of external reference
20502f4aeb0Sopenharmony_ci    identifiers. Secondary contexts shall identify their external reference
20602f4aeb0Sopenharmony_ci    identifier by setting the EGL_EXTERNAL_REF_ID_EXT attribute when calling
20702f4aeb0Sopenharmony_ci    eglCreateContext.
20802f4aeb0Sopenharmony_ci    Calls to this function when the primary context for the display is not active,
20902f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing. When this function is successful it
21002f4aeb0Sopenharmony_ci    shall return EGL_TRUE and associate the list of external reference identifiers
21102f4aeb0Sopenharmony_ci    with the active display.
21202f4aeb0Sopenharmony_ci    This function shall only be called once per primary context. Subsequent calls
21302f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing.
21402f4aeb0Sopenharmony_ci
21502f4aeb0Sopenharmony_ci    external_ref_ids shall be an array of user generated integers greater than 1.
21602f4aeb0Sopenharmony_ci    num_entries shall specify the number of external_ref_ids.
21702f4aeb0Sopenharmony_ci
21802f4aeb0Sopenharmony_ciAdd the function:
21902f4aeb0Sopenharmony_ci
22002f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetContextAttributesEXT (EGLint external_ref_id,
22102f4aeb0Sopenharmony_ci                                     const EGLint *context_attributes,
22202f4aeb0Sopenharmony_ci                                     EGLint num_entries);
22302f4aeb0Sopenharmony_ci
22402f4aeb0Sopenharmony_ci    This function is called by the primary context to establish a list of compatible
22502f4aeb0Sopenharmony_ci    context attributes.
22602f4aeb0Sopenharmony_ci    Calls to this function when the primary context for the display is not active
22702f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing. When the function is successful it shall
22802f4aeb0Sopenharmony_ci    return EGL_TRUE and associate the given attributes to the subsequent
22902f4aeb0Sopenharmony_ci    eglCreateContext call using the given external reference id.
23002f4aeb0Sopenharmony_ci    The list of acceptable context_attributes is the same as the list for
23102f4aeb0Sopenharmony_ci    eglCreateContext. Only when this list of attributes is compatible with those
23202f4aeb0Sopenharmony_ci    used during context creation will the secondary context be created.
23302f4aeb0Sopenharmony_ci    This function shall only be called once per secondary context, and must be called
23402f4aeb0Sopenharmony_ci    before the secondary context is able to be created. Subsequent calls shall
23502f4aeb0Sopenharmony_ci    return EGL_FALSE and do nothing.
23602f4aeb0Sopenharmony_ci
23702f4aeb0Sopenharmony_ci    num_entries shall specify the number of attributes in the list. This number
23802f4aeb0Sopenharmony_ci     shall prevent accessing memory outside the attribute list, even if EGL_NONE is
23902f4aeb0Sopenharmony_ci     not yet found in the list. If EGL_NONE is found sooner than this number of
24002f4aeb0Sopenharmony_ci     attributes list parsing shall stop.
24102f4aeb0Sopenharmony_ci
24202f4aeb0Sopenharmony_ciAdd the function:
24302f4aeb0Sopenharmony_ci
24402f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetWindowListEXT (EGLint external_ref_id,
24502f4aeb0Sopenharmony_ci                                      const EGLint *external_win_ids,
24602f4aeb0Sopenharmony_ci                                      EGLint num_entries);
24702f4aeb0Sopenharmony_ci
24802f4aeb0Sopenharmony_ci    This function is called by the primary context to establish the set of
24902f4aeb0Sopenharmony_ci    all allowable windows associated with a specific secondary context by defining
25002f4aeb0Sopenharmony_ci    the set of external window identifiers. Window surface creation within secondary
25102f4aeb0Sopenharmony_ci    contexts use the external window identifier as the native window handle parameter
25202f4aeb0Sopenharmony_ci    of eglCreateWindowSurface and supply an external reference id as a window creation
25302f4aeb0Sopenharmony_ci    attribute.
25402f4aeb0Sopenharmony_ci    Calls to this function when the primary context for the display is not active,
25502f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing. When this function is successful it
25602f4aeb0Sopenharmony_ci    shall return EGL_TRUE and associate the list of external window identifiers
25702f4aeb0Sopenharmony_ci    with the specified secondary context (external_ref_ids).
25802f4aeb0Sopenharmony_ci
25902f4aeb0Sopenharmony_ci    external_win_ids shall be an array of user generated integers greater than 1.
26002f4aeb0Sopenharmony_ci     external window identifiers are unique within the primary EGLContext. Any
26102f4aeb0Sopenharmony_ci     external window identifier may be associated with multiple secondary contexts
26202f4aeb0Sopenharmony_ci     however only the first context which calls eglCreateWindowSurface shall
26302f4aeb0Sopenharmony_ci     successfully create a window surface for the given window.
26402f4aeb0Sopenharmony_ci    num_entries shall specify the number of external_ref_ids.
26502f4aeb0Sopenharmony_ci
26602f4aeb0Sopenharmony_ciAdd the function:
26702f4aeb0Sopenharmony_ci
26802f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetWindowAttributesEXT (EGLint external_win_id,
26902f4aeb0Sopenharmony_ci                                     const EGLint *window_attributes,
27002f4aeb0Sopenharmony_ci                                     EGLint num_entries);
27102f4aeb0Sopenharmony_ci
27202f4aeb0Sopenharmony_ci    This function is called by the primary context to set window specific attributes
27302f4aeb0Sopenharmony_ci    for the specified external window id.
27402f4aeb0Sopenharmony_ci
27502f4aeb0Sopenharmony_ci    The list of valid attributes are: EGL_WIDTH, EGL_HEIGHT, EGL_VERTICAL_RESOLUTION,
27602f4aeb0Sopenharmony_ci    EGL_HORIZONRAL_RESOLUTION, EGL_PIXEL_ASPECT_RATIO.
27702f4aeb0Sopenharmony_ci    EGL_WIDTH and EGL_HEIGHT shall set the maximum width and height the secondary
27802f4aeb0Sopenharmony_ci    context is able to create a window surface with.
27902f4aeb0Sopenharmony_ci    EGL_VERTICAL_RESOLUTION, EGL_HORIZONTAL_RESOLUTION, and EGL_PIXEL_ASPECT_RATIO
28002f4aeb0Sopenharmony_ci    shall set the values of these used by the secondary context.
28102f4aeb0Sopenharmony_ci    Calls to this function when the primary context for the display is not active,
28202f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing. When this function is successful it
28302f4aeb0Sopenharmony_ci    shall return EGL_TRUE and associate the list of attributes with the off screen
28402f4aeb0Sopenharmony_ci    window ID (external_win_id).
28502f4aeb0Sopenharmony_ci    This function shall only be called once per window, and must be called before
28602f4aeb0Sopenharmony_ci    the secondary context is able to create the window surface. Subsequent calls
28702f4aeb0Sopenharmony_ci    shall return EGL_FALSE and do nothing.
28802f4aeb0Sopenharmony_ci
28902f4aeb0Sopenharmony_ci    num_entries shall specify the number of attributes in the list. This number
29002f4aeb0Sopenharmony_ci    shall prevent accessing memory outside the attribute list, even if EGL_NONE is
29102f4aeb0Sopenharmony_ci    not yet found in the list. If EGL_NONE is found sooner than this number of
29202f4aeb0Sopenharmony_ci    attributes list parsing shall stop.
29302f4aeb0Sopenharmony_ci
29402f4aeb0Sopenharmony_ciAdd the function:
29502f4aeb0Sopenharmony_ci
29602f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorBindTexWindowEXT (EGLint external_win_id);
29702f4aeb0Sopenharmony_ci
29802f4aeb0Sopenharmony_ci    This function is similar to eglBindTexImage in that it binds the windows
29902f4aeb0Sopenharmony_ci    color buffers to a texture object which can then be composited on the native
30002f4aeb0Sopenharmony_ci    window by the primary context. This function shall only be callable within
30102f4aeb0Sopenharmony_ci    the primary context while there is a texture object actively bound by the
30202f4aeb0Sopenharmony_ci    native rendering API. The function shall return EGL_TRUE if the window is
30302f4aeb0Sopenharmony_ci    successfully bound to the active texture object. The function shall return
30402f4aeb0Sopenharmony_ci    EGL_FALSE if binding fails, the context is not the primary context, or the
30502f4aeb0Sopenharmony_ci    external_win_id is not a valid external window reference as set using
30602f4aeb0Sopenharmony_ci    eglCompositorSetWindowListEXT.
30702f4aeb0Sopenharmony_ci
30802f4aeb0Sopenharmony_ciAdd the function:
30902f4aeb0Sopenharmony_ci
31002f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSetSizeEXT(EGLint external_win_id,
31102f4aeb0Sopenharmony_ci                                         EGLint width, EGLint height);
31202f4aeb0Sopenharmony_ci
31302f4aeb0Sopenharmony_ci    This function shall be called by the primary context to set the width and
31402f4aeb0Sopenharmony_ci    height of the window. This function returns EGL_FALSE when called by a context
31502f4aeb0Sopenharmony_ci    other than the primary context. This function will also return EGL_FALSE if
31602f4aeb0Sopenharmony_ci    the new width and height are larger than the maximums set by
31702f4aeb0Sopenharmony_ci    eglCompositorSetWindowAttributesEXT. Upon successful window resizing the function
31802f4aeb0Sopenharmony_ci    shall return EGL_TRUE.
31902f4aeb0Sopenharmony_ci    Secondary contexts may use EGL to query the windows width and height at runtime
32002f4aeb0Sopenharmony_ci    to detect window resize events. The window buffer resizing shall be applied
32102f4aeb0Sopenharmony_ci    to the newly active buffer after the secondary context calls eglSwapBuffers.
32202f4aeb0Sopenharmony_ci    This will leave an average of 2 buffers which will have to be scaled by the
32302f4aeb0Sopenharmony_ci    native rendering API to the new resolution.
32402f4aeb0Sopenharmony_ci
32502f4aeb0Sopenharmony_ciAdd the function:
32602f4aeb0Sopenharmony_ci
32702f4aeb0Sopenharmony_ci  EGLBoolean eglCompositorSwapPolicyEXT(EGLint external_win_id,
32802f4aeb0Sopenharmony_ci                                             EGLint policy);
32902f4aeb0Sopenharmony_ci
33002f4aeb0Sopenharmony_ci    This function shall be called by the primary context to specify the handling
33102f4aeb0Sopenharmony_ci    of buffer swaps of the context specified by external_ref_id.
33202f4aeb0Sopenharmony_ci
33302f4aeb0Sopenharmony_ci    When the policy is set to EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT, and the
33402f4aeb0Sopenharmony_ci    secondary context completes a frame by calling eglSwapbuffers, and the
33502f4aeb0Sopenharmony_ci    primary context is actively reading from the front buffer associated with
33602f4aeb0Sopenharmony_ci    the external window ID, then the just completed frame is dropped, no buffer
33702f4aeb0Sopenharmony_ci    swap occurs, and eglSwapBuffers will return EGL_TRUE.
33802f4aeb0Sopenharmony_ci    If EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT is specified and the primary context
33902f4aeb0Sopenharmony_ci    is actively reading from the front buffer associated with the external window
34002f4aeb0Sopenharmony_ci    ID then the secondary context's call to eglSwapBuffers will return EGL_FALSE.
34102f4aeb0Sopenharmony_ci    eglSwapBuffers will continue to return EGL_FALSE as long as the primary context
34202f4aeb0Sopenharmony_ci    is actively reading from the front buffer. Once the primary context finishes
34302f4aeb0Sopenharmony_ci    reading from the front buffer the next call to eglSwapBuffers will
34402f4aeb0Sopenharmony_ci    return EGL_TRUE. It is up to the application to decide if it will wait until
34502f4aeb0Sopenharmony_ci    eglSwapBuffers returns EGL_TRUE before rendering again. If the secondary
34602f4aeb0Sopenharmony_ci    context continues to render after eglSwapBuffers returns EGL_FALSE then it will
34702f4aeb0Sopenharmony_ci    be as if the swap policy was EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT.
34802f4aeb0Sopenharmony_ci
34902f4aeb0Sopenharmony_ci
35002f4aeb0Sopenharmony_ciRevision History
35102f4aeb0Sopenharmony_ci  Version 0.1, 30/08/2014 - first draft.
35202f4aeb0Sopenharmony_ci  Version 0.2, 24/09/2014  second draft.
35302f4aeb0Sopenharmony_ci  Version 0.3, 21/12/2016
35402f4aeb0Sopenharmony_ci     Khronos vendor extension clean-up.
35502f4aeb0Sopenharmony_ci  Version 0.4, 05/01/2016
35602f4aeb0Sopenharmony_ci   - Change from context and display limitation to context and window limitations
35702f4aeb0Sopenharmony_ci   - Added additional functions related to external window ids contexts.
35802f4aeb0Sopenharmony_ci  Version 1.0, 03/02/2017
35902f4aeb0Sopenharmony_ci   - Fixed misc issues related to parameter names and types. 
36002f4aeb0Sopenharmony_ci
36102f4aeb0Sopenharmony_ciQuestion: How are external reference and window IDs assigned and managed? Are they
36202f4aeb0Sopenharmony_ci          reserved somehow within a new EGL C header file?
36302f4aeb0Sopenharmony_ciAnswer:   External IDs are assigned from the software component with the primary
36402f4aeb0Sopenharmony_ci          context during an EGL initialization stage using eglCompositorSet*ListEXT.
36502f4aeb0Sopenharmony_ci          The secondary contexts are provided the appropriate external reference ID
36602f4aeb0Sopenharmony_ci          during end system integration. It is recommended that these values be able
36702f4aeb0Sopenharmony_ci          to be set via a configuration parameter to the application, to ease 
36802f4aeb0Sopenharmony_ci          integration of multiple programs.
36902f4aeb0Sopenharmony_ci
37002f4aeb0Sopenharmony_ciQuestion: What happens when the secondary contexts render faster than the
37102f4aeb0Sopenharmony_ci          primary context?
37202f4aeb0Sopenharmony_ciAnswer:   This is based on the swap policy set by the compositor, and the rate
37302f4aeb0Sopenharmony_ci          difference between the render and the compositor. Secondary contexts
37402f4aeb0Sopenharmony_ci          will be notified by EGL_FALSE being returned if the windows front buffer
37502f4aeb0Sopenharmony_ci          is currently being read by the compositor. However, if the compositor is
37602f4aeb0Sopenharmony_ci          not currently reading the front buffer the swap will succeed and the
37702f4aeb0Sopenharmony_ci          secondary contexts latest rendered frame will now be in the front buffer
37802f4aeb0Sopenharmony_ci          to be composited.
37902f4aeb0Sopenharmony_ci
38002f4aeb0Sopenharmony_ciQuestion: What happens when the primary context renders faster than the
38102f4aeb0Sopenharmony_ci          secondary context(s)?
38202f4aeb0Sopenharmony_ciAnswer:   The contents of the windows front buffer will be repeated.
38302f4aeb0Sopenharmony_ci
38402f4aeb0Sopenharmony_ciQuestion: Does this infer any Z-ordering for the off-screen surfaces?
38502f4aeb0Sopenharmony_ciAnswer:   No, the Z-order is applied by the compositor when doing the final on
38602f4aeb0Sopenharmony_ci          screen rendering of the off-screen surfaces. Or may be set if a Z-ordering
38702f4aeb0Sopenharmony_ci          extension is applied to the attribute list of the window using
38802f4aeb0Sopenharmony_ci          eglCompositorSetWindowAttributesEXT
38902f4aeb0Sopenharmony_ci
39002f4aeb0Sopenharmony_ciComments: 
39102f4aeb0Sopenharmony_ci
39202f4aeb0Sopenharmony_ciThe driver should also have to have enough protection in it to prevent a random
39302f4aeb0Sopenharmony_cisoftware component from passing random buffer handles to the driver to prevent
39402f4aeb0Sopenharmony_ciaccess to other software components.
39502f4aeb0Sopenharmony_ci
39602f4aeb0Sopenharmony_ciThe driver may force use of double buffering event if the window surface was created
39702f4aeb0Sopenharmony_ciusing an EGL_RENDER_BUFFER attribute set to EGL_SINGLE_BUFFER.
39802f4aeb0Sopenharmony_ci
39902f4aeb0Sopenharmony_ciIf EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT is not used to create a context for a specified
40002f4aeb0Sopenharmony_cidisplay then EGL will act as though this extension is not enabled.
401