⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242875 in webkit


Ignore:
Timestamp:
Mar 13, 2019, 2:25:35 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r242640 - GLContextEGL: desired EGL config should search for 8-bit components by default
https://bugs.webkit.org/show_bug.cgi?id=195413

Reviewed by Carlos Garcia Campos.

The EGL config search in GLContextEGL should by default look for
RGBA8888 configurations while allowing RGB565 as an alternative.
This prevents from accidentally landing on an RGBA1010102
configuration that is available with some graphics stacks, and which is
not expected in e.g. window snapshotting that's done for layout test
output comparison.

  • platform/graphics/egl/GLContextEGL.cpp:

(WebCore::GLContextEGL::getEGLConfig): EGL config search should by
default request 8-bit color channels.

Location:
releases/WebKitGTK/webkit-2.24/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog

    r242873 r242875  
     12019-03-08  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        GLContextEGL: desired EGL config should search for 8-bit components by default
     4        https://bugs.webkit.org/show_bug.cgi?id=195413
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        The EGL config search in GLContextEGL should by default look for
     9        RGBA8888 configurations while allowing RGB565 as an alternative.
     10        This prevents from accidentally landing on an RGBA1010102
     11        configuration that is available with some graphics stacks, and which is
     12        not expected in e.g. window snapshotting that's done for layout test
     13        output comparison.
     14
     15        * platform/graphics/egl/GLContextEGL.cpp:
     16        (WebCore::GLContextEGL::getEGLConfig): EGL config search should by
     17        default request 8-bit color channels.
     18
    1192019-03-13  Miguel Gomez  <magomez@igalia.com>
    220
  • releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp

    r242463 r242875  
    9797bool GLContextEGL::getEGLConfig(EGLDisplay display, EGLConfig* config, EGLSurfaceType surfaceType)
    9898{
     99    std::array<EGLint, 4> rgbaSize = { 8, 8, 8, 8 };
     100    if (const char* environmentVariable = getenv("WEBKIT_EGL_PIXEL_LAYOUT")) {
     101        if (!strcmp(environmentVariable, "RGB565"))
     102            rgbaSize = { 5, 6, 5, 0 };
     103        else
     104            WTFLogAlways("Unknown pixel layout %s, falling back to RGBA8888", environmentVariable);
     105    }
     106
    99107    EGLint attributeList[] = {
    100108#if USE(OPENGL_ES)
     
    103111        EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
    104112#endif
    105         EGL_RED_SIZE, 1,
    106         EGL_GREEN_SIZE, 1,
    107         EGL_BLUE_SIZE, 1,
    108         EGL_ALPHA_SIZE, 1,
     113        EGL_RED_SIZE, rgbaSize[0],
     114        EGL_GREEN_SIZE, rgbaSize[1],
     115        EGL_BLUE_SIZE, rgbaSize[2],
     116        EGL_ALPHA_SIZE, rgbaSize[3],
    109117        EGL_STENCIL_SIZE, 8,
    110118        EGL_SURFACE_TYPE, EGL_NONE,
    111119        EGL_NONE
    112120    };
    113 
    114     bool isRGB565 = false;
    115     if (const char* environmentVariable = getenv("WEBKIT_EGL_PIXEL_LAYOUT")) {
    116         if (!strcmp(environmentVariable, "RGB565")) {
    117             isRGB565 = true;
    118             // EGL_RED_SIZE
    119             attributeList[3] = 5;
    120             // EGL_GREEN_SIZE
    121             attributeList[5] = 6;
    122             // EGL_BLUE_SIZE
    123             attributeList[7] = 5;
    124             // EGL_ALPHA_SIZE
    125             attributeList[9] = 0;
    126         } else
    127             WTFLogAlways("Unknown pixel layout %s, falling back to RGBA8888", environmentVariable);
    128     }
    129121
    130122    switch (surfaceType) {
     
    147139    EGLint numberConfigsReturned;
    148140    Vector<EGLConfig> configs(count);
    149     if (!eglChooseConfig(display, attributeList, isRGB565 ? reinterpret_cast<EGLConfig*>(configs.data()) : config, isRGB565 ? count : 1, &numberConfigsReturned) || !numberConfigsReturned)
     141    if (!eglChooseConfig(display, attributeList, reinterpret_cast<EGLConfig*>(configs.data()), count, &numberConfigsReturned) || !numberConfigsReturned)
    150142        return false;
    151 
    152     if (!isRGB565)
    153         return true;
    154143
    155144    auto index = configs.findMatching([&](EGLConfig value) {
     
    159148        eglGetConfigAttrib(display, value, EGL_BLUE_SIZE, &blueSize);
    160149        eglGetConfigAttrib(display, value, EGL_ALPHA_SIZE, &alphaSize);
    161         return (redSize == 5 && greenSize == 6 && blueSize == 5 && !alphaSize);
     150        return redSize == rgbaSize[0] && greenSize == rgbaSize[1]
     151            && blueSize == rgbaSize[2] && alphaSize == rgbaSize[3];
    162152    });
    163153
Note: See TracChangeset for help on using the changeset viewer.