Changeset 205956 in webkit


Ignore:
Timestamp:
Sep 15, 2016 12:59:10 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r205852 - [GTK] Crash of WebProcess on the last WebView disconnect (take two)
https://bugs.webkit.org/show_bug.cgi?id=161842

Reviewed by Michael Catanzaro.

The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor
makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native
X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL
context is deleted before the native X11 display is closed.

  • platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected.
  • platform/graphics/glx/GLContextGLX.cpp:

(WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display.
(WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with
nviedia closed drivers.
(WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display.
(WebCore::GLContextGLX::makeContextCurrent): Ditto.
(WebCore::GLContextGLX::swapBuffers): Ditto.
(WebCore::GLContextGLX::swapInterval): Ditto.
(WebCore::GLContextGLX::cairoDevice): Ditto.

  • platform/graphics/glx/GLContextGLX.h:
  • platform/graphics/x11/PlatformDisplayX11.cpp:

(WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display.

Location:
releases/WebKitGTK/webkit-2.14/Source/WebCore
Files:
5 edited

Legend:

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

    r205734 r205956  
     12016-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
    1272016-09-06  Carlos Garcia Campos  <cgarcia@igalia.com>
    228
  • releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/PlatformDisplay.h

    r205116 r205956  
    8181#endif
    8282
     83    std::unique_ptr<GLContext> m_sharingGLContext;
     84
    8385private:
    8486    static std::unique_ptr<PlatformDisplay> createPlatformDisplay();
     
    9193    int m_eglMinorVersion { 0 };
    9294#endif
    93     std::unique_ptr<GLContext> m_sharingGLContext;
    9495};
    9596
  • releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.cpp

    r205734 r205956  
    181181GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XID window)
    182182    : GLContext(display)
     183    , m_x11Display(downcast<PlatformDisplayX11>(m_display).native())
    183184    , m_context(WTFMove(context))
    184185    , m_window(window)
     
    189190GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniqueGLXPbuffer&& pbuffer)
    190191    : GLContext(display)
     192    , m_x11Display(downcast<PlatformDisplayX11>(m_display).native())
    191193    , m_context(WTFMove(context))
    192194    , m_pbuffer(WTFMove(pbuffer))
     
    197199GLContextGLX::GLContextGLX(PlatformDisplay& display, XUniqueGLXContext&& context, XUniquePixmap&& pixmap, XUniqueGLXPixmap&& glxPixmap)
    198200    : GLContext(display)
     201    , m_x11Display(downcast<PlatformDisplayX11>(m_display).native())
    199202    , m_context(WTFMove(context))
    200203    , m_pixmap(WTFMove(pixmap))
     
    220223    }
    221224
    222     // This may be necessary to prevent crashes with NVidia's closed source drivers. Originally
    223     // from Mozilla's 3D canvas implementation at: http://bitbucket.org/ilmari/canvas3d/
    224225    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    225     glXMakeCurrent(downcast<PlatformDisplayX11>(m_display).native(), None, None);
     226    glXMakeCurrent(m_x11Display, None, None);
    226227
    227228    m_context = nullptr;
     
    241242    Window rootWindow;
    242243    unsigned int width, height, borderWidth, depth;
    243     if (!XGetGeometry(downcast<PlatformDisplayX11>(m_display).native(), m_window, &rootWindow, &x, &y, &width, &height, &borderWidth, &depth))
     244    if (!XGetGeometry(m_x11Display, m_window, &rootWindow, &x, &y, &width, &height, &borderWidth, &depth))
    244245        return IntSize();
    245246
     
    255256        return true;
    256257
    257     Display* display = downcast<PlatformDisplayX11>(m_display).native();
    258258    if (m_window)
    259         return glXMakeCurrent(display, m_window, m_context.get());
     259        return glXMakeCurrent(m_x11Display, m_window, m_context.get());
    260260
    261261    if (m_pbuffer)
    262         return glXMakeCurrent(display, m_pbuffer.get(), m_context.get());
    263 
    264     return ::glXMakeCurrent(display, m_glxPixmap.get(), m_context.get());
     262        return glXMakeCurrent(m_x11Display, m_pbuffer.get(), m_context.get());
     263
     264    return ::glXMakeCurrent(m_x11Display, m_glxPixmap.get(), m_context.get());
    265265}
    266266
     
    268268{
    269269    if (m_window)
    270         glXSwapBuffers(downcast<PlatformDisplayX11>(m_display).native(), m_window);
     270        glXSwapBuffers(m_x11Display, m_window);
    271271}
    272272
     
    278278void GLContextGLX::swapInterval(int interval)
    279279{
    280     if (!hasSGISwapControlExtension(downcast<PlatformDisplayX11>(m_display).native()))
     280    if (!hasSGISwapControlExtension(m_x11Display))
    281281        return;
    282282    glXSwapIntervalSGI(interval);
     
    289289
    290290#if ENABLE(ACCELERATED_2D_CANVAS) && CAIRO_HAS_GLX_FUNCTIONS
    291     m_cairoDevice = cairo_glx_device_create(downcast<PlatformDisplayX11>(m_display).native(), m_context.get());
     291    m_cairoDevice = cairo_glx_device_create(m_x11Display, m_context.get());
    292292#endif
    293293
  • releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/glx/GLContextGLX.h

    r205734 r205956  
    3030typedef unsigned long XID;
    3131typedef void* ContextKeyType;
     32typedef struct _XDisplay Display;
    3233
    3334namespace WebCore {
     
    6566    static std::unique_ptr<GLContextGLX> createPixmapContext(PlatformDisplay&, GLXContext sharingContext = nullptr);
    6667
     68    Display* m_x11Display { nullptr };
    6769    XUniqueGLXContext m_context;
    6870    XID m_window { 0 };
  • releases/WebKitGTK/webkit-2.14/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp

    r204013 r205956  
    3636#if USE(EGL)
    3737#include <EGL/egl.h>
     38#include <EGL/eglplatform.h>
    3839#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"
    3945
    4046namespace WebCore {
     
    5460PlatformDisplayX11::~PlatformDisplayX11()
    5561{
     62    // Clear the sharing context before releasing the display.
     63    m_sharingGLContext = nullptr;
    5664    if (m_ownedDisplay)
    5765        XCloseDisplay(m_display);
Note: See TracChangeset for help on using the changeset viewer.