Diff
Modified: trunk/Source/WebCore/ChangeLog (225327 => 225328)
--- trunk/Source/WebCore/ChangeLog 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebCore/ChangeLog 2017-11-30 15:12:58 UTC (rev 225328)
@@ -1,3 +1,42 @@
+2017-11-30 Zan Dobersek <zdober...@igalia.com>
+
+ [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
+ https://bugs.webkit.org/show_bug.cgi?id=180141
+
+ Reviewed by Carlos Garcia Campos.
+
+ Introduce a painting engine concept that's used to perform painting
+ for a given GraphicsLayer object.
+
+ The Nicosia::PaintingEngine object is leveraged in the
+ CoordinatedGraphicsLayer::updateContentBuffers() method. It's retrieved
+ through the CoordinatedGraphicsLayerClient interface, with a new method
+ introduced there for this purpose.
+
+ The Nicosia::PaintingEngine interface is kept simple for now, with only
+ a single paint() method. The only current implementation is the
+ PaintingEngineBasic class, which simply reuses the code that was
+ previously in CoordinatedGraphicsLayer::updateContentBuffers(),
+ maintaining the current functionality.
+
+ The Nicosia::PaintingEngine::create() function returns a new
+ PaintingEngine object. For now it defaults to PaintingEngineBasic, but
+ it could be configured at configure-time or even runtime in the future
+ to return a more advanced engine implementation.
+
+ No new tests -- no change in behavior.
+
+ * platform/TextureMapper.cmake:
+ * platform/graphics/nicosia/NicosiaPaintingEngine.cpp: Added.
+ (Nicosia::PaintingEngine::create):
+ * platform/graphics/nicosia/NicosiaPaintingEngine.h: Added.
+ * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp: Added.
+ (Nicosia::PaintingEngineBasic::paint):
+ * platform/graphics/nicosia/NicosiaPaintingEngineBasic.h: Added.
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+
2017-11-30 Adrian Perez de Castro <ape...@igalia.com>
[GStreamer] Builds fails with ENABLE_VIDEO=OFF due to GStreamer usage
Modified: trunk/Source/WebCore/platform/TextureMapper.cmake (225327 => 225328)
--- trunk/Source/WebCore/platform/TextureMapper.cmake 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebCore/platform/TextureMapper.cmake 2017-11-30 15:12:58 UTC (rev 225328)
@@ -47,6 +47,8 @@
)
list(APPEND WebCore_SOURCES
platform/graphics/nicosia/NicosiaBuffer.cpp
+ platform/graphics/nicosia/NicosiaPaintingEngine.cpp
+ platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp
)
else ()
list(APPEND WebCore_SOURCES
Added: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.cpp (0 => 225328)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.cpp 2017-11-30 15:12:58 UTC (rev 225328)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 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 "NicosiaPaintingEngine.h"
+
+#include "NicosiaPaintingEngineBasic.h"
+
+namespace Nicosia {
+
+std::unique_ptr<PaintingEngine> PaintingEngine::create()
+{
+ return std::unique_ptr<PaintingEngine>(new PaintingEngineBasic);
+}
+
+} // namespace Nicosia
Added: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.h (0 => 225328)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngine.h 2017-11-30 15:12:58 UTC (rev 225328)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 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 <memory>
+#include <wtf/Ref.h>
+
+namespace WebCore {
+class GraphicsLayer;
+class IntRect;
+}
+
+namespace Nicosia {
+
+class Buffer;
+
+class PaintingEngine {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static std::unique_ptr<PaintingEngine> create();
+
+ virtual ~PaintingEngine() = default;
+
+ virtual bool paint(WebCore::GraphicsLayer&, Ref<Buffer>&&, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&, float) = 0;
+};
+
+} /// namespace Nicosia
Added: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp (0 => 225328)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp 2017-11-30 15:12:58 UTC (rev 225328)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 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 "NicosiaPaintingEngineBasic.h"
+
+#include "GraphicsContext.h"
+#include "GraphicsLayer.h"
+#include "NicosiaBuffer.h"
+
+namespace Nicosia {
+
+using namespace WebCore;
+
+PaintingEngineBasic::PaintingEngineBasic() = default;
+PaintingEngineBasic::~PaintingEngineBasic() = default;
+
+bool PaintingEngineBasic::paint(GraphicsLayer& layer, Ref<Buffer>&& buffer, const IntRect& sourceRect, const IntRect& mappedSourceRect, const IntRect& targetRect, float contentsScale)
+{
+ auto& context = buffer->context();
+ context.save();
+ context.clip(targetRect);
+ context.translate(targetRect.x(), targetRect.y());
+
+ if (buffer->supportsAlpha()) {
+ context.setCompositeOperation(CompositeCopy);
+ context.fillRect(IntRect(IntPoint::zero(), sourceRect.size()), Color::transparent);
+ context.setCompositeOperation(CompositeSourceOver);
+ }
+
+ context.translate(-sourceRect.x(), -sourceRect.y());
+ context.scale(FloatSize(contentsScale, contentsScale));
+
+ layer.paintGraphicsLayerContents(context, mappedSourceRect);
+
+ context.restore();
+ return true;
+}
+
+} // namespace Nicosia
Added: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.h (0 => 225328)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPaintingEngineBasic.h 2017-11-30 15:12:58 UTC (rev 225328)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 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 "NicosiaPaintingEngine.h"
+
+namespace Nicosia {
+
+class PaintingEngineBasic final : public PaintingEngine {
+public:
+ PaintingEngineBasic();
+ virtual ~PaintingEngineBasic();
+
+private:
+ bool paint(WebCore::GraphicsLayer&, Ref<Buffer>&&, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&, float) override;
+};
+
+} // namespace Nicosia
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (225327 => 225328)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2017-11-30 15:12:58 UTC (rev 225328)
@@ -30,6 +30,7 @@
#include "GraphicsContext.h"
#include "GraphicsLayer.h"
#include "GraphicsLayerFactory.h"
+#include "NicosiaPaintingEngine.h"
#include "ScrollableArea.h"
#include "TextureMapperPlatformLayerProxyProvider.h"
#include <wtf/CurrentTime.h>
@@ -972,27 +973,12 @@
auto coordinatedBuffer = m_coordinator->getCoordinatedBuffer(dirtyRect.size(),
contentsOpaque() ? Nicosia::Buffer::NoFlags : Nicosia::Buffer::SupportsAlpha,
updateInfo.atlasID, targetRect);
- {
- GraphicsContext& context = coordinatedBuffer->context();
- context.save();
- context.clip(targetRect);
- context.translate(targetRect.x(), targetRect.y());
- if (coordinatedBuffer->supportsAlpha()) {
- context.setCompositeOperation(CompositeCopy);
- context.fillRect(IntRect(IntPoint::zero(), dirtyRect.size()), Color::transparent);
- context.setCompositeOperation(CompositeSourceOver);
- }
+ if (!m_coordinator->paintingEngine().paint(*this, WTFMove(coordinatedBuffer),
+ dirtyRect, m_mainBackingStore->mapToContents(dirtyRect),
+ targetRect, m_mainBackingStore->contentsScale()))
+ continue;
- context.translate(-dirtyRect.x(), -dirtyRect.y());
- float backingStoreScale = m_mainBackingStore->contentsScale();
- context.scale(FloatSize(backingStoreScale, backingStoreScale));
-
- paintGraphicsLayerContents(context, m_mainBackingStore->mapToContents(dirtyRect));
-
- context.restore();
- }
-
updateInfo.surfaceOffset = targetRect.location();
updateInfo.updateRect = dirtyRect;
updateInfo.updateRect.move(-tileRect.x(), -tileRect.y());
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (225327 => 225328)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2017-11-30 15:12:58 UTC (rev 225328)
@@ -37,6 +37,10 @@
#include "TransformationMatrix.h"
#include <wtf/text/StringHash.h>
+namespace Nicosia {
+class PaintingEngine;
+}
+
namespace WebCore {
class CoordinatedGraphicsLayer;
class TextureMapperAnimations;
@@ -49,6 +53,7 @@
virtual Ref<CoordinatedImageBacking> createImageBackingIfNeeded(Image&) = 0;
virtual void detachLayer(CoordinatedGraphicsLayer*) = 0;
virtual Ref<Nicosia::Buffer> getCoordinatedBuffer(const IntSize&, Nicosia::Buffer::Flags, uint32_t&, IntRect&) = 0;
+ virtual Nicosia::PaintingEngine& paintingEngine() = 0;
virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0;
};
Modified: trunk/Source/WebKit/ChangeLog (225327 => 225328)
--- trunk/Source/WebKit/ChangeLog 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebKit/ChangeLog 2017-11-30 15:12:58 UTC (rev 225328)
@@ -1,3 +1,22 @@
+2017-11-30 Zan Dobersek <zdober...@igalia.com>
+
+ [CoordGraphics] Move CoordinatedGraphicsLayer painting behind Nicosia::PaintingEngine
+ https://bugs.webkit.org/show_bug.cgi?id=180141
+
+ Reviewed by Carlos Garcia Campos.
+
+ CompositingCoordinator must implement the paintingEngine() method now
+ that the method's been added to the CoordinatedGraphicsLayerClient
+ interface. The CompositingCoordinator manages the Nicosia::PaintingEngine
+ object through the new m_paintingEngine member variable, and returns the
+ reference to this object in the paintingEngine() method.
+
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+ (WebKit::CompositingCoordinator::CompositingCoordinator):
+ (WebKit::CompositingCoordinator::paintingEngine):
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+ Drop unnecessary typedefs.
+
2017-11-29 Wenson Hsieh <wenson_hs...@apple.com>
[Attachment Support] Implement SPI for clients to make an attachment element display in-place
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (225327 => 225328)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2017-11-30 15:12:58 UTC (rev 225328)
@@ -35,6 +35,7 @@
#include <WebCore/GraphicsContext.h>
#include <WebCore/InspectorController.h>
#include <WebCore/MainFrame.h>
+#include <WebCore/NicosiaPaintingEngine.h>
#include <WebCore/Page.h>
#include <wtf/MemoryPressureHandler.h>
#include <wtf/SetForScope.h>
@@ -50,6 +51,7 @@
CompositingCoordinator::CompositingCoordinator(Page* page, CompositingCoordinator::Client& client)
: m_page(page)
, m_client(client)
+ , m_paintingEngine(Nicosia::PaintingEngine::create())
, m_releaseInactiveAtlasesTimer(RunLoop::main(), this, &CompositingCoordinator::releaseInactiveAtlasesTimerFired)
{
#if USE(GLIB_EVENT_LOOP)
@@ -397,6 +399,11 @@
return *buffer;
}
+Nicosia::PaintingEngine& CompositingCoordinator::paintingEngine()
+{
+ return *m_paintingEngine;
+}
+
const Seconds releaseInactiveAtlasesTimerInterval { 500_ms };
void CompositingCoordinator::scheduleReleaseInactiveAtlases()
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (225327 => 225328)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2017-11-30 15:01:53 UTC (rev 225327)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2017-11-30 15:12:58 UTC (rev 225328)
@@ -39,6 +39,10 @@
#include <WebCore/IntRect.h>
#include <WebCore/NicosiaBuffer.h>
+namespace Nicosia {
+class PaintingEngine;
+}
+
namespace WebCore {
class GraphicsContext;
class GraphicsLayer;
@@ -114,6 +118,7 @@
Ref<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image&) override;
void detachLayer(WebCore::CoordinatedGraphicsLayer*) override;
Ref<Nicosia::Buffer> getCoordinatedBuffer(const WebCore::IntSize&, Nicosia::Buffer::Flags, uint32_t&, WebCore::IntRect&) override;
+ Nicosia::PaintingEngine& paintingEngine() override;
void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override;
// UpdateAtlas::Client
@@ -144,10 +149,10 @@
WebCore::CoordinatedGraphicsState m_state;
- typedef HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> LayerMap;
- LayerMap m_registeredLayers;
- typedef HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking> > ImageBackingMap;
- ImageBackingMap m_imageBackings;
+ HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers;
+ HashMap<WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedImageBacking>> m_imageBackings;
+
+ std::unique_ptr<Nicosia::PaintingEngine> m_paintingEngine;
Vector<std::unique_ptr<UpdateAtlas>> m_updateAtlases;
Vector<uint32_t> m_atlasesToRemove;