Changeset 205852 in webkit
- Timestamp:
- Sep 12, 2016 11:12:42 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r205847 r205852 1 2016-09-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Crash of WebProcess on the last WebView disconnect (take two) 4 https://bugs.webkit.org/show_bug.cgi?id=161842 5 6 Reviewed by Michael Catanzaro. 7 8 The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor 9 makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native 10 X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL 11 context is deleted before the native X11 display is closed. 12 13 * platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected. 14 * platform/graphics/glx/GLContextGLX.cpp: 15 (WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display. 16 (WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with 17 nviedia closed drivers. 18 (WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display. 19 (WebCore::GLContextGLX::makeContextCurrent): Ditto. 20 (WebCore::GLContextGLX::swapBuffers): Ditto. 21 (WebCore::GLContextGLX::swapInterval): Ditto. 22 (WebCore::GLContextGLX::cairoDevice): Ditto. 23 * platform/graphics/glx/GLContextGLX.h: 24 * platform/graphics/x11/PlatformDisplayX11.cpp: 25 (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display. 26 1 27 2016-09-12 Chris Dumez <cdumez@apple.com> 2 28 -
trunk/Source/WebCore/platform/graphics/PlatformDisplay.h
r205116 r205852 81 81 #endif 82 82 83 std::unique_ptr<GLContext> m_sharingGLContext; 84 83 85 private: 84 86 static std::unique_ptr<PlatformDisplay> createPlatformDisplay(); … … 91 93 int m_eglMinorVersion { 0 }; 92 94 #endif 93 std::unique_ptr<GLContext> m_sharingGLContext;94 95 }; 95 96 -
trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp
r205116 r205852 159 159 GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XID window) 160 160 : GLContext(display) 161 , m_x11Display(downcast<PlatformDisplayX11>(m_display).native()) 161 162 , m_context(WTFMove(context)) 162 163 , m_window(window) … … 166 167 GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniqueGLXPbuffer&& pbuffer) 167 168 : GLContext(display) 169 , m_x11Display(downcast<PlatformDisplayX11>(m_display).native()) 168 170 , m_context(WTFMove(context)) 169 171 , m_pbuffer(WTFMove(pbuffer)) … … 173 175 GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniquePixmap&& pixmap, XUniqueGLXPixmap&& glxPixmap) 174 176 : GLContext(display) 177 , m_x11Display(downcast<PlatformDisplayX11>(m_display).native()) 175 178 , m_context(WTFMove(context)) 176 179 , m_pixmap(WTFMove(pixmap)) … … 185 188 186 189 if (m_context) { 187 // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally188 // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/189 190 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 190 glXMakeCurrent( downcast<PlatformDisplayX11>(m_display).native(), None, None);191 glXMakeCurrent(m_x11Display, None, None); 191 192 } 192 193 } … … 205 206 Window rootWindow; 206 207 unsigned int width, height, borderWidth, depth; 207 if (!XGetGeometry( downcast<PlatformDisplayX11>(m_display).native(), m_window, &rootWindow, &x, &y, &width, &height, &borderWidth, &depth))208 if (!XGetGeometry(m_x11Display, m_window, &rootWindow, &x, &y, &width, &height, &borderWidth, &depth)) 208 209 return IntSize(); 209 210 … … 219 220 return true; 220 221 221 Display* display = downcast<PlatformDisplayX11>(m_display).native();222 222 if (m_window) 223 return glXMakeCurrent( display, m_window, m_context.get());223 return glXMakeCurrent(m_x11Display, m_window, m_context.get()); 224 224 225 225 if (m_pbuffer) 226 return glXMakeCurrent( display, m_pbuffer.get(), m_context.get());227 228 return ::glXMakeCurrent( display, m_glxPixmap.get(), m_context.get());226 return glXMakeCurrent(m_x11Display, m_pbuffer.get(), m_context.get()); 227 228 return ::glXMakeCurrent(m_x11Display, m_glxPixmap.get(), m_context.get()); 229 229 } 230 230 … … 232 232 { 233 233 if (m_window) 234 glXSwapBuffers( downcast<PlatformDisplayX11>(m_display).native(), m_window);234 glXSwapBuffers(m_x11Display, m_window); 235 235 } 236 236 … … 242 242 void GLContextGLX::swapInterval(int interval) 243 243 { 244 if (!hasSGISwapControlExtension( downcast<PlatformDisplayX11>(m_display).native()))244 if (!hasSGISwapControlExtension(m_x11Display)) 245 245 return; 246 246 glXSwapIntervalSGI(interval); … … 253 253 254 254 #if ENABLE(ACCELERATED_2D_CANVAS) && CAIRO_HAS_GLX_FUNCTIONS 255 m_cairoDevice = cairo_glx_device_create( downcast<PlatformDisplayX11>(m_display).native(), m_context.get());255 m_cairoDevice = cairo_glx_device_create(m_x11Display, m_context.get()); 256 256 #endif 257 257 -
trunk/Source/WebCore/platform/graphics/glx/GLContextGLX.h
r205116 r205852 30 30 typedef unsigned long XID; 31 31 typedef void* ContextKeyType; 32 typedef struct _XDisplay Display; 32 33 33 34 namespace WebCore { … … 63 64 static std::unique_ptr<GLContextGLX> createPixmapContext(PlatformDisplay&, GLXContext sharingContext = nullptr); 64 65 66 Display* m_x11Display { nullptr }; 65 67 XUniqueGLXContext m_context; 66 68 XID m_window { 0 }; -
trunk/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp
r204013 r205852 36 36 #if USE(EGL) 37 37 #include <EGL/egl.h> 38 #include <EGL/eglplatform.h> 38 39 #endif 40 41 // FIXME: this needs to be here, after eglplatform.h, to avoid EGLNativeDisplayType to be defined as wl_display. 42 // Since we support Wayland and X11 to be built at the same time, but eglplatform.h defines are decided at compile time 43 // we need to ensure we only include eglplatform.h from X11 or Wayland specific files. 44 #include "GLContext.h" 39 45 40 46 namespace WebCore { … … 54 60 PlatformDisplayX11::~PlatformDisplayX11() 55 61 { 62 // Clear the sharing context before releasing the display. 63 m_sharingGLContext = nullptr; 56 64 if (m_ownedDisplay) 57 65 XCloseDisplay(m_display);
Note: See TracChangeset
for help on using the changeset viewer.