Changeset 242084 in webkit
- Timestamp:
- Feb 26, 2019 7:11:29 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r242082 r242084 1 2019-02-26 Philippe Normand <pnormand@igalia.com> 2 3 [EGL] Runtime support for RGB565 pixel layout 4 https://bugs.webkit.org/show_bug.cgi?id=194817 5 6 Reviewed by Carlos Garcia Campos. 7 8 Currently our graphics pipeline always relies on a ARGB8888 (32 9 bpp) pixel configuration. On some low-end (old) embedded platforms 10 the graphics driver is sometimes optimized for 16 bpp 11 configurations, such as RGB565. On those platforms the application 12 can now set the WEBKIT_EGL_PIXEL_LAYOUT environment variable to 13 "RGB565" to adjust to the best pixel configuration supported by 14 the screen and graphics driver. 15 16 * platform/graphics/egl/GLContextEGL.cpp: 17 (WebCore::GLContextEGL::getEGLConfig): 18 1 19 2019-02-26 Philippe Normand <pnormand@igalia.com> and Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/Source/WebCore/platform/graphics/egl/GLContextEGL.cpp
r229663 r242084 53 53 #include <cairo-gl.h> 54 54 #endif 55 56 #include <wtf/Vector.h> 55 57 56 58 namespace WebCore { … … 101 103 EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT, 102 104 #endif 103 EGL_RED_SIZE, 8, 104 EGL_GREEN_SIZE, 8, 105 EGL_BLUE_SIZE, 8, 105 EGL_RED_SIZE, 1, 106 EGL_GREEN_SIZE, 1, 107 EGL_BLUE_SIZE, 1, 108 EGL_ALPHA_SIZE, 1, 106 109 EGL_STENCIL_SIZE, 8, 107 EGL_ALPHA_SIZE, 8,108 110 EGL_SURFACE_TYPE, EGL_NONE, 109 111 EGL_NONE 110 112 }; 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 } 111 129 112 130 switch (surfaceType) { … … 123 141 } 124 142 143 EGLint count; 144 if (!eglChooseConfig(display, attributeList, nullptr, 0, &count)) 145 return false; 146 125 147 EGLint numberConfigsReturned; 126 return eglChooseConfig(display, attributeList, config, 1, &numberConfigsReturned) && numberConfigsReturned; 148 Vector<EGLConfig> configs(count); 149 if (!eglChooseConfig(display, attributeList, isRGB565 ? reinterpret_cast<EGLConfig*>(configs.data()) : config, isRGB565 ? count : 1, &numberConfigsReturned) || !numberConfigsReturned) 150 return false; 151 152 if (!isRGB565) 153 return true; 154 155 auto index = configs.findMatching([&](EGLConfig value) { 156 EGLint redSize, greenSize, blueSize, alphaSize; 157 eglGetConfigAttrib(display, value, EGL_RED_SIZE, &redSize); 158 eglGetConfigAttrib(display, value, EGL_GREEN_SIZE, &greenSize); 159 eglGetConfigAttrib(display, value, EGL_BLUE_SIZE, &blueSize); 160 eglGetConfigAttrib(display, value, EGL_ALPHA_SIZE, &alphaSize); 161 return (redSize == 5 && greenSize == 6 && blueSize == 5 && !alphaSize); 162 }); 163 164 if (index != notFound) { 165 *config = configs[index]; 166 return true; 167 } 168 return false; 127 169 } 128 170
Note: See TracChangeset
for help on using the changeset viewer.