WebKit Bugzilla
Attachment 346615 Details for
Bug 188340
: [Nicosia] Add Nicosia::Scene
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188340-20180806092604.patch (text/plain), 13.16 KB, created by
Zan Dobersek
on 2018-08-06 00:26:05 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2018-08-06 00:26:05 PDT
Size:
13.16 KB
patch
obsolete
>Subversion Revision: 234586 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 35b4a0bee7cbfc70b72a03107b6fe4225ea06ee0..69fbcdc5c91f18864cb1e4755ebeac233bb970f8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-08-06 Zan Dobersek <zdobersek@igalia.com> >+ >+ [Nicosia] Add Nicosia::Scene >+ https://bugs.webkit.org/show_bug.cgi?id=188340 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add the Nicosia::Scene class that controls the scene's state and enables >+ thread-safe updates to that state. >+ >+ The State struct itself holds a set of all the layers in the scene, and >+ separates out the root layer specifically. An ID counter is also present >+ there, allowing consumers of this state to easily check for any updates. >+ >+ A reference to the Nicosia::Scene object now replaces the >+ HashSet-and-root-layer pair in the CoordinatedGraphicsState struct. >+ >+ * platform/TextureMapper.cmake: >+ * platform/graphics/nicosia/NicosiaScene.cpp: Added. >+ * platform/graphics/nicosia/NicosiaScene.h: Added. >+ (Nicosia::Scene::create): >+ (Nicosia::Scene::accessState): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: >+ > 2018-08-05 Yusuke Suzuki <utatane.tea@gmail.com> > > Add support for microtasks in workers >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 079c46f177579123f13f5d6813f9990147462db3..8d55c54039b16b7e891179f85dd9cdb6fcfe2023 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,30 @@ >+2018-08-06 Zan Dobersek <zdobersek@igalia.com> >+ >+ [Nicosia] Add Nicosia::Scene >+ https://bugs.webkit.org/show_bug.cgi?id=188340 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ CompositingCoordinator spawns a Nicosia::Scene object that it shares >+ with the CoordinatedGraphicsSceneState instance. All the >+ Nicosia::CompositionLayer objects indirectly managed by >+ CompositingCoordinator are now stored in a local Nicosia::Scene::State >+ member object. Upon each flush that requires frame synchronization the >+ Nicosia::Scene object is updated in a thread-safe manner, increasing >+ the scene ID value as well as copying the local HashSet and root layer >+ values into the shared Scene object, allowing for the consumer (which >+ currently is the related CoordinatedGraphicsScene instance) to update >+ its output accordingly. >+ >+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: >+ (WebKit::CompositingCoordinator::CompositingCoordinator): >+ (WebKit::CompositingCoordinator::flushPendingLayerChanges): >+ (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded): >+ (WebKit::CompositingCoordinator::createGraphicsLayer): >+ (WebKit::CompositingCoordinator::detachLayer): >+ (WebKit::CompositingCoordinator::attachLayer): >+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h: >+ > 2018-08-05 Yusuke Suzuki <utatane.tea@gmail.com> > > Add support for microtasks in workers >diff --git a/Source/WebCore/platform/TextureMapper.cmake b/Source/WebCore/platform/TextureMapper.cmake >index 861085f829ea50896450010c72c8d6de4005f5a5..dbec3883ecf1aa50bffd9d5590b35278e12c2c0e 100644 >--- a/Source/WebCore/platform/TextureMapper.cmake >+++ b/Source/WebCore/platform/TextureMapper.cmake >@@ -52,6 +52,7 @@ if (USE_COORDINATED_GRAPHICS) > platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp > platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp > platform/graphics/nicosia/NicosiaPlatformLayer.cpp >+ platform/graphics/nicosia/NicosiaScene.cpp > > platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp > platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaScene.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaScene.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..eb23b3c5ba01a656b6b36ec6e75a95e7b123f926 >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaScene.cpp >@@ -0,0 +1,42 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials provided >+ * with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "NicosiaScene.h" >+ >+#include "NicosiaPlatformLayer.h" >+ >+namespace Nicosia { >+ >+Scene::Scene() = default; >+Scene::~Scene() = default; >+ >+Scene::State::State() = default; >+Scene::State::~State() = default; >+ >+} // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaScene.h b/Source/WebCore/platform/graphics/nicosia/NicosiaScene.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c3a363372a2953f1d9db4428895384256357d0ac >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaScene.h >@@ -0,0 +1,74 @@ >+/* >+ * Copyright (C) 2018 Metrological Group B.V. >+ * Copyright (C) 2018 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials provided >+ * with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#include <cstdint> >+#include <wtf/HashSet.h> >+#include <wtf/Lock.h> >+#include <wtf/RefPtr.h> >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace Nicosia { >+ >+class CompositionLayer; >+ >+class Scene : public ThreadSafeRefCounted<Scene> { >+public: >+ static Ref<Scene> create() >+ { >+ return adoptRef(*new Scene); >+ } >+ ~Scene(); >+ >+ struct State { >+ State(); >+ ~State(); >+ >+ uint32_t id { 0 }; >+ HashSet<RefPtr<Nicosia::CompositionLayer>> layers; >+ RefPtr<Nicosia::CompositionLayer> rootLayer; >+ }; >+ >+ template<typename F> >+ void accessState(const F& functor) >+ { >+ LockHolder locker(m_scene.lock); >+ functor(m_scene.state); >+ } >+ >+private: >+ Scene(); >+ >+ struct { >+ Lock lock; >+ State state; >+ } m_scene; >+}; >+ >+} // namespace Nicosia >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >index e734509350dcdc25e3f485197e4a350e0a3bc2f2..6f9624f4e5d4b101c2ee611113e19d987b6e499b 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h >@@ -38,6 +38,7 @@ > #include "IntSize.h" > #include "NicosiaBuffer.h" > #include "NicosiaPlatformLayer.h" >+#include "NicosiaScene.h" > #include "SurfaceUpdateInfo.h" > #include "TextureMapperAnimation.h" > #include "TransformationMatrix.h" >@@ -171,8 +172,7 @@ struct CoordinatedGraphicsLayerState { > > struct CoordinatedGraphicsState { > struct NicosiaState { >- HashSet<RefPtr<Nicosia::CompositionLayer>> layers; >- RefPtr<Nicosia::CompositionLayer> rootLayer; >+ RefPtr<Nicosia::Scene> scene; > } nicosia; > > uint32_t rootCompositingLayer; >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >index bf19a319c4b1190b3cdd41f54eb2ab5f2b3369fd..4ec0f5ea1a318c18c8ade2cd9b82c3fd75bfb7b2 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp >@@ -52,6 +52,8 @@ CompositingCoordinator::CompositingCoordinator(Page* page, CompositingCoordinato > , m_client(client) > , m_paintingEngine(Nicosia::PaintingEngine::create()) > { >+ m_nicosia.scene = Nicosia::Scene::create(); >+ m_state.nicosia.scene = m_nicosia.scene; > } > > CompositingCoordinator::~CompositingCoordinator() >@@ -125,6 +127,14 @@ bool CompositingCoordinator::flushPendingLayerChanges() > if (m_shouldSyncFrame) { > didSync = true; > >+ m_state.nicosia.scene->accessState( >+ [this](Nicosia::Scene::State& state) >+ { >+ ++state.id; >+ state.layers = m_nicosia.state.layers; >+ state.rootLayer = m_nicosia.state.rootLayer; >+ }); >+ > m_client.commitSceneState(m_state); > > clearPendingStateChanges(); >@@ -172,7 +182,7 @@ void CompositingCoordinator::initializeRootCompositingLayerIfNeeded() > return; > > auto& rootLayer = downcast<CoordinatedGraphicsLayer>(*m_rootLayer); >- m_state.nicosia.rootLayer = rootLayer.compositionLayer(); >+ m_nicosia.state.rootLayer = rootLayer.compositionLayer(); > m_state.rootCompositingLayer = rootLayer.id(); > m_didInitializeRootCompositingLayer = true; > m_shouldSyncFrame = true; >@@ -263,7 +273,7 @@ std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(Graph > { > CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(layerType, client); > layer->setCoordinator(this); >- m_state.nicosia.layers.add(layer->compositionLayer()); >+ m_nicosia.state.layers.add(layer->compositionLayer()); > m_registeredLayers.add(layer->id(), layer); > m_state.layersToCreate.append(layer->id()); > layer->setNeedsVisibleRectAdjustment(); >@@ -304,7 +314,7 @@ void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer) > if (m_isPurging) > return; > >- m_state.nicosia.layers.remove(layer->compositionLayer()); >+ m_nicosia.state.layers.remove(layer->compositionLayer()); > m_registeredLayers.remove(layer->id()); > > size_t index = m_state.layersToCreate.find(layer->id()); >@@ -320,7 +330,7 @@ void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer) > void CompositingCoordinator::attachLayer(CoordinatedGraphicsLayer* layer) > { > layer->setCoordinator(this); >- m_state.nicosia.layers.add(layer->compositionLayer()); >+ m_nicosia.state.layers.add(layer->compositionLayer()); > m_registeredLayers.add(layer->id(), layer); > m_state.layersToCreate.append(layer->id()); > layer->setNeedsVisibleRectAdjustment(); >diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >index 464eb9ee45f6a822574f1d322e8ed650c40171ed..4308eae2ff6207db56d06f554d3b85f8e8057e9c 100644 >--- a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >+++ b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h >@@ -128,6 +128,10 @@ private: > WebCore::GraphicsLayer* m_rootCompositingLayer { nullptr }; > WebCore::GraphicsLayer* m_overlayCompositingLayer { nullptr }; > >+ struct { >+ RefPtr<Nicosia::Scene> scene; >+ Nicosia::Scene::State state; >+ } m_nicosia; > WebCore::CoordinatedGraphicsState m_state; > > HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188340
: 346615