Changeset 246400 in webkit


Ignore:
Timestamp:
Jun 13, 2019 7:05:39 AM (5 years ago)
Author:
zandobersek@gmail.com
Message:

[Nicosia] Add SceneIntegration
https://bugs.webkit.org/show_bug.cgi?id=198791

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Add the SceneIntegration class to the Nicosia namespace, primarily for
the purpose of being able to conveniently trigger scene updates whenever
changes are done to the state of layers that are included in that scene.
Initially this would be used for layer changes done on a
scrolling-dedicated thread.

Each Nicosia::PlatformLayer can have a SceneIntegration object reference
associated. Helper createUpdateScope() method returns a
SceneIntegration::UpdateScope instance that triggers an update for the
scene when that instance is destroyed (normally when it goes out of the
scope).

  • platform/TextureMapper.cmake:
  • platform/graphics/nicosia/NicosiaPlatformLayer.h:

(Nicosia::PlatformLayer::setSceneIntegration):
(Nicosia::PlatformLayer::createUpdateScope):

  • platform/graphics/nicosia/NicosiaSceneIntegration.cpp: Added.

(Nicosia::SceneIntegration::SceneIntegration):
(Nicosia::SceneIntegration::~SceneIntegration):
(Nicosia::SceneIntegration::setClient):
(Nicosia::SceneIntegration::invalidate):
(Nicosia::SceneIntegration::requestUpdate):
(Nicosia::SceneIntegration::createUpdateScope):
(Nicosia::SceneIntegration::UpdateScope::UpdateScope):
(Nicosia::SceneIntegration::UpdateScope::~UpdateScope):

  • platform/graphics/nicosia/NicosiaSceneIntegration.h: Added.

Source/WebKit:

Have the LayerTreeHost own the SceneIntegration object that's to be
associated with layers used inside the LayerTreeHost's scene. The
class now also inherits the SceneIntegration::Client interface, with the
requestUpdate() method scheduling a scene update in ThreadedCompositor.

CompositingCoordinator now retrieves the SceneIntegration object from
the LayerTreeHost instance and manages association to that object for
layers under the coordinator's control.

ThreadedCompositor class gets a new public updateScene() method that
schedules an update, enabling the SceneIntegration class to invoke
scene updates.

  • Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:

(WebKit::ThreadedCompositor::updateScene):

  • Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
  • WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:

(WebKit::CompositingCoordinator::createGraphicsLayer):
(WebKit::CompositingCoordinator::detachLayer):
(WebKit::CompositingCoordinator::attachLayer):

  • WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
  • WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:

(WebKit::LayerTreeHost::LayerTreeHost):
(WebKit::LayerTreeHost::sceneIntegration):
(WebKit::LayerTreeHost::requestUpdate):

  • WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
Location:
trunk/Source
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246399 r246400  
     12019-06-13  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [Nicosia] Add SceneIntegration
     4        https://bugs.webkit.org/show_bug.cgi?id=198791
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Add the SceneIntegration class to the Nicosia namespace, primarily for
     9        the purpose of being able to conveniently trigger scene updates whenever
     10        changes are done to the state of layers that are included in that scene.
     11        Initially this would be used for layer changes done on a
     12        scrolling-dedicated thread.
     13
     14        Each Nicosia::PlatformLayer can have a SceneIntegration object reference
     15        associated. Helper createUpdateScope() method returns a
     16        SceneIntegration::UpdateScope instance that triggers an update for the
     17        scene when that instance is destroyed (normally when it goes out of the
     18        scope).
     19
     20        * platform/TextureMapper.cmake:
     21        * platform/graphics/nicosia/NicosiaPlatformLayer.h:
     22        (Nicosia::PlatformLayer::setSceneIntegration):
     23        (Nicosia::PlatformLayer::createUpdateScope):
     24        * platform/graphics/nicosia/NicosiaSceneIntegration.cpp: Added.
     25        (Nicosia::SceneIntegration::SceneIntegration):
     26        (Nicosia::SceneIntegration::~SceneIntegration):
     27        (Nicosia::SceneIntegration::setClient):
     28        (Nicosia::SceneIntegration::invalidate):
     29        (Nicosia::SceneIntegration::requestUpdate):
     30        (Nicosia::SceneIntegration::createUpdateScope):
     31        (Nicosia::SceneIntegration::UpdateScope::UpdateScope):
     32        (Nicosia::SceneIntegration::UpdateScope::~UpdateScope):
     33        * platform/graphics/nicosia/NicosiaSceneIntegration.h: Added.
     34
    1352019-06-13  Philippe Normand  <pnormand@igalia.com>
    236
  • trunk/Source/WebCore/platform/TextureMapper.cmake

    r244443 r246400  
    8383        platform/graphics/nicosia/NicosiaPlatformLayer.cpp
    8484        platform/graphics/nicosia/NicosiaScene.cpp
     85        platform/graphics/nicosia/NicosiaSceneIntegration.cpp
    8586
    8687        platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
     
    101102        platform/graphics/nicosia/NicosiaPlatformLayer.h
    102103        platform/graphics/nicosia/NicosiaScene.h
     104        platform/graphics/nicosia/NicosiaSceneIntegration.h
    103105
    104106        platform/graphics/nicosia/texmap/NicosiaBackingStoreTextureMapperImpl.h
  • trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h

    r235221 r246400  
    3535#include "FloatRect.h"
    3636#include "FloatSize.h"
     37#include "NicosiaSceneIntegration.h"
    3738#include "TextureMapperAnimation.h"
    3839#include "TransformationMatrix.h"
     
    5455    LayerID id() const { return m_id; }
    5556
     57    void setSceneIntegration(RefPtr<SceneIntegration>&& sceneIntegration)
     58    {
     59        LockHolder locker(m_state.lock);
     60        m_state.sceneIntegration = WTFMove(sceneIntegration);
     61    }
     62
     63    std::unique_ptr<SceneIntegration::UpdateScope> createUpdateScope()
     64    {
     65        LockHolder locker(m_state.lock);
     66        if (m_state.sceneIntegration)
     67            return m_state.sceneIntegration->createUpdateScope();
     68        return nullptr;
     69    }
     70
    5671protected:
    5772    explicit PlatformLayer(uint64_t);
     
    6176    struct {
    6277        Lock lock;
     78        RefPtr<SceneIntegration> sceneIntegration;
    6379    } m_state;
    6480};
  • trunk/Source/WebKit/ChangeLog

    r246398 r246400  
     12019-06-13  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [Nicosia] Add SceneIntegration
     4        https://bugs.webkit.org/show_bug.cgi?id=198791
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Have the LayerTreeHost own the SceneIntegration object that's to be
     9        associated with layers used inside the LayerTreeHost's scene. The
     10        class now also inherits the SceneIntegration::Client interface, with the
     11        requestUpdate() method scheduling a scene update in ThreadedCompositor.
     12
     13        CompositingCoordinator now retrieves the SceneIntegration object from
     14        the LayerTreeHost instance and manages association to that object for
     15        layers under the coordinator's control.
     16
     17        ThreadedCompositor class gets a new public updateScene() method that
     18        schedules an update, enabling the SceneIntegration class to invoke
     19        scene updates.
     20
     21        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
     22        (WebKit::ThreadedCompositor::updateScene):
     23        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
     24        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
     25        (WebKit::CompositingCoordinator::createGraphicsLayer):
     26        (WebKit::CompositingCoordinator::detachLayer):
     27        (WebKit::CompositingCoordinator::attachLayer):
     28        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
     29        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
     30        (WebKit::LayerTreeHost::LayerTreeHost):
     31        (WebKit::LayerTreeHost::sceneIntegration):
     32        (WebKit::LayerTreeHost::requestUpdate):
     33        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
     34
    1352019-06-13  Ludovico de Nittis  <ludovico.denittis@collabora.com>
    236
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp

    r246308 r246400  
    270270}
    271271
     272void ThreadedCompositor::updateScene()
     273{
     274    m_compositingRunLoop->scheduleUpdate();
     275}
     276
    272277#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
    273278RefPtr<WebCore::DisplayRefreshMonitor> ThreadedCompositor::displayRefreshMonitor(PlatformDisplayID)
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h

    r246308 r246400  
    7070
    7171    void updateSceneState(const WebCore::CoordinatedGraphicsState&);
     72    void updateScene();
    7273
    7374    void invalidate();
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp

    r243163 r246400  
    236236    auto layer = adoptRef(*new CoordinatedGraphicsLayer(layerType, client));
    237237    layer->setCoordinator(this);
    238     m_nicosia.state.layers.add(layer->compositionLayer());
     238    {
     239        auto& compositionLayer = layer->compositionLayer();
     240        m_nicosia.state.layers.add(compositionLayer);
     241        compositionLayer->setSceneIntegration(m_client.sceneIntegration());
     242    }
    239243    m_registeredLayers.add(layer->id(), layer.ptr());
    240244    layer->setNeedsVisibleRectAdjustment();
     
    276280        return;
    277281
    278     m_nicosia.state.layers.remove(layer->compositionLayer());
     282    {
     283        auto& compositionLayer = layer->compositionLayer();
     284        m_nicosia.state.layers.remove(compositionLayer);
     285        compositionLayer->setSceneIntegration(nullptr);
     286    }
    279287    m_registeredLayers.remove(layer->id());
    280288    notifyFlushRequired(layer);
     
    284292{
    285293    layer->setCoordinator(this);
    286     m_nicosia.state.layers.add(layer->compositionLayer());
     294    {
     295        auto& compositionLayer = layer->compositionLayer();
     296        m_nicosia.state.layers.add(compositionLayer);
     297        compositionLayer->setSceneIntegration(m_client.sceneIntegration());
     298    }
    287299    m_registeredLayers.add(layer->id(), layer);
    288300    layer->setNeedsVisibleRectAdjustment();
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h

    r236016 r246400  
    4141namespace Nicosia {
    4242class PaintingEngine;
     43class SceneIntegration;
    4344}
    4445
     
    6162        virtual void notifyFlushRequired() = 0;
    6263        virtual void commitSceneState(const WebCore::CoordinatedGraphicsState&) = 0;
     64        virtual RefPtr<Nicosia::SceneIntegration> sceneIntegration() = 0;
    6365    };
    6466
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp

    r246308 r246400  
    5454    , m_viewportController(webPage.size())
    5555    , m_layerFlushTimer(RunLoop::main(), this, &LayerTreeHost::layerFlushTimerFired)
     56    , m_sceneIntegration(Nicosia::SceneIntegration::create(*this))
    5657{
    5758#if USE(GLIB_EVENT_LOOP)
     
    367368}
    368369
     370RefPtr<Nicosia::SceneIntegration> LayerTreeHost::sceneIntegration()
     371{
     372    return m_sceneIntegration.copyRef();
     373}
     374
    369375void LayerTreeHost::frameComplete()
    370376{
    371377    m_compositor->frameComplete();
     378}
     379
     380void LayerTreeHost::requestUpdate()
     381{
     382    m_compositor->updateScene();
    372383}
    373384
  • trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h

    r246308 r246400  
    4040#include <wtf/RunLoop.h>
    4141
     42#if USE(COORDINATED_GRAPHICS)
     43#include <WebCore/NicosiaSceneIntegration.h>
     44#endif
     45
    4246namespace WebCore {
    4347class IntRect;
     
    5559class LayerTreeHost
    5660#if USE(COORDINATED_GRAPHICS)
    57     final : public CompositingCoordinator::Client, public AcceleratedSurface::Client
     61    final : public CompositingCoordinator::Client, public AcceleratedSurface::Client, public Nicosia::SceneIntegration::Client
    5862#endif
    5963{
     
    104108    void notifyFlushRequired() override { scheduleLayerFlush(); };
    105109    void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
     110    RefPtr<Nicosia::SceneIntegration> sceneIntegration() override;
    106111
    107112    // AcceleratedSurface::Client
    108113    void frameComplete() override;
     114
     115    // Nicosia::SceneIntegration::Client
     116    void requestUpdate() override;
    109117
    110118    uint64_t nativeSurfaceHandleForCompositing();
     
    194202    } m_forceRepaintAsync;
    195203    RunLoop::Timer<LayerTreeHost> m_layerFlushTimer;
     204    Ref<Nicosia::SceneIntegration> m_sceneIntegration;
    196205#endif // USE(COORDINATED_GRAPHICS)
    197206};
Note: See TracChangeset for help on using the changeset viewer.