WebKit Bugzilla
Attachment 358889 Details for
Bug 192982
: [GTK] Garbled rendering on Youtube while scrolling under X11.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192982-20190111130305.patch (text/plain), 5.88 KB, created by
Miguel Gomez
on 2019-01-11 04:03:06 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Miguel Gomez
Created:
2019-01-11 04:03:06 PST
Size:
5.88 KB
patch
obsolete
>Subversion Revision: 239861 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 76b62769033d12153a576529ab23321418a49b44..c45a27b30820754c5334f1d6f847fff124b8c05c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2019-01-11 Miguel Gomez <magomez@igalia.com> >+ >+ [GTK] Garbled rendering on Youtube while scrolling under X11. >+ https://bugs.webkit.org/show_bug.cgi?id=192982 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When creating a GLX window context, try to get a GLXFBConfig that has depth and stencil buffers for >+ the default framebuffer. >+ >+ * platform/graphics/glx/GLContextGLX.cpp: >+ (WebCore::compatibleVisuals): >+ (WebCore::GLContextGLX::createWindowContext): >+ > 2019-01-10 Myles C. Maxfield <mmaxfield@apple.com> > > [WHLSL] Include the standard library >diff --git a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp >index 451b914bac77b3d95baf071b096209a7631a1c2e..97b10bdefe56179f3afb4613bdd20d0600f93966 100644 >--- a/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp >+++ b/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp >@@ -114,8 +114,24 @@ static GLXContext createGLXARBContext(Display* display, GLXFBConfig config, GLXC > return glXCreateContextAttribsARB(display, config, sharingContext, GL_TRUE, nullptr); > } > >+static bool compatibleVisuals(XVisualInfo* a, XVisualInfo* b) >+{ >+ return a->c_class == b->c_class >+ && a->depth == b->depth >+ && a->red_mask == b->red_mask >+ && a->green_mask == b->green_mask >+ && a->blue_mask == b->blue_mask >+ && a->colormap_size == b->colormap_size >+ && a->bits_per_rgb == b->bits_per_rgb; >+} >+ > std::unique_ptr<GLContextGLX> GLContextGLX::createWindowContext(GLNativeWindowType window, PlatformDisplay& platformDisplay, GLXContext sharingContext) > { >+ // In order to create the GLContext, we need to select a GLXFBConfig that has depth and stencil >+ // buffers that is compatible with the Visual used to create the window. To do this, we request >+ // all the GLXFBConfigs that have the features we need and compare their XVisualInfo to check whether >+ // they are compatible with the window one. Then we try to create the GLContext with each of those >+ // configs until we succeed, and finally fallback to the window config if nothing else works. > Display* display = downcast<PlatformDisplayX11>(platformDisplay).native(); > XWindowAttributes attributes; > if (!XGetWindowAttributes(display, static_cast<Window>(window), &attributes)) >@@ -125,27 +141,66 @@ std::unique_ptr<GLContextGLX> GLContextGLX::createWindowContext(GLNativeWindowTy > visualInfo.visualid = XVisualIDFromVisual(attributes.visual); > > int numConfigs = 0; >- GLXFBConfig config = nullptr; >+ GLXFBConfig windowConfig = nullptr; > XUniquePtr<GLXFBConfig> configs(glXGetFBConfigs(display, DefaultScreen(display), &numConfigs)); > for (int i = 0; i < numConfigs; i++) { > XUniquePtr<XVisualInfo> glxVisualInfo(glXGetVisualFromFBConfig(display, configs.get()[i])); > if (!glxVisualInfo) > continue; >- > if (glxVisualInfo.get()->visualid == visualInfo.visualid) { >- config = configs.get()[i]; >+ windowConfig = configs.get()[i]; > break; > } > } >- ASSERT(config); >+ ASSERT(windowConfig); >+ XUniquePtr<XVisualInfo> windowVisualInfo(glXGetVisualFromFBConfig(display, windowConfig)); > >+ static const int fbConfigAttributes[] = { >+ GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, >+ GLX_RENDER_TYPE, GLX_RGBA_BIT, >+ GLX_X_RENDERABLE, GL_TRUE, >+ GLX_RED_SIZE, 1, >+ GLX_GREEN_SIZE, 1, >+ GLX_BLUE_SIZE, 1, >+ GLX_ALPHA_SIZE, 1, >+ GLX_DEPTH_SIZE, 1, >+ GLX_STENCIL_SIZE, 1, >+ GLX_DOUBLEBUFFER, GL_TRUE, >+ GLX_CONFIG_CAVEAT, GLX_NONE, >+#ifdef GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT >+ // Discard sRGB configs if any sRGB extension is installed. >+ GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT, GL_FALSE, >+#endif >+ 0 >+ }; >+ configs.reset(glXChooseFBConfig(display, DefaultScreen(display), fbConfigAttributes, &numConfigs)); > XUniqueGLXContext context; >+ for (int i = 0; i < numConfigs; i++) { >+ XUniquePtr<XVisualInfo> configVisualInfo(glXGetVisualFromFBConfig(display, configs.get()[i])); >+ if (!configVisualInfo) >+ continue; >+ if (compatibleVisuals(windowVisualInfo.get(), configVisualInfo.get())) { >+ // Try to create a context with this config. Use the trapper in case we get an XError. >+ XErrorTrapper trapper(display, XErrorTrapper::Policy::Ignore); >+ if (hasGLXARBCreateContextExtension(display)) >+ context.reset(createGLXARBContext(display, configs.get()[i], sharingContext)); >+ else { >+ // Legacy OpenGL version. >+ context.reset(glXCreateContext(display, configVisualInfo.get(), sharingContext, True)); >+ } >+ >+ if (context) >+ return std::unique_ptr<GLContextGLX>(new GLContextGLX(platformDisplay, WTFMove(context), window)); >+ } >+ } >+ >+ // Fallback to the config used by the window. We don't probably have the buffers we need in >+ // this config and that will cause artifacts, but it's better than not rendering anything. > if (hasGLXARBCreateContextExtension(display)) >- context.reset(createGLXARBContext(display, config, sharingContext)); >+ context.reset(createGLXARBContext(display, windowConfig, sharingContext)); > else { > // Legacy OpenGL version. >- XUniquePtr<XVisualInfo> visualInfoList(glXGetVisualFromFBConfig(display, config)); >- context.reset(glXCreateContext(display, visualInfoList.get(), sharingContext, True)); >+ context.reset(glXCreateContext(display, windowVisualInfo.get(), sharingContext, True)); > } > > if (!context)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192982
:
357947
|
357948
| 358889