Changeset 220742 in webkit


Ignore:
Timestamp:
Aug 15, 2017 7:16:29 AM (7 years ago)
Author:
Michael Catanzaro
Message:

Unreviewed, rolling out r220700.

Broke debug bot

Reverted changeset:

"[CoordGraphics] Simplify CoordinatedGraphicsScene state
updates"
https://bugs.webkit.org/show_bug.cgi?id=175528
http://trac.webkit.org/changeset/220700

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r220741 r220742  
     12017-08-15  Michael Catanzaro  <mcatanzaro@igalia.com>
     2
     3        Unreviewed, rolling out r220700.
     4
     5        Broke debug bot
     6
     7        Reverted changeset:
     8
     9        "[CoordGraphics] Simplify CoordinatedGraphicsScene state
     10        updates"
     11        https://bugs.webkit.org/show_bug.cgi?id=175528
     12        http://trac.webkit.org/changeset/220700
     13
    1142017-08-15  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

    r220700 r220742  
    7878}
    7979
    80 void CoordinatedGraphicsScene::applyStateChanges(const Vector<CoordinatedGraphicsState>& states)
     80void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, const Color& backgroundColor, bool drawsBackground, const FloatPoint& contentPosition, TextureMapper::PaintFlags PaintFlags)
    8181{
    8282    if (!m_textureMapper) {
     
    8585    }
    8686
    87     ensureRootLayer();
    88 
    89     for (auto& state : states)
    90         commitSceneState(state);
    91 }
    92 
    93 void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect, const Color& backgroundColor, bool drawsBackground, const FloatPoint& contentPosition, TextureMapper::PaintFlags PaintFlags)
    94 {
     87    syncRemoteContent();
     88
    9589    adjustPositionForFixedLayers(contentPosition);
    9690    TextureMapperLayer* currentRootLayer = rootLayer();
     
    587581}
    588582
     583void CoordinatedGraphicsScene::syncRemoteContent()
     584{
     585    // We enqueue messages and execute them during paint, as they require an active GL context.
     586    ensureRootLayer();
     587
     588    Vector<Function<void()>> renderQueue;
     589    bool calledOnMainThread = RunLoop::isMain();
     590    if (!calledOnMainThread)
     591        m_renderQueueMutex.lock();
     592    renderQueue = WTFMove(m_renderQueue);
     593    if (!calledOnMainThread)
     594        m_renderQueueMutex.unlock();
     595
     596    for (auto& function : renderQueue)
     597        function();
     598}
     599
    589600void CoordinatedGraphicsScene::purgeGLResources()
    590601{
     
    632643    m_isActive = false;
    633644    m_client = nullptr;
     645    LockHolder locker(m_renderQueueMutex);
     646    m_renderQueue.clear();
     647}
     648
     649void CoordinatedGraphicsScene::appendUpdate(Function<void()>&& function)
     650{
     651    if (!m_isActive)
     652        return;
     653
     654    ASSERT(RunLoop::isMain());
     655    LockHolder locker(m_renderQueueMutex);
     656    m_renderQueue.append(WTFMove(function));
    634657}
    635658
    636659void CoordinatedGraphicsScene::setActive(bool active)
    637660{
    638     if (!m_client || m_isActive == active)
    639         return;
    640 
     661    if (!m_client)
     662        return;
     663
     664    if (m_isActive == active)
     665        return;
     666
     667    // Have to clear render queue in both cases.
     668    // If there are some updates in queue during activation then those updates are from previous instance of paint node
     669    // and cannot be applied to the newly created instance.
     670    m_renderQueue.clear();
    641671    m_isActive = active;
    642672    if (m_isActive)
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h

    r220700 r220742  
    6969    explicit CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient*);
    7070    virtual ~CoordinatedGraphicsScene();
    71 
    72     void applyStateChanges(const Vector<WebCore::CoordinatedGraphicsState>&);
    7371    void paintToCurrentGLContext(const WebCore::TransformationMatrix&, float, const WebCore::FloatRect&, const WebCore::Color& backgroundColor, bool drawsBackground, const WebCore::FloatPoint&, WebCore::TextureMapper::PaintFlags = 0);
    7472    void detach();
     73    void appendUpdate(Function<void()>&&);
    7574
    7675    WebCore::TextureMapperLayer* findScrollableContentsLayerAt(const WebCore::FloatPoint&);
     
    126125    WebCore::TextureMapperLayer* rootLayer() { return m_rootLayer.get(); }
    127126
     127    void syncRemoteContent();
    128128    void adjustPositionForFixedLayers(const WebCore::FloatPoint& contentPosition);
    129129
     
    149149    WebCore::TextureMapperGL* texmapGL() override;
    150150#endif
     151
     152    // Render queue can be accessed ony from main thread or updatePaintNode call stack!
     153    Vector<Function<void()>> m_renderQueue;
     154    Lock m_renderQueueMutex;
    151155
    152156    std::unique_ptr<WebCore::TextureMapper> m_textureMapper;
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r220700 r220742  
    209209    bool drawsBackground;
    210210    bool needsResize;
    211     Vector<WebCore::CoordinatedGraphicsState> states;
    212     Vector<uint32_t> atlasesToRemove;
    213 
    214211    {
    215212        LockHolder locker(m_attributes.lock);
     
    220217        needsResize = m_attributes.needsResize;
    221218
    222         states = WTFMove(m_attributes.states);
    223         atlasesToRemove = WTFMove(m_attributes.atlasesToRemove);
    224 
    225         if (!states.isEmpty()) {
    226             // Client has to be notified upon finishing this scene update.
    227             m_attributes.clientRendersNextFrame = true;
    228 
    229             // Coordinate scene update completion with the client in case of changed or updated platform layers.
    230             // But do not change coordinateUpdateCompletionWithClient while in force repaint because that
    231             // demands immediate scene update completion regardless of platform layers.
    232             if (!m_inForceRepaint) {
    233                 bool coordinateUpdate = false;
    234                 for (auto& state : states)
    235                     coordinateUpdate |= std::any_of(state.layersToUpdate.begin(), state.layersToUpdate.end(),
    236                         [](auto& it) { return it.second.platformLayerChanged || it.second.platformLayerUpdated; });
    237                 m_attributes.coordinateUpdateCompletionWithClient = coordinateUpdate;
    238             }
    239         }
    240 
    241219        // Reset the needsResize attribute to false.
    242220        m_attributes.needsResize = false;
     
    255233    }
    256234
    257     m_scene->applyStateChanges(states);
    258     m_scene->releaseUpdateAtlases(atlasesToRemove);
    259235    m_scene->paintToCurrentGLContext(viewportTransform, 1, FloatRect { FloatPoint { }, viewportSize },
    260236        Color::transparent, !drawsBackground, scrollPosition, m_paintFlags);
     
    303279void ThreadedCompositor::updateSceneState(const CoordinatedGraphicsState& state)
    304280{
    305     LockHolder locker(m_attributes.lock);
    306     m_attributes.states.append(state);
     281    ASSERT(RunLoop::isMain());
     282    m_scene->appendUpdate([this, scene = makeRef(*m_scene), state] {
     283        scene->commitSceneState(state);
     284
     285        LockHolder locker(m_attributes.lock);
     286
     287        // Client has to be notified upon finishing this scene update.
     288        m_attributes.clientRendersNextFrame = true;
     289
     290        // Coordinate scene update completion with the client in case of changed or updated platform layers.
     291        // Do not change m_coordinateUpdateCompletionWithClient while in force repaint.
     292        bool coordinateUpdate = !m_inForceRepaint && std::any_of(state.layersToUpdate.begin(), state.layersToUpdate.end(),
     293            [](const std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState>& it) {
     294                return it.second.platformLayerChanged || it.second.platformLayerUpdated;
     295            });
     296
     297        m_attributes.coordinateUpdateCompletionWithClient |= coordinateUpdate;
     298    });
     299
    307300    m_compositingRunLoop->scheduleUpdate();
    308301}
     
    310303void ThreadedCompositor::releaseUpdateAtlases(Vector<uint32_t>&& atlasesToRemove)
    311304{
    312     LockHolder locker(m_attributes.lock);
    313     m_attributes.atlasesToRemove.appendVector(atlasesToRemove);
     305    ASSERT(RunLoop::isMain());
     306    m_scene->appendUpdate([scene = makeRef(*m_scene), atlasesToRemove = WTFMove(atlasesToRemove)] {
     307        scene->releaseUpdateAtlases(atlasesToRemove);
     308    });
    314309    m_compositingRunLoop->scheduleUpdate();
    315310}
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

    r220700 r220742  
    3030#include "CompositingRunLoop.h"
    3131#include "CoordinatedGraphicsScene.h"
    32 #include <WebCore/CoordinatedGraphicsState.h>
    3332#include <WebCore/GLContext.h>
    3433#include <WebCore/IntSize.h>
     
    4241#include <WebCore/DisplayRefreshMonitor.h>
    4342#endif
     43
     44namespace WebCore {
     45struct CoordinatedGraphicsState;
     46}
    4447
    4548namespace WebKit {
     
    124127        bool needsResize { false };
    125128
    126         Vector<WebCore::CoordinatedGraphicsState> states;
    127         Vector<uint32_t> atlasesToRemove;
    128 
    129129        bool clientRendersNextFrame { false };
    130130        bool coordinateUpdateCompletionWithClient { false };
Note: See TracChangeset for help on using the changeset viewer.