102f4aeb0Sopenharmony_ciName
202f4aeb0Sopenharmony_ci
302f4aeb0Sopenharmony_ci    EXT_yuv_surface
402f4aeb0Sopenharmony_ci
502f4aeb0Sopenharmony_ciName Strings
602f4aeb0Sopenharmony_ci
702f4aeb0Sopenharmony_ci    EGL_EXT_yuv_surface
802f4aeb0Sopenharmony_ci
902f4aeb0Sopenharmony_ciContributors
1002f4aeb0Sopenharmony_ci
1102f4aeb0Sopenharmony_ci    Matt Trusten
1202f4aeb0Sopenharmony_ci    Jeff Vigil
1302f4aeb0Sopenharmony_ci    Arshad Bebal
1402f4aeb0Sopenharmony_ci    Mohan Maiya
1502f4aeb0Sopenharmony_ci    Amit Bansal
1602f4aeb0Sopenharmony_ci    Tom Longo
1702f4aeb0Sopenharmony_ci    Eric Engestrom
1802f4aeb0Sopenharmony_ci
1902f4aeb0Sopenharmony_ciContacts
2002f4aeb0Sopenharmony_ci
2102f4aeb0Sopenharmony_ci    Jeff Vigil, Qualcomm (jvigil 'at' qualcomm.com)
2202f4aeb0Sopenharmony_ci
2302f4aeb0Sopenharmony_ciNotice
2402f4aeb0Sopenharmony_ci
2502f4aeb0Sopenharmony_ci    Copyright (c) 2014 Qualcomm Technologies, Inc. All Rights Reserved.
2602f4aeb0Sopenharmony_ci    Qualcomm Technologies Proprietary and Confidential
2702f4aeb0Sopenharmony_ci
2802f4aeb0Sopenharmony_ciStatus
2902f4aeb0Sopenharmony_ci
3002f4aeb0Sopenharmony_ci    Complete
3102f4aeb0Sopenharmony_ci
3202f4aeb0Sopenharmony_ciVersion
3302f4aeb0Sopenharmony_ci
3402f4aeb0Sopenharmony_ci    Version 9, May 4th, 2017
3502f4aeb0Sopenharmony_ci
3602f4aeb0Sopenharmony_ciNumber
3702f4aeb0Sopenharmony_ci
3802f4aeb0Sopenharmony_ci    EGL Extension #86
3902f4aeb0Sopenharmony_ci
4002f4aeb0Sopenharmony_ciDependencies
4102f4aeb0Sopenharmony_ci
4202f4aeb0Sopenharmony_ci    EGL 1.4 is required.
4302f4aeb0Sopenharmony_ci
4402f4aeb0Sopenharmony_ci    This extension is written against the wording of the EGL 1.4
4502f4aeb0Sopenharmony_ci    Specification.
4602f4aeb0Sopenharmony_ci
4702f4aeb0Sopenharmony_ciOverview
4802f4aeb0Sopenharmony_ci
4902f4aeb0Sopenharmony_ci    This extension defines a set of new EGL configuration attributes and values
5002f4aeb0Sopenharmony_ci    which allows EGL to create and use YUV surfaces.
5102f4aeb0Sopenharmony_ci
5202f4aeb0Sopenharmony_ci    YUV formats can be described using a few simple parameters, and every format
5302f4aeb0Sopenharmony_ci    can be given with these six parameters. These parameters include the color
5402f4aeb0Sopenharmony_ci    order, the number of planes, subsample, plane depth, color conversion and
5502f4aeb0Sopenharmony_ci    depth range.
5602f4aeb0Sopenharmony_ci
5702f4aeb0Sopenharmony_ci    This extension describes how EGL will handle YUV surfaces, but requires that
5802f4aeb0Sopenharmony_ci    the client API describe how to fill such a surface. An example of such an
5902f4aeb0Sopenharmony_ci    extension would be GL_EXT_yuv_target.
6002f4aeb0Sopenharmony_ci
6102f4aeb0Sopenharmony_ciNew Types
6202f4aeb0Sopenharmony_ci
6302f4aeb0Sopenharmony_ci    None
6402f4aeb0Sopenharmony_ci
6502f4aeb0Sopenharmony_ciNew Procedures and Functions
6602f4aeb0Sopenharmony_ci
6702f4aeb0Sopenharmony_ci    None
6802f4aeb0Sopenharmony_ci
6902f4aeb0Sopenharmony_ciNew Tokens
7002f4aeb0Sopenharmony_ci
7102f4aeb0Sopenharmony_ci    A new set of EGLConfig attributes are available:
7202f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_EXT                               0x3301
7302f4aeb0Sopenharmony_ci        EGL_YUV_NUMBER_OF_PLANES_EXT                    0x3311
7402f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_EXT                           0x3312
7502f4aeb0Sopenharmony_ci        EGL_YUV_DEPTH_RANGE_EXT                         0x3317
7602f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_EXT                        0x330A
7702f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_EXT                           0x331A
7802f4aeb0Sopenharmony_ci
7902f4aeb0Sopenharmony_ci    Accepted as a new value for the EGL_COLOR_BUFFER_TYPE attribute:
8002f4aeb0Sopenharmony_ci        EGL_YUV_BUFFER_EXT                              0x3300
8102f4aeb0Sopenharmony_ci
8202f4aeb0Sopenharmony_ci    Accepted values for the EGL_YUV_ORDER_EXT attribute:
8302f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_YUV_EXT                           0x3302
8402f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_YVU_EXT                           0x3303
8502f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_YUYV_EXT                          0x3304
8602f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_UYVY_EXT                          0x3305
8702f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_YVYU_EXT                          0x3306
8802f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_VYUY_EXT                          0x3307
8902f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_AYUV_EXT                          0x3308
9002f4aeb0Sopenharmony_ci
9102f4aeb0Sopenharmony_ci    Accepted values for the EGL_YUV_SUBSAMPLE_EXT attribute:
9202f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_2_0_EXT                     0x3313
9302f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_2_2_EXT                     0x3314
9402f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_4_4_EXT                     0x3315
9502f4aeb0Sopenharmony_ci
9602f4aeb0Sopenharmony_ci    Accepted values for the EGL_YUV_DEPTH_RANGE_EXT attribute:
9702f4aeb0Sopenharmony_ci        EGL_YUV_DEPTH_RANGE_LIMITED_EXT                 0x3318
9802f4aeb0Sopenharmony_ci        EGL_YUV_DEPTH_RANGE_FULL_EXT                    0x3319
9902f4aeb0Sopenharmony_ci
10002f4aeb0Sopenharmony_ci    Accepted values for the EGL_YUV_CSC_STANDARD_EXT attribute:
10102f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_601_EXT                    0x330B
10202f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_709_EXT                    0x330C
10302f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_2020_EXT                   0x330D
10402f4aeb0Sopenharmony_ci
10502f4aeb0Sopenharmony_ci    Accepted values for the EGL_YUV_PLANE_BPP_EXT attribute:
10602f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_0_EXT                         0x331B
10702f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_8_EXT                         0x331C
10802f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_10_EXT                        0x331D
10902f4aeb0Sopenharmony_ci
11002f4aeb0Sopenharmony_ciAdditions to Chapter 2 of the EGL 1.4 Specification (EGL Operation)
11102f4aeb0Sopenharmony_ci
11202f4aeb0Sopenharmony_ciChange the options of paragraph 6 from section 2.2: Rendering Contexts and
11302f4aeb0Sopenharmony_ciDrawing Surfaces
11402f4aeb0Sopenharmony_ci
11502f4aeb0Sopenharmony_ci    A context can be used with any EGLSurface that it is compatible with
11602f4aeb0Sopenharmony_ci    (subject to the restrictions discussed in the section on address space). A
11702f4aeb0Sopenharmony_ci    surface and context are compatible if
11802f4aeb0Sopenharmony_ci        * They support the same type of color buffer (RGB or luminance)
11902f4aeb0Sopenharmony_ci
12002f4aeb0Sopenharmony_ciTo the following:
12102f4aeb0Sopenharmony_ci
12202f4aeb0Sopenharmony_ci    A context can be used with any EGLSurface that it is compatible with
12302f4aeb0Sopenharmony_ci    (subject to the restrictions discussed in the section on address space). A
12402f4aeb0Sopenharmony_ci    surface and context are compatible if
12502f4aeb0Sopenharmony_ci        * They support the same type of color buffer (RGB, YUV, or luminance)
12602f4aeb0Sopenharmony_ci
12702f4aeb0Sopenharmony_ciAdditions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
12802f4aeb0Sopenharmony_ci
12902f4aeb0Sopenharmony_ciChange the section marked from Buffer Descriptions and Attributes in Section 3.4
13002f4aeb0Sopenharmony_cito:
13102f4aeb0Sopenharmony_ci
13202f4aeb0Sopenharmony_ci    The Color Buffer
13302f4aeb0Sopenharmony_ci
13402f4aeb0Sopenharmony_ci        The color buffer contains pixel color values, and is shared by all
13502f4aeb0Sopenharmony_ci    client APIs rendering to a surface.
13602f4aeb0Sopenharmony_ci        EGL_COLOR_BUFFER_TYPE indicates the color buffer type, and must be
13702f4aeb0Sopenharmony_ci    either EGL_RGB_BUFFER for an RGB color buffer, EGL_LUMINANCE_BUFFER for a
13802f4aeb0Sopenharmony_ci    luminance color buffer, or EGL_YUV_BUFFER_EXT for a YUV color buffer.  For
13902f4aeb0Sopenharmony_ci    an RGB buffer, EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE must be non-zero,
14002f4aeb0Sopenharmony_ci    and EGL_LUMINANCE_SIZE must be zero.  For a luminance buffer, EGL_RED_SIZE,
14102f4aeb0Sopenharmony_ci    EGL_GREEN_SIZE, EGL_BLUE_SIZE must be zero, and EGL_LUMINANCE_SIZE must be
14202f4aeb0Sopenharmony_ci    non-zero. For both RGB and luminance color buffers, EGL_ALPHA_SIZE may be
14302f4aeb0Sopenharmony_ci    zero or non-zero (the latter indicates the existence of a destination alpha
14402f4aeb0Sopenharmony_ci    buffer).  For a YUV buffer, all of EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_-
14502f4aeb0Sopenharmony_ci    SIZE, EGL_LUMINANCE_SIZE, and EGL_ALPHA_SIZE must be zero. Instead, the
14602f4aeb0Sopenharmony_ci    depth in bits per pixel for YUV is described using EGL_YUV_PLANE_BPP_EXT,
14702f4aeb0Sopenharmony_ci    which describes the size of a single pixel in the Y plane, and the other
14802f4aeb0Sopenharmony_ci    plane depths are derived from this.
14902f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_EXT is used to describe the plane order.
15002f4aeb0Sopenharmony_ci        EGL_YUV_NUMBER_OF_PLANES_EXT describes the number of planes that will
15102f4aeb0Sopenharmony_ci    be used for this surface. The allowed values for EGL_YUV_NUMBER_OF_PLANES_-
15202f4aeb0Sopenharmony_ci    EXT must be greater than zero and not more than three.
15302f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_EXT allows the user to decide how the surface will be
15402f4aeb0Sopenharmony_ci    subsampled.
15502f4aeb0Sopenharmony_ci
15602f4aeb0Sopenharmony_ci    Valid combinations are:
15702f4aeb0Sopenharmony_ci
15802f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_EXT         EGL_YUV_NUMBER_OF_PLANES_EXT   EGL_YUV_ORDER_EXT          EGL_YUV_PLANE_BPP_EXT
15902f4aeb0Sopenharmony_ci        -------------------------     -----------------------------  ------------------         ------------------------
16002f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_2_0_EXT                2 or 3            EGL_YUV_ORDER_YUV_EXT or   EGL_YUV_PLANE_BPP_8_EXT or
16102f4aeb0Sopenharmony_ci                                                                     EGL_YUV_ORDER_YVU_EXT      EGL_YUV_PLANE_BPP_10_EXT
16202f4aeb0Sopenharmony_ci
16302f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_2_2_EXT                  1               EGL_YUV_ORDER_YUYV_EXT or  EGL_YUV_PLANE_BPP_8_EXT or
16402f4aeb0Sopenharmony_ci                                                                     EGL_YUV_ORDER_YVYU_EXT or  EGL_YUV_PLANE_BPP_10_EXT
16502f4aeb0Sopenharmony_ci                                                                     EGL_YUV_ORDER_UYVY_EXT or
16602f4aeb0Sopenharmony_ci                                                                     EGL_YUV_ORDER_VYUY_EXT
16702f4aeb0Sopenharmony_ci
16802f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_2_2_EXT               2 or 3             EGL_YUV_ORDER_YUV_EXT or   EGL_YUV_PLANE_BPP_8_EXT or
16902f4aeb0Sopenharmony_ci                                                                     EGL_YUV_ORDER_YVU_EXT      EGL_YUV_PLANE_BPP_10_EXT
17002f4aeb0Sopenharmony_ci
17102f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_4_4_4_EXT                  1               EGL_YUV_ORDER_AYUV_EXT     EGL_YUV_PLANE_BPP_8_EXT or
17202f4aeb0Sopenharmony_ci                                                                                                EGL_YUV_PLANE_BPP_10_EXT
17302f4aeb0Sopenharmony_ci
17402f4aeb0Sopenharmony_ci    Usage examples:
17502f4aeb0Sopenharmony_ci
17602f4aeb0Sopenharmony_ci        Format                      Combination
17702f4aeb0Sopenharmony_ci        ------------------          --------------------------------------------------------------
17802f4aeb0Sopenharmony_ci        NV12                        EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_0_EXT
17902f4aeb0Sopenharmony_ci         - YUV420                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 2
18002f4aeb0Sopenharmony_ci         - 2 Planes : Y + UV        EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YUV_EXT
18102f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_8_EXT
18202f4aeb0Sopenharmony_ci
18302f4aeb0Sopenharmony_ci        NV21                        EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_0_EXT
18402f4aeb0Sopenharmony_ci         - YUV420                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 2
18502f4aeb0Sopenharmony_ci         - 2 Planes : Y + VU        EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YVU_EXT
18602f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_8_EXT
18702f4aeb0Sopenharmony_ci
18802f4aeb0Sopenharmony_ci        YV12                        EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_0_EXT
18902f4aeb0Sopenharmony_ci         - YUV420                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 3
19002f4aeb0Sopenharmony_ci         - 3 Planes : Y + V + U     EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YVU_EXT
19102f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_8_EXT
19202f4aeb0Sopenharmony_ci
19302f4aeb0Sopenharmony_ci        YUY2                        EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_2_EXT
19402f4aeb0Sopenharmony_ci         - YUV422                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 1
19502f4aeb0Sopenharmony_ci         - 1 Plane : Y + U + Y + V  EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YUYV_EXT
19602f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_8_EXT
19702f4aeb0Sopenharmony_ci
19802f4aeb0Sopenharmony_ci        AYUV                        EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_4_4_EXT
19902f4aeb0Sopenharmony_ci         - YUV444                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 1
20002f4aeb0Sopenharmony_ci         - 1 Plane : A + Y + U + V  EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_AYUV_EXT
20102f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_8_EXT
20202f4aeb0Sopenharmony_ci
20302f4aeb0Sopenharmony_ci        YUV420 Semi-Planar 10 Bit   EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_0_EXT
20402f4aeb0Sopenharmony_ci         - YUV420                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 2
20502f4aeb0Sopenharmony_ci         - 2 Planes : Y + UV        EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YUV_EXT
20602f4aeb0Sopenharmony_ci         - 10 bit depth             EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_10_EXT
20702f4aeb0Sopenharmony_ci
20802f4aeb0Sopenharmony_ci        YUV422 Interleaved 10 Bit   EGL_YUV_SUBSAMPLE_EXT          = EGL_YUV_SUBSAMPLE_4_2_2_EXT
20902f4aeb0Sopenharmony_ci         - YUV422                   EGL_YUV_NUMBER_OF_PLANES_EXT   = 1
21002f4aeb0Sopenharmony_ci         - 1 Plane : Y + U + Y + V  EGL_YUV_ORDER_EXT              = EGL_YUV_ORDER_YUYV_EXT
21102f4aeb0Sopenharmony_ci         - 8 bit depth              EGL_YUV_PLANE_BPP_EXT          = EGL_YUV_PLANE_BPP_10_EXT
21202f4aeb0Sopenharmony_ci
21302f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_EXT describes the bit depth for the different
21402f4aeb0Sopenharmony_ci    planes of a YUV surface. The available options are EGL_YUV_PLANE_BPP_0_-
21502f4aeb0Sopenharmony_ci    EXT, EGL_YUV_PLANE_BPP_8_EXT and EGL_YUV_PLANE_BPP_10_EXT. If EGL_YUV_-
21602f4aeb0Sopenharmony_ci    PLANE_BPP_0_EXT is specified, no color buffer will be created for the
21702f4aeb0Sopenharmony_ci    surface.
21802f4aeb0Sopenharmony_ci        EGL_YUV_DEPTH_RANGE_EXT describes the range of the pixel value and is
21902f4aeb0Sopenharmony_ci    dependent on the EGL_YUV_PLANE_BPP_EXT setting:
22002f4aeb0Sopenharmony_ci
22102f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_EXT        EGL_YUV_DEPTH_RANGE_LIMITED_EXT   EGL_YUV_DEPTH_RANGE_FULL_EXT
22202f4aeb0Sopenharmony_ci                                     (Inclusive)                       (Inclusive)
22302f4aeb0Sopenharmony_ci        -------------------------    --------------------------------  -----------------------------
22402f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_8_EXT or   Y: 16 to 235, UV: 16 to 240       Y: 0 to 255,  UV: 0 to 255
22502f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_10_EXT     Y: 64 to 940, UV: 64 to 960       Y: 0 to 1023, UV: 0 to 1023
22602f4aeb0Sopenharmony_ci
22702f4aeb0Sopenharmony_ci        If OpenGL or OpenGL ES rendering is supported for a luminance color
22802f4aeb0Sopenharmony_ci    buffer (as described by the value of the EGL_RENDERABLE_TYPE attribute,
22902f4aeb0Sopenharmony_ci    described below), it is treated as RGB rendering with the value of
23002f4aeb0Sopenharmony_ci    GL_RED_BITS equal to EGL_LUMINANCE_SIZE and the values of GL_GREEN_BITS and
23102f4aeb0Sopenharmony_ci    GL_BLUE_BITS equal to zero. The red component of fragments is written to the
23202f4aeb0Sopenharmony_ci    luminance channel of the color buffer, the green and blue components are
23302f4aeb0Sopenharmony_ci    discarded, and the alpha component is written to the alpha channel of the
23402f4aeb0Sopenharmony_ci    color buffer (if present).
23502f4aeb0Sopenharmony_ci        When rendering to the YUV surface, if EGL_YUV_ORDER_EXT is not EGL_-
23602f4aeb0Sopenharmony_ci    YUV_ORDER_AYUV_EXT, the alpha channel will always be fully opaque.
23702f4aeb0Sopenharmony_ci    Otherwise it is defined by the value provided to the alpha sample.
23802f4aeb0Sopenharmony_ci        EGL_BUFFER_SIZE gives the total of the color component bits of the color
23902f4aeb0Sopenharmony_ci    buffer for EGL_RGB_BUFFER or for EGL_LUMINANCE_BUFFER. For an RGB color
24002f4aeb0Sopenharmony_ci    buffer, the total is the sum of EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE,
24102f4aeb0Sopenharmony_ci    and EGL_ALPHA_SIZE. For a luminance color buffer, the total is the sum of
24202f4aeb0Sopenharmony_ci    EGL_LUMINANCE_SIZE and EGL_ALPHA_SIZE. When EGL_COLOR_BUFFER_TYPE is of type
24302f4aeb0Sopenharmony_ci    EGL_YUV_BUFFER_EXT, this will reflect the enumeration provided
24402f4aeb0Sopenharmony_ci    as an integer) for EGL_YUV_PLANE_BPP_EXT, giving a value of 0, 8 or 10.
24502f4aeb0Sopenharmony_ci
24602f4aeb0Sopenharmony_ci   Other EGLConfig Attribute Descriptions
24702f4aeb0Sopenharmony_ci
24802f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_EXT can be set to either EGL_YUV_CSC_STANDARD_-
24902f4aeb0Sopenharmony_ci    601_EXT, EGL_YUV_CSC_STANDARD_709_EXT, or EGL_YUV_CSC_2020_EXT. If the
25002f4aeb0Sopenharmony_ci    standard chosen is EGL_YUV_CSC_STANDARD_709_EXT, then the color conversion
25102f4aeb0Sopenharmony_ci    follows the ITU-R BT.709 standard. If EGL_YUV_CSC_STANDARD_EXT is set to
25202f4aeb0Sopenharmony_ci    EGL_YUV_CSC_2020_EXT, then the color conversion will be processed based on
25302f4aeb0Sopenharmony_ci    ITU-R BT.2020.
25402f4aeb0Sopenharmony_ci
25502f4aeb0Sopenharmony_ci
25602f4aeb0Sopenharmony_ciChange option 2 in the section marked as 3.4.1.2 Sorting of EGLConfigs to:
25702f4aeb0Sopenharmony_ci
25802f4aeb0Sopenharmony_ci    2. Special: by EGL_COLOR_BUFFER_TYPE where the precendence is EGL_RGB_-
25902f4aeb0Sopenharmony_ci    BUFFER, EGL_LUMINANCE_BUFFER, EGL_YUV_BUFFER_EXT.
26002f4aeb0Sopenharmony_ci
26102f4aeb0Sopenharmony_ciChange option 3 in the section marked as 3.4.1.2 Sorting of EGLConfigs to:
26202f4aeb0Sopenharmony_ci
26302f4aeb0Sopenharmony_ci    3. Special: by larger total number of color bits (for an RGB color buffer,
26402f4aeb0Sopenharmony_ci    this is the sum of EGL_RED_SIZE, EGL_GREEN_SIZE, EGL_BLUE_SIZE, and
26502f4aeb0Sopenharmony_ci    EGL_ALPHA_SIZE; for a luminance color buffer, the sum of EGL_LUMINANCE_SIZE
26602f4aeb0Sopenharmony_ci    and EGL_ALPHA_SIZE; for YUV color buffers, this returns the integer value
26702f4aeb0Sopenharmony_ci    with respect to the enumeration provided for EGL_YUV_PLANE_BPP_EXT) If the
26802f4aeb0Sopenharmony_ci    requrested number of bits in attrib_list for a particular color component
26902f4aeb0Sopenharmony_ci    is 0 or EGL_DONT_CARE, then the number of bits for the component is not
27002f4aeb0Sopenharmony_ci    considered. Due to this, YUV color buffers are always last based on this
27102f4aeb0Sopenharmony_ci    rule.
27202f4aeb0Sopenharmony_ci
27302f4aeb0Sopenharmony_ciThe following options should be added between options 9 and 10 in section
27402f4aeb0Sopenharmony_ci3.4.1.2 (EGL_ALPHA_MASK_SIZE and EGL_NATIVE_VISUAL_TYPE):
27502f4aeb0Sopenharmony_ci
27602f4aeb0Sopenharmony_ci    10. Special: EGL_YUV_ORDER_EXT will be sorted in the following order:
27702f4aeb0Sopenharmony_ci    EGL_NONE, EGL_YUV_ORDER_YUV_EXT, EGL_YUV_ORDER_YVU_EXT, EGL_YUV_ORDER_-
27802f4aeb0Sopenharmony_ci    YUYV_EXT, EGL_YUV_ORDER_YVYU_EXT, EGL_YUV_ORDER_UYVY_EXT, EGL_YUV_ORDER_-
27902f4aeb0Sopenharmony_ci    VYUY_EXT, and EGL_YUV_ORDER_AYUV_EXT.
28002f4aeb0Sopenharmony_ci
28102f4aeb0Sopenharmony_ciChange option 10 in section 3.4.1.2 (EGL_NATIVE_VISUAL_TYPE) to:
28202f4aeb0Sopenharmony_ci
28302f4aeb0Sopenharmony_ci    11. Special: by EGL_NATIVE_VISUAL_TYPE (the actual sort order is
28402f4aeb0Sopenharmony_ci    implementation-defined, depending on the meaning of native visual types).
28502f4aeb0Sopenharmony_ci
28602f4aeb0Sopenharmony_ciNew State
28702f4aeb0Sopenharmony_ci
28802f4aeb0Sopenharmony_ci    Add to table 3.1 (EGLConfig Attributes):
28902f4aeb0Sopenharmony_ci
29002f4aeb0Sopenharmony_ci    Attribute                       Type      Notes
29102f4aeb0Sopenharmony_ci    -----------------------------   ----      --------------------------------------------
29202f4aeb0Sopenharmony_ci    EGL_YUV_ORDER_EXT               enum      The order in which the samples will be found
29302f4aeb0Sopenharmony_ci                                              inside the surface
29402f4aeb0Sopenharmony_ci    EGL_YUV_NUMBER_OF_PLANES_EXT    integer   Number of planes for the surface, in the range of [1,3]
29502f4aeb0Sopenharmony_ci    EGL_YUV_SUBSAMPLE_EXT           enum      Describes the sampling rate of the different planes.
29602f4aeb0Sopenharmony_ci    EGL_YUV_DEPTH_RANGE_EXT         enum      Luma plane range. limited is [16,240] and
29702f4aeb0Sopenharmony_ci                                              full range is [0,255]
29802f4aeb0Sopenharmony_ci    EGL_YUV_CSC_STANDARD_EXT        enum      The standard used for color conversion.
29902f4aeb0Sopenharmony_ci    EGL_YUV_PLANE_BPP_EXT           enum      How many bits are used for each plane of
30002f4aeb0Sopenharmony_ci                                              the YUV surface
30102f4aeb0Sopenharmony_ci
30202f4aeb0Sopenharmony_ci    Add to table 3.4 (Default values and match criteria for EGLConfig
30302f4aeb0Sopenharmony_ci    attributes):
30402f4aeb0Sopenharmony_ci
30502f4aeb0Sopenharmony_ci    Attribute                       Default                           Selection  Sort     Sort
30602f4aeb0Sopenharmony_ci                                                                      Criteria   Order    Priority
30702f4aeb0Sopenharmony_ci    -------------------------       --------------------------------  ---------  -------  --------
30802f4aeb0Sopenharmony_ci    EGL_YUV_ORDER_EXT               EGL_DONT_CARE                     Exact      Special  10
30902f4aeb0Sopenharmony_ci    EGL_YUV_NUMBER_OF_PLANES_EXT    0                                 At least   None
31002f4aeb0Sopenharmony_ci    EGL_YUV_SUBSAMPLE_EXT           EGL_DONT_CARE                     Exact      None
31102f4aeb0Sopenharmony_ci    EGL_YUV_DEPTH_RANGE_EXT         EGL_DONT_CARE                     Exact      None
31202f4aeb0Sopenharmony_ci    EGL_YUV_CSC_STANDARD_EXT        EGL_DONT_CARE                     Exact      None
31302f4aeb0Sopenharmony_ci    EGL_YUV_PLANE_BPP_EXT           EGL_DONT_CARE                     Exact      None
31402f4aeb0Sopenharmony_ci
31502f4aeb0Sopenharmony_ciIssues
31602f4aeb0Sopenharmony_ci    1.  How will a EGL surface created with a YUV config properly detect that
31702f4aeb0Sopenharmony_ci        valid values were used when filling pixel data?
31802f4aeb0Sopenharmony_ci
31902f4aeb0Sopenharmony_ci        This problem occurs in situations when a specification which defines
32002f4aeb0Sopenharmony_ci        rendering to the YUV surface cannot guarantee values that conform to the
32102f4aeb0Sopenharmony_ci        configuration attributes. One possible situation for this is when a
32202f4aeb0Sopenharmony_ci        the GL client is using GL_EXT_yuv_target and the EGL YUV surface is the
32302f4aeb0Sopenharmony_ci        draw buffer. The shader can transform the values inside the shader, and
32402f4aeb0Sopenharmony_ci        there is no guarantee that the values will fall into the EGL_YUV_DEPTH_-
32502f4aeb0Sopenharmony_ci        RANGE_EXT value chosen. Other client specifications could have similar
32602f4aeb0Sopenharmony_ci        issues and it may not be performant for some hardware to detect this
32702f4aeb0Sopenharmony_ci        discrepancy. This includes interactions with extensions such as EGL_-
32802f4aeb0Sopenharmony_ci        lock_surface, or any others that provide a mechanism to change the
32902f4aeb0Sopenharmony_ci        contents of the YUV surface.
33002f4aeb0Sopenharmony_ci
33102f4aeb0Sopenharmony_ci        One of the problems that can occur in situations like this will be
33202f4aeb0Sopenharmony_ci        compound mathematical error should operations need to take place on the
33302f4aeb0Sopenharmony_ci        buffer data.
33402f4aeb0Sopenharmony_ci
33502f4aeb0Sopenharmony_ci        Proposal: Due to the performance problems or inability in some hardware
33602f4aeb0Sopenharmony_ci        to deal with this issue, the pixel contents will be undefined and any
33702f4aeb0Sopenharmony_ci        further operations to the pixel contents will also be undefined.
33802f4aeb0Sopenharmony_ci        Therefore it is up to the application to guarantee the correct values
33902f4aeb0Sopenharmony_ci        are stored within the surface. The EGL implementation need not attempt
34002f4aeb0Sopenharmony_ci        any form of verification on the pixel data of the YUV surface, nor does
34102f4aeb0Sopenharmony_ci        it have to guarantee the pixel data, even with communicating the surface
34202f4aeb0Sopenharmony_ci        to other modules through a post or any other operation EGL performs.
34302f4aeb0Sopenharmony_ci
34402f4aeb0Sopenharmony_ci    2.  Should an EGL_COLOR_BUFFER_TYPE = EGL_DONT_CARE request enumerate all
34502f4aeb0Sopenharmony_ci        YUV configs?
34602f4aeb0Sopenharmony_ci
34702f4aeb0Sopenharmony_ci        Resolved: Revision #9 changes the default values and selection criteria
34802f4aeb0Sopenharmony_ci        to allow for full enumeration of all YUV configs. The default value of
34902f4aeb0Sopenharmony_ci        EGL_COLOR_BUFFER_TYPE remains EGL_RGB_BUFFER, so this change only
35002f4aeb0Sopenharmony_ci        affects explicit EGL_DONT_CARE requests.
35102f4aeb0Sopenharmony_ci
35202f4aeb0Sopenharmony_ciExample Configuration for NV12:
35302f4aeb0Sopenharmony_ci
35402f4aeb0Sopenharmony_ci    const EGLint config_attribs[] =
35502f4aeb0Sopenharmony_ci    {
35602f4aeb0Sopenharmony_ci        EGL_SURFACE_TYPE,              EGL_WINDOW_BIT,
35702f4aeb0Sopenharmony_ci        EGL_RENDERABLE_TYPE,           EGL_OPENGL_ES2_BIT,
35802f4aeb0Sopenharmony_ci        EGL_COLOR_BUFFER_TYPE,         EGL_YUV_BUFFER_EXT,
35902f4aeb0Sopenharmony_ci        EGL_YUV_ORDER_EXT,             EGL_ORDER_YUV_EXT,
36002f4aeb0Sopenharmony_ci        EGL_YUV_NUMBER_OF_PLANES_EXT,  2,
36102f4aeb0Sopenharmony_ci        EGL_YUV_SUBSAMPLE_EXT,         EGL_YUV_SUBSAMPLE_4_2_0_EXT,
36202f4aeb0Sopenharmony_ci        EGL_YUV_DEPTH_RANGE_EXT,       EGL_YUV_DEPTH_RANGE_LIMITED_EXT,
36302f4aeb0Sopenharmony_ci        EGL_YUV_CSC_STANDARD_EXT,      EGL_YUV_CSC_STANDARD_601_EXT,
36402f4aeb0Sopenharmony_ci        EGL_YUV_PLANE_BPP_EXT,         EGL_YUV_PLANE_BPP_8_EXT,
36502f4aeb0Sopenharmony_ci        EGL_NONE
36602f4aeb0Sopenharmony_ci    };
36702f4aeb0Sopenharmony_ci
36802f4aeb0Sopenharmony_ciRevision History
36902f4aeb0Sopenharmony_ci#1  March    12th, 2014    Initial Draft.
37002f4aeb0Sopenharmony_ci
37102f4aeb0Sopenharmony_ci#2  March    25th, 2014    Reformated and added more detail.
37202f4aeb0Sopenharmony_ci
37302f4aeb0Sopenharmony_ci#3  March    26th, 2014    Added usage examples.
37402f4aeb0Sopenharmony_ci                           Added memory layout definitions.
37502f4aeb0Sopenharmony_ci
37602f4aeb0Sopenharmony_ci#4  March    26th, 2014    Fixed some typos and formatting.
37702f4aeb0Sopenharmony_ci
37802f4aeb0Sopenharmony_ci#5  May      21st, 2014    Fixed some inconsistencies.
37902f4aeb0Sopenharmony_ci                           Added EGL_YUV_PLANE_DEPTH_0_QCOM.
38002f4aeb0Sopenharmony_ci
38102f4aeb0Sopenharmony_ci#6  May      27th, 2014    Relaxed some requirements.
38202f4aeb0Sopenharmony_ci                           Changed EGL_YUV_PLANE_DEPTH_<0,8,10>_QCOM to
38302f4aeb0Sopenharmony_ci                           EGL_YUV_PLANE_BPP_<0,8,10>_QCOM.
38402f4aeb0Sopenharmony_ci                           Added more detail.
38502f4aeb0Sopenharmony_ci
38602f4aeb0Sopenharmony_ci#7  October   7th, 2014    Issue (1) added.
38702f4aeb0Sopenharmony_ci                           Minor updates made (EXT_yuv_target)
38802f4aeb0Sopenharmony_ci
38902f4aeb0Sopenharmony_ci#8  October  24th, 2014    Updated for EXT and token values.
39002f4aeb0Sopenharmony_ci
39102f4aeb0Sopenharmony_ci#9  April    26th, 2017    Changed attributes default values and selection
39202f4aeb0Sopenharmony_ci                           criteria (see issue #2).
39302f4aeb0Sopenharmony_ci                           Changed status from Draft to Complete.
394