⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 180924 in webkit


Ignore:
Timestamp:
Mar 3, 2015, 12:10:01 AM (11 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(r177075): WebProcess crashes when entering accelerating compositing mode before the WebView is realized
https://bugs.webkit.org/show_bug.cgi?id=142079

Reviewed by Žan Doberšek.

The problem is that the texture mapper and native window handler
are initialized when the LayerTreeHost is initialized, assuming
the UI process has already sent the native window handler to the
web process, but that doesn't always happen since we moved the
redirected window creation to realize in r177075.

  • WebProcess/WebPage/DrawingArea.h:

(WebKit::DrawingArea::nativeSurfaceHandleForCompositing): Deleted.

  • WebProcess/WebPage/DrawingAreaImpl.cpp:

(WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): Call
LayerTreeHost::setNativeSurfaceHandleForCompositing if we
already have a native window handle at this point.
(WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
Call LayerTreeHost::setNativeSurfaceHandleForCompositing also when
not using threaded compositing.

  • WebProcess/WebPage/LayerTreeHost.h:
  • WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:

(WebKit::LayerTreeHostGtk::makeContextCurrent): Helper function to
ensure a context and making it current.
(WebKit::LayerTreeHostGtk::ensureTextureMapper): Ensure a texture
is created for the current context.
(WebKit::LayerTreeHostGtk::initialize): Use makeContextCurrent()
and ensureTextureMapper(), and remove the LayerTreeContext
initialization since that's is now always initialized in
setNativeSurfaceHandleForCompositing().
(WebKit::LayerTreeHostGtk::compositeLayersToContext): Use
makeContextCurrent() helper function and also call
ensureTextureMapper() just in case the texture could not be
created during initialization because the native window handle was
not yet available.
(WebKit::LayerTreeHostGtk::flushAndRenderLayers): Use makeContextCurrent().
(WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
Initialize the LayerTreeContext.
(WebKit::LayerTreeHostGtk::glContext): Deleted.

  • WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r180921 r180924  
     12015-03-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r177075): WebProcess crashes when entering accelerating compositing mode before the WebView is realized
     4        https://bugs.webkit.org/show_bug.cgi?id=142079
     5
     6        Reviewed by Žan Doberšek.
     7
     8        The problem is that the texture mapper and native window handler
     9        are initialized when the LayerTreeHost is initialized, assuming
     10        the UI process has already sent the native window handler to the
     11        web process, but that doesn't always happen since we moved the
     12        redirected window creation to realize in r177075.
     13
     14        * WebProcess/WebPage/DrawingArea.h:
     15        (WebKit::DrawingArea::nativeSurfaceHandleForCompositing): Deleted.
     16        * WebProcess/WebPage/DrawingAreaImpl.cpp:
     17        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): Call
     18        LayerTreeHost::setNativeSurfaceHandleForCompositing if we
     19        already have a native window handle at this point.
     20        (WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
     21        Call LayerTreeHost::setNativeSurfaceHandleForCompositing also when
     22        not using threaded compositing.
     23        * WebProcess/WebPage/LayerTreeHost.h:
     24        * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
     25        (WebKit::LayerTreeHostGtk::makeContextCurrent): Helper function to
     26        ensure a context and making it current.
     27        (WebKit::LayerTreeHostGtk::ensureTextureMapper): Ensure a texture
     28        is created for the current context.
     29        (WebKit::LayerTreeHostGtk::initialize): Use makeContextCurrent()
     30        and ensureTextureMapper(), and remove the LayerTreeContext
     31        initialization since that's is now always initialized in
     32        setNativeSurfaceHandleForCompositing().
     33        (WebKit::LayerTreeHostGtk::compositeLayersToContext): Use
     34        makeContextCurrent() helper function and also call
     35        ensureTextureMapper() just in case the texture could not be
     36        created during initialization because the native window handle was
     37        not yet available.
     38        (WebKit::LayerTreeHostGtk::flushAndRenderLayers): Use makeContextCurrent().
     39        (WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing):
     40        Initialize the LayerTreeContext.
     41        (WebKit::LayerTreeHostGtk::glContext): Deleted.
     42        * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
     43
    1442015-03-02  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    245
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h

    r178095 r180924  
    125125    virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) { }
    126126
    127 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
    128     uint64_t nativeSurfaceHandleForCompositing() { return m_nativeSurfaceHandleForCompositing; }
    129 #endif
    130 
    131127protected:
    132128    DrawingArea(DrawingAreaType, WebPage&);
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

    r179182 r180924  
    457457
    458458    m_layerTreeHost = LayerTreeHost::create(&m_webPage);
     459    if (m_nativeSurfaceHandleForCompositing)
     460        m_layerTreeHost->setNativeSurfaceHandleForCompositing(m_nativeSurfaceHandleForCompositing);
    459461    if (!m_inUpdateBackingStoreState)
    460462        m_layerTreeHost->setShouldNotifyAfterNextScheduledLayerFlush(true);
     
    678680    m_webPage.corePage()->settings().setAcceleratedCompositingEnabled(true);
    679681
    680 #if USE(COORDINATED_GRAPHICS_THREADED)
    681682    if (m_layerTreeHost)
    682683        m_layerTreeHost->setNativeSurfaceHandleForCompositing(handle);
     684}
    683685#endif
    684 }
    685 #endif
    686686
    687687} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h

    r179182 r180924  
    9494#endif
    9595
     96#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
     97    virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
     98#endif
     99
    96100    virtual void setViewOverlayRootLayer(WebCore::GraphicsLayer*) = 0;
    97101
  • trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp

    r179182 r180924  
    7979}
    8080
    81 GLContext* LayerTreeHostGtk::glContext()
    82 {
    83     if (m_context)
    84         return m_context.get();
    85 
    86     uint64_t windowHandle = m_webPage->drawingArea()->nativeSurfaceHandleForCompositing();
    87     if (!windowHandle)
    88         return 0;
    89 
    90     m_context = GLContext::createContextForWindow(windowHandle, GLContext::sharingContext());
    91     return m_context.get();
     81bool LayerTreeHostGtk::makeContextCurrent()
     82{
     83    if (!m_context) {
     84        if (!m_layerTreeContext.contextID)
     85            return false;
     86
     87        m_context = GLContext::createContextForWindow(m_layerTreeContext.contextID, GLContext::sharingContext());
     88        if (!m_context)
     89            return false;
     90    }
     91
     92    return m_context->makeContextCurrent();
     93}
     94
     95void LayerTreeHostGtk::ensureTextureMapper()
     96{
     97    if (m_textureMapper)
     98        return;
     99
     100    ASSERT(m_isValid);
     101    m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
     102    static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
     103    downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());
    92104}
    93105
     
    114126    m_nonCompositedContentLayer->setNeedsDisplay();
    115127
    116     m_layerTreeContext.contextID = m_webPage->drawingArea()->nativeSurfaceHandleForCompositing();
    117 
    118     GLContext* context = glContext();
    119     if (!context)
    120         return;
    121 
    122128    // The creation of the TextureMapper needs an active OpenGL context.
    123     context->makeContextCurrent();
    124 
    125     m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
    126     static_cast<TextureMapperGL*>(m_textureMapper.get())->setEnableEdgeDistanceAntialiasing(true);
    127     downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer().setTextureMapper(m_textureMapper.get());
    128 
     129    if (!makeContextCurrent())
     130        return;
     131
     132    ensureTextureMapper();
    129133    scheduleLayerFlush();
    130134}
     
    290294void LayerTreeHostGtk::compositeLayersToContext(CompositePurpose purpose)
    291295{
    292     GLContext* context = glContext();
    293     if (!context || !context->makeContextCurrent())
    294         return;
     296    if (!makeContextCurrent())
     297        return;
     298
     299    ensureTextureMapper();
    295300
    296301    // The window size may be out of sync with the page size at this point, and getting
     
    309314    m_textureMapper->endPainting();
    310315
    311     context->swapBuffers();
     316    m_context->swapBuffers();
    312317}
    313318
     
    322327    }
    323328
    324     GLContext* context = glContext();
    325     if (!context || !context->makeContextCurrent())
     329    if (!makeContextCurrent())
    326330        return;
    327331
     
    381385}
    382386
     387void LayerTreeHostGtk::setNativeSurfaceHandleForCompositing(uint64_t handle)
     388{
     389    m_layerTreeContext.contextID = handle;
     390}
     391
    383392} // namespace WebKit
    384393
  • trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h

    r179182 r180924  
    6262    virtual void pageBackgroundTransparencyChanged() override;
    6363
     64    virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
     65
    6466private:
    6567    // LayerTreeHost
     
    8587    void layerFlushTimerFired();
    8688
    87     WebCore::GLContext* glContext();
     89    bool makeContextCurrent();
     90    void ensureTextureMapper();
    8891
    8992    LayerTreeContext m_layerTreeContext;
Note: See TracChangeset for help on using the changeset viewer.