Changeset 239869 in webkit
- Timestamp:
- Jan 11, 2019 1:01:47 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239865 r239869 1 2019-01-11 Miguel Gomez <magomez@igalia.com> 2 3 [GTK] Garbled rendering on Youtube while scrolling under X11. 4 https://bugs.webkit.org/show_bug.cgi?id=192982 5 6 Reviewed by Carlos Garcia Campos. 7 8 When creating a GLX window context, try to get a GLXFBConfig that has depth and stencil buffers for 9 the default framebuffer. 10 11 * platform/graphics/glx/GLContextGLX.cpp: 12 (WebCore::compatibleVisuals): 13 (WebCore::GLContextGLX::createWindowContext): 14 1 15 2019-01-11 Sihui Liu <sihui_liu@apple.com> 2 16 -
trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
r212968 r239869 115 115 } 116 116 117 static bool compatibleVisuals(XVisualInfo* a, XVisualInfo* b) 118 { 119 return a->c_class == b->c_class 120 && a->depth == b->depth 121 && a->red_mask == b->red_mask 122 && a->green_mask == b->green_mask 123 && a->blue_mask == b->blue_mask 124 && a->colormap_size == b->colormap_size 125 && a->bits_per_rgb == b->bits_per_rgb; 126 } 127 117 128 std::unique_ptr<GLContextGLX> GLContextGLX::createWindowContext(GLNativeWindowType window, PlatformDisplay& platformDisplay, GLXContext sharingContext) 118 129 { 130 // In order to create the GLContext, we need to select a GLXFBConfig that has depth and stencil 131 // buffers that is compatible with the Visual used to create the window. To do this, we request 132 // all the GLXFBConfigs that have the features we need and compare their XVisualInfo to check whether 133 // they are compatible with the window one. Then we try to create the GLContext with each of those 134 // configs until we succeed, and finally fallback to the window config if nothing else works. 119 135 Display* display = downcast<PlatformDisplayX11>(platformDisplay).native(); 120 136 XWindowAttributes attributes; … … 126 142 127 143 int numConfigs = 0; 128 GLXFBConfig config = nullptr;144 GLXFBConfig windowConfig = nullptr; 129 145 XUniquePtr<GLXFBConfig> configs(glXGetFBConfigs(display, DefaultScreen(display), &numConfigs)); 130 146 for (int i = 0; i < numConfigs; i++) { … … 132 148 if (!glxVisualInfo) 133 149 continue; 134 135 150 if (glxVisualInfo.get()->visualid == visualInfo.visualid) { 136 config = configs.get()[i];151 windowConfig = configs.get()[i]; 137 152 break; 138 153 } 139 154 } 140 ASSERT(config); 141 155 ASSERT(windowConfig); 156 XUniquePtr<XVisualInfo> windowVisualInfo(glXGetVisualFromFBConfig(display, windowConfig)); 157 158 static const int fbConfigAttributes[] = { 159 GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, 160 GLX_RENDER_TYPE, GLX_RGBA_BIT, 161 GLX_X_RENDERABLE, GL_TRUE, 162 GLX_RED_SIZE, 1, 163 GLX_GREEN_SIZE, 1, 164 GLX_BLUE_SIZE, 1, 165 GLX_ALPHA_SIZE, 1, 166 GLX_DEPTH_SIZE, 1, 167 GLX_STENCIL_SIZE, 1, 168 GLX_DOUBLEBUFFER, GL_TRUE, 169 GLX_CONFIG_CAVEAT, GLX_NONE, 170 #ifdef GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 171 // Discard sRGB configs if any sRGB extension is installed. 172 GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, GL_FALSE, 173 #endif 174 0 175 }; 176 configs.reset(glXChooseFBConfig(display, DefaultScreen(display), fbConfigAttributes, &numConfigs)); 142 177 XUniqueGLXContext context; 178 for (int i = 0; i < numConfigs; i++) { 179 XUniquePtr<XVisualInfo> configVisualInfo(glXGetVisualFromFBConfig(display, configs.get()[i])); 180 if (!configVisualInfo) 181 continue; 182 if (compatibleVisuals(windowVisualInfo.get(), configVisualInfo.get())) { 183 // Try to create a context with this config. Use the trapper in case we get an XError. 184 XErrorTrapper trapper(display, XErrorTrapper::Policy::Ignore); 185 if (hasGLXARBCreateContextExtension(display)) 186 context.reset(createGLXARBContext(display, configs.get()[i], sharingContext)); 187 else { 188 // Legacy OpenGL version. 189 context.reset(glXCreateContext(display, configVisualInfo.get(), sharingContext, True)); 190 } 191 192 if (context) 193 return std::unique_ptr<GLContextGLX>(new GLContextGLX(platformDisplay, WTFMove(context), window)); 194 } 195 } 196 197 // Fallback to the config used by the window. We don't probably have the buffers we need in 198 // this config and that will cause artifacts, but it's better than not rendering anything. 143 199 if (hasGLXARBCreateContextExtension(display)) 144 context.reset(createGLXARBContext(display, config, sharingContext));200 context.reset(createGLXARBContext(display, windowConfig, sharingContext)); 145 201 else { 146 202 // Legacy OpenGL version. 147 XUniquePtr<XVisualInfo> visualInfoList(glXGetVisualFromFBConfig(display, config)); 148 context.reset(glXCreateContext(display, visualInfoList.get(), sharingContext, True)); 203 context.reset(glXCreateContext(display, windowVisualInfo.get(), sharingContext, True)); 149 204 } 150 205
Note: See TracChangeset
for help on using the changeset viewer.