Diff
Modified: trunk/Source/WebCore/ChangeLog (259283 => 259284)
--- trunk/Source/WebCore/ChangeLog 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/ChangeLog 2020-03-31 09:38:35 UTC (rev 259284)
@@ -1,3 +1,49 @@
+2020-03-31 Zan Dobersek <zdober...@igalia.com>
+
+ [GTK][WPE] Jumpy rendering of fixed-element layers while scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=209466
+
+ Reviewed by Carlos Garcia Campos.
+
+ Avoid intermittent state application that can occur when asynchronous
+ scrolling is done on the dedicated thread while the general scene update
+ is being done in parallel on the composition thread, leading to partial
+ scrolling updates that visually present themselves as e.g. fixed
+ elements "jumping" around the view.
+
+ Instead of the staging state of a given Nicosia::CompositionLayer, the
+ scrolling nodes now update the base state with the given scrolling
+ change. At the end of the update, inside the UpdateScope descructor,
+ the updated states inside the scene are flushed into the staging phase
+ before they are adopted by the composition thread.
+
+ * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp:
+ (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
+ * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp:
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionScrollingLayers):
+ (WebCore::ScrollingTreeFrameScrollingNodeNicosia::repositionRelatedLayers):
+ * page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp:
+ (WebCore::ScrollingTreeOverflowScrollProxyNode::applyLayerPositions):
+ * page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp:
+ (WebCore::ScrollingTreeOverflowScrollingNodeNicosia::repositionScrollingLayers):
+ * page/scrolling/nicosia/ScrollingTreePositionedNode.cpp:
+ (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
+ * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp:
+ (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
+ * platform/graphics/nicosia/NicosiaPlatformLayer.h:
+ (Nicosia::CompositionLayer::accessStaging): Deleted.
+ * platform/graphics/nicosia/NicosiaSceneIntegration.cpp:
+ (Nicosia::SceneIntegration::SceneIntegration):
+ (Nicosia::SceneIntegration::invalidate):
+ (Nicosia::SceneIntegration::UpdateScope::~UpdateScope):
+ * platform/graphics/nicosia/NicosiaSceneIntegration.h:
+ (Nicosia::SceneIntegration::create):
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::syncPosition):
+ Don't signal the related attribute delta flag since this change is now
+ strictly applied by the scrolling thread.
+ (WebCore::CoordinatedGraphicsLayer::syncBoundsOrigin): Ditto.
+
2020-03-30 Simon Fraser <simon.fra...@apple.com>
Scroll latching state is not a stack
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNode.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNode.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFixedNode.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -100,7 +100,7 @@
LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " relatedNodeScrollPositionDidChange: viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " layerPosition " << layerPosition);
ASSERT(m_layer);
- m_layer->accessStaging(
+ m_layer->updateState(
[&layerPosition](Nicosia::CompositionLayer::LayerState& state)
{
state.position = layerPosition;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -182,7 +182,7 @@
auto scrollPosition = currentScrollPosition();
- compositionLayer.accessStaging(
+ compositionLayer.updateState(
[&scrollPosition](Nicosia::CompositionLayer::LayerState& state)
{
state.position = -scrollPosition;
@@ -200,7 +200,7 @@
auto applyLayerPosition =
[](auto& layer, auto&& position)
{
- layer.accessStaging(
+ layer.updateState(
[&position](Nicosia::CompositionLayer::LayerState& state)
{
state.position = position;
@@ -213,7 +213,7 @@
float topContentInset = this->topContentInset();
if (m_insetClipLayer && m_rootContentsLayer) {
- m_insetClipLayer->accessStaging(
+ m_insetClipLayer->updateState(
[&scrollPosition, &topContentInset](Nicosia::CompositionLayer::LayerState& state)
{
state.position = { state.position.x(), FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset) };
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollProxyNode.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -84,7 +84,7 @@
}
LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollProxyNode " << scrollingNodeID() << " applyLayerPositions: setting bounds origin to " << scrollOffset);
- m_layer->accessStaging(
+ m_layer->updateState(
[&scrollOffset](Nicosia::CompositionLayer::LayerState& state)
{
state.boundsOrigin = scrollOffset;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeOverflowScrollingNodeNicosia.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -91,7 +91,7 @@
auto scrollOffset = currentScrollOffset();
- compositionLayer.accessStaging(
+ compositionLayer.updateState(
[&scrollOffset](Nicosia::CompositionLayer::LayerState& state)
{
state.boundsOrigin = scrollOffset;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNode.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNode.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreePositionedNode.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -90,7 +90,7 @@
layerPosition -= m_constraints.alignmentOffset();
ASSERT(m_layer);
- m_layer->accessStaging(
+ m_layer->updateState(
[&layerPosition](Nicosia::CompositionLayer::LayerState& state)
{
state.position = layerPosition;
Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNode.cpp (259283 => 259284)
--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNode.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingTreeStickyNode.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -81,7 +81,7 @@
layerPosition -= m_constraints.alignmentOffset();
ASSERT(m_layer);
- m_layer->accessStaging(
+ m_layer->updateState(
[&layerPosition](Nicosia::CompositionLayer::LayerState& state)
{
state.position = layerPosition;
Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h (259283 => 259284)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h 2020-03-31 09:38:35 UTC (rev 259284)
@@ -282,13 +282,6 @@
}
template<typename T>
- void accessStaging(const T& functor)
- {
- LockHolder locker(PlatformLayer::m_state.lock);
- functor(m_state.staging);
- }
-
- template<typename T>
void accessCommitted(const T& functor)
{
LockHolder locker(PlatformLayer::m_state.lock);
Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp (259283 => 259284)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -29,10 +29,14 @@
#include "config.h"
#include "NicosiaSceneIntegration.h"
+#include "NicosiaPlatformLayer.h"
+#include "NicosiaScene.h"
+
namespace Nicosia {
-SceneIntegration::SceneIntegration(Client& client)
+SceneIntegration::SceneIntegration(Scene& scene, Client& client)
{
+ m_client.scene = makeRef(scene);
m_client.object = &client;
}
@@ -50,6 +54,7 @@
void SceneIntegration::invalidate()
{
LockHolder locker(m_client.lock);
+ m_client.scene = nullptr;
m_client.object = nullptr;
}
@@ -75,6 +80,16 @@
SceneIntegration::UpdateScope::~UpdateScope()
{
+ if (!m_sceneIntegration->m_client.scene)
+ return;
+
+ m_sceneIntegration->m_client.scene->accessState(
+ [](Nicosia::Scene::State& state)
+ {
+ for (auto& compositionLayer : state.layers)
+ compositionLayer->flushState([](auto&) { });
+ });
+
auto& sceneIntegrationObj = m_sceneIntegration.get();
if (sceneIntegrationObj.m_client.object)
sceneIntegrationObj.m_client.object->requestUpdate();
Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h (259283 => 259284)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaSceneIntegration.h 2020-03-31 09:38:35 UTC (rev 259284)
@@ -30,11 +30,13 @@
#include <memory>
#include <wtf/Lock.h>
-#include <wtf/Ref.h>
+#include <wtf/RefPtr.h>
#include <wtf/ThreadSafeRefCounted.h>
namespace Nicosia {
+class Scene;
+
class SceneIntegration : public ThreadSafeRefCounted<SceneIntegration> {
public:
class Client {
@@ -44,9 +46,9 @@
virtual void requestUpdate() = 0;
};
- static Ref<SceneIntegration> create(Client& client)
+ static Ref<SceneIntegration> create(Scene& scene, Client& client)
{
- return adoptRef(*new SceneIntegration(client));
+ return adoptRef(*new SceneIntegration(scene, client));
}
~SceneIntegration();
@@ -69,10 +71,11 @@
std::unique_ptr<UpdateScope> createUpdateScope();
private:
- explicit SceneIntegration(Client&);
+ explicit SceneIntegration(Scene&, Client&);
struct {
Lock lock;
+ RefPtr<Scene> scene;
Client* object { nullptr };
} m_client;
};
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (259283 => 259284)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -245,7 +245,6 @@
return;
GraphicsLayer::syncPosition(p);
- m_nicosia.delta.positionChanged = true;
didChangeGeometry(FlushNotification::NotRequired);
}
@@ -288,7 +287,6 @@
return;
GraphicsLayer::syncBoundsOrigin(boundsOrigin);
- m_nicosia.delta.boundsOriginChanged = true;
didChangeGeometry(FlushNotification::NotRequired);
}
Modified: trunk/Source/WebKit/ChangeLog (259283 => 259284)
--- trunk/Source/WebKit/ChangeLog 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebKit/ChangeLog 2020-03-31 09:38:35 UTC (rev 259284)
@@ -1,3 +1,29 @@
+2020-03-31 Zan Dobersek <zdober...@igalia.com>
+
+ [GTK][WPE] Jumpy rendering of fixed-element layers while scrolling
+ https://bugs.webkit.org/show_bug.cgi?id=209466
+
+ Reviewed by Carlos Garcia Campos.
+
+ Move the Nicosia::SceneIntegration ownership into the
+ CompositingCoordinator class, along with the SceneIntegration::Client
+ inheritance. LayerTreeHost in turn now implements the updateScene()
+ method that triggers a scene update when invoked.
+
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+ (WebKit::CompositingCoordinator::CompositingCoordinator):
+ (WebKit::CompositingCoordinator::invalidate):
+ (WebKit::CompositingCoordinator::attachLayer):
+ (WebKit::CompositingCoordinator::requestUpdate):
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
+ (WebKit::LayerTreeHost::LayerTreeHost):
+ (WebKit::LayerTreeHost::~LayerTreeHost):
+ (WebKit::LayerTreeHost::updateScene):
+ (WebKit::LayerTreeHost::sceneIntegration): Deleted.
+ (WebKit::LayerTreeHost::requestUpdate): Deleted.
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h:
+
2020-03-31 Carlos Garcia Campos <cgar...@igalia.com>
REGRESSION(r258829): [CoordinatedGraphics] Web view not updated after cross site navigation with PSON enabled
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (259283 => 259284)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -56,6 +56,7 @@
, m_paintingEngine(Nicosia::PaintingEngine::create())
{
m_nicosia.scene = Nicosia::Scene::create();
+ m_nicosia.sceneIntegration = Nicosia::SceneIntegration::create(*m_nicosia.scene, *this);
m_state.nicosia.scene = m_nicosia.scene;
m_rootLayer = GraphicsLayer::create(this, *this);
@@ -76,6 +77,8 @@
void CompositingCoordinator::invalidate()
{
+ m_nicosia.sceneIntegration->invalidate();
+
m_rootLayer = nullptr;
purgeBackingStores();
}
@@ -279,7 +282,7 @@
{
auto& compositionLayer = layer->compositionLayer();
m_nicosia.state.layers.add(compositionLayer);
- compositionLayer->setSceneIntegration(m_client.sceneIntegration());
+ compositionLayer->setSceneIntegration(m_nicosia.sceneIntegration.copyRef());
}
m_registeredLayers.add(layer->id(), layer);
layer->setNeedsVisibleRectAdjustment();
@@ -303,6 +306,11 @@
return *m_paintingEngine;
}
+void CompositingCoordinator::requestUpdate()
+{
+ m_client.updateScene();
+}
+
} // namespace WebKit
#endif // USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (259283 => 259284)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2020-03-31 09:38:35 UTC (rev 259284)
@@ -37,6 +37,7 @@
#include <WebCore/IntRect.h>
#include <WebCore/NicosiaBuffer.h>
#include <WebCore/NicosiaPlatformLayer.h>
+#include <WebCore/NicosiaSceneIntegration.h>
namespace Nicosia {
class PaintingEngine;
@@ -52,7 +53,8 @@
class CompositingCoordinator final : public WebCore::GraphicsLayerClient
, public WebCore::CoordinatedGraphicsLayerClient
- , public WebCore::GraphicsLayerFactory {
+ , public WebCore::GraphicsLayerFactory
+ , public Nicosia::SceneIntegration::Client {
WTF_MAKE_NONCOPYABLE(CompositingCoordinator);
public:
class Client {
@@ -60,7 +62,7 @@
virtual void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) = 0;
virtual void notifyFlushRequired() = 0;
virtual void commitSceneState(const WebCore::CoordinatedGraphicsState&) = 0;
- virtual RefPtr<Nicosia::SceneIntegration> sceneIntegration() = 0;
+ virtual void updateScene() = 0;
};
CompositingCoordinator(WebPage&, CompositingCoordinator::Client&);
@@ -105,6 +107,9 @@
// GraphicsLayerFactory
Ref<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
+ // Nicosia::SceneIntegration::Client
+ void requestUpdate() override;
+
void initializeRootCompositingLayerIfNeeded();
void purgeBackingStores();
@@ -120,6 +125,7 @@
struct {
RefPtr<Nicosia::Scene> scene;
+ RefPtr<Nicosia::SceneIntegration> sceneIntegration;
Nicosia::Scene::State state;
} m_nicosia;
WebCore::CoordinatedGraphicsState m_state;
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (259283 => 259284)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2020-03-31 09:38:35 UTC (rev 259284)
@@ -52,7 +52,6 @@
, m_surface(AcceleratedSurface::create(webPage, *this))
, m_viewportController(webPage.size())
, m_layerFlushTimer(RunLoop::main(), this, &LayerTreeHost::layerFlushTimerFired)
- , m_sceneIntegration(Nicosia::SceneIntegration::create(*this))
, m_coordinator(webPage, *this)
, m_displayID(std::numeric_limits<uint32_t>::max() - m_webPage.identifier().toUInt64())
{
@@ -86,7 +85,6 @@
{
cancelPendingLayerFlush();
- m_sceneIntegration->invalidate();
m_coordinator.invalidate();
m_compositor->invalidate();
m_surface = nullptr;
@@ -360,9 +358,9 @@
m_compositor->updateSceneState(state);
}
-RefPtr<Nicosia::SceneIntegration> LayerTreeHost::sceneIntegration()
+void LayerTreeHost::updateScene()
{
- return m_sceneIntegration.copyRef();
+ m_compositor->updateScene();
}
void LayerTreeHost::frameComplete()
@@ -370,11 +368,6 @@
m_compositor->frameComplete();
}
-void LayerTreeHost::requestUpdate()
-{
- m_compositor->updateScene();
-}
-
uint64_t LayerTreeHost::nativeSurfaceHandleForCompositing()
{
m_surface->initialize();
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h (259283 => 259284)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h 2020-03-31 09:10:58 UTC (rev 259283)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h 2020-03-31 09:38:35 UTC (rev 259284)
@@ -40,7 +40,6 @@
#include <wtf/RunLoop.h>
#if USE(COORDINATED_GRAPHICS)
-#include <WebCore/NicosiaSceneIntegration.h>
#endif
namespace WebCore {
@@ -58,7 +57,7 @@
class LayerTreeHost
#if USE(COORDINATED_GRAPHICS)
- final : public CompositingCoordinator::Client, public AcceleratedSurface::Client, public Nicosia::SceneIntegration::Client
+ final : public CompositingCoordinator::Client, public AcceleratedSurface::Client
#endif
{
WTF_MAKE_FAST_ALLOCATED;
@@ -108,14 +107,11 @@
void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) override;
void notifyFlushRequired() override { scheduleLayerFlush(); };
void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
- RefPtr<Nicosia::SceneIntegration> sceneIntegration() override;
+ void updateScene() override;
// AcceleratedSurface::Client
void frameComplete() override;
- // Nicosia::SceneIntegration::Client
- void requestUpdate() override;
-
uint64_t nativeSurfaceHandleForCompositing();
void didDestroyGLContext();
void willRenderFrame();
@@ -200,7 +196,6 @@
bool needsFreshFlush { false };
} m_forceRepaintAsync;
RunLoop::Timer<LayerTreeHost> m_layerFlushTimer;
- Ref<Nicosia::SceneIntegration> m_sceneIntegration;
CompositingCoordinator m_coordinator;
#endif // USE(COORDINATED_GRAPHICS)
WebCore::PlatformDisplayID m_displayID;