Title: [294452] trunk/Source

Diff

Modified: trunk/Source/WebCore/ChangeLog (294451 => 294452)


--- trunk/Source/WebCore/ChangeLog	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/ChangeLog	2022-05-19 00:41:55 UTC (rev 294452)
@@ -1,3 +1,16 @@
+2022-05-18  Robert Jenner  <[email protected]>
+
+        Unreviewed, reverting r294317.
+
+        Broke multiple layout-tests, and 2 api-tests.
+
+        Reverted changeset:
+
+        "ImageBufferIOSurfaceBackend context setup and teardown
+        functions are redundant and error-prone"
+        https://bugs.webkit.org/show_bug.cgi?id=240452
+        https://commits.webkit.org/r294317
+
 2022-05-17  Kimmo Kinnunen  <[email protected]>
 
         ImageBufferIOSurfaceBackend context setup and teardown functions are redundant and error-prone

Modified: trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h	2022-05-19 00:41:55 UTC (rev 294452)
@@ -311,6 +311,12 @@
         return false;
     }
 
+    void releaseGraphicsContext() override
+    {
+        if (auto* backend = ensureBackendCreated())
+            return backend->releaseGraphicsContext();
+    }
+
     bool setVolatile() override
     {
         if (auto* backend = ensureBackendCreated())

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-05-19 00:41:55 UTC (rev 294452)
@@ -115,6 +115,7 @@
     virtual size_t externalMemoryCost() const = 0;
 
     virtual bool isInUse() const = 0;
+    virtual void releaseGraphicsContext() = 0;
     // Returns true on success.
     virtual bool setVolatile() = 0;
     virtual SetNonVolatileResult setNonVolatile() = 0;

Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp	2022-05-19 00:41:55 UTC (rev 294452)
@@ -180,8 +180,9 @@
     return baseTransform;
 }
 
-void ImageBufferBackend::applyBaseTransform(GraphicsContext& context)
+void ImageBufferBackend::applyBaseTransformToContext() const
 {
+    auto& context = this->context();
     context.applyDeviceScaleFactor(m_parameters.resolutionScale);
     context.setCTM(calculateBaseTransform(m_parameters, originAtBottomLeftCorner()));
 }

Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h	2022-05-19 00:41:55 UTC (rev 294452)
@@ -137,6 +137,7 @@
 #endif
 
     virtual bool isInUse() const { return false; }
+    virtual void releaseGraphicsContext() { ASSERT_NOT_REACHED(); }
 
     // Returns true on success.
     virtual bool setVolatile() { return true; }
@@ -146,7 +147,7 @@
 
     virtual std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() { return nullptr; }
 
-    void applyBaseTransform(GraphicsContext&);
+    void applyBaseTransformToContext() const;
 
     static constexpr bool isOriginAtBottomLeftCorner = false;
     virtual bool originAtBottomLeftCorner() const { return isOriginAtBottomLeftCorner; }

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp	2022-05-19 00:41:55 UTC (rev 294452)
@@ -115,7 +115,7 @@
     ASSERT(m_data);
     ASSERT(m_dataProvider);
     ASSERT(m_context);
-    applyBaseTransform(*m_context);
+    applyBaseTransformToContext();
 }
 
 ImageBufferCGBitmapBackend::~ImageBufferCGBitmapBackend() = default;

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp	2022-05-19 00:41:55 UTC (rev 294452)
@@ -120,7 +120,7 @@
     , m_ioSurfacePool(ioSurfacePool)
 {
     ASSERT(m_surface);
-    initializeContext();
+    applyBaseTransformToContext();
 }
 
 ImageBufferIOSurfaceBackend::~ImageBufferIOSurfaceBackend()
@@ -131,6 +131,10 @@
 
 GraphicsContext& ImageBufferIOSurfaceBackend::context() const
 {
+    if (!m_context) {
+        m_context.emplace(*m_surface);
+        applyBaseTransformToContext();
+    }
     return *m_context;
 }
 
@@ -232,9 +236,14 @@
     return m_surface->isInUse();
 }
 
+void ImageBufferIOSurfaceBackend::releaseGraphicsContext()
+{
+    m_context = std::nullopt;
+    m_surface->releasePlatformGraphicsContext();
+}
+
 bool ImageBufferIOSurfaceBackend::setVolatile()
 {
-    m_context = std::nullopt;
     if (m_surface->isInUse())
         return false;
 
@@ -246,9 +255,7 @@
 SetNonVolatileResult ImageBufferIOSurfaceBackend::setNonVolatile()
 {
     setVolatilityState(VolatilityState::NonVolatile);
-    auto result = m_surface->setVolatile(false);
-    initializeContext();
-    return result;
+    return m_surface->setVolatile(false);
 }
 
 VolatilityState ImageBufferIOSurfaceBackend::volatilityState() const
@@ -267,12 +274,6 @@
     flushContext();
 }
 
-void ImageBufferIOSurfaceBackend::initializeContext()
-{
-    m_context.emplace(*m_surface);
-    applyBaseTransform(*m_context);
-}
-
 } // namespace WebCore
 
 #endif // HAVE(IOSURFACE)

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h (294451 => 294452)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h	2022-05-19 00:41:55 UTC (rev 294452)
@@ -73,6 +73,7 @@
     void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override;
 
     bool isInUse() const override;
+    void releaseGraphicsContext() override;
 
     bool setVolatile() final;
     SetNonVolatileResult setNonVolatile() final;
@@ -89,7 +90,6 @@
 
     void prepareToDrawIntoContext(GraphicsContext& destinationContext) override;
     void invalidateCachedNativeImage() const;
-    void initializeContext();
 
     std::unique_ptr<IOSurface> m_surface;
     IOSurfaceSeed m_lastSeedWhenDrawingImage { 0 };

Modified: trunk/Source/WebKit/ChangeLog (294451 => 294452)


--- trunk/Source/WebKit/ChangeLog	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebKit/ChangeLog	2022-05-19 00:41:55 UTC (rev 294452)
@@ -1,3 +1,16 @@
+2022-05-18  Robert Jenner  <[email protected]>
+
+        Unreviewed, reverting r294317.
+
+        Broke multiple layout-tests, and 2 api-tests.
+
+        Reverted changeset:
+
+        "ImageBufferIOSurfaceBackend context setup and teardown
+        functions are redundant and error-prone"
+        https://bugs.webkit.org/show_bug.cgi?id=240452
+        https://commits.webkit.org/r294317
+
 2022-05-17  Chris Lord  <[email protected]>
 
         [WPE] Use new libwpe API to synchronise display refreshes fully to the screen refresh rate

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (294451 => 294452)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2022-05-19 00:41:55 UTC (rev 294452)
@@ -493,11 +493,16 @@
 {
     LOG_WITH_STREAM(RemoteRenderingBufferVolatility, stream << "GPU Process: RemoteRenderingBackend::markSurfacesVolatile " << identifiers);
 
+    auto makeVolatile = [](ImageBuffer& imageBuffer) {
+        imageBuffer.releaseGraphicsContext();
+        return imageBuffer.setVolatile();
+    };
+
     Vector<RenderingResourceIdentifier> markedVolatileBufferIdentifiers;
     for (auto identifier : identifiers) {
         auto imageBuffer = m_remoteResourceCache.cachedImageBuffer({ identifier, m_gpuConnectionToWebProcess->webProcessIdentifier() });
         if (imageBuffer) {
-            if (imageBuffer->setVolatile())
+            if (makeVolatile(*imageBuffer))
                 markedVolatileBufferIdentifiers.append(identifier);
         } else
             LOG_WITH_STREAM(RemoteRenderingBufferVolatility, stream << " failed to find ImageBuffer for identifier " << identifier);

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (294451 => 294452)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-05-19 00:41:55 UTC (rev 294452)
@@ -628,6 +628,7 @@
     if (!buffer.imageBuffer || buffer.imageBuffer->volatilityState() == VolatilityState::Volatile)
         return true;
 
+    buffer.imageBuffer->releaseGraphicsContext();
     return buffer.imageBuffer->setVolatile();
 }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h (294451 => 294452)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h	2022-05-19 00:01:53 UTC (rev 294451)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h	2022-05-19 00:41:55 UTC (rev 294452)
@@ -74,6 +74,7 @@
     unsigned bytesPerRow() const final;
 
     ImageBufferBackendSharing* toBackendSharing() final { return this; }
+    void releaseGraphicsContext() final { /* Do nothing. This is only relevant for IOSurface backends */ }
 
     Ref<ShareableBitmap> m_bitmap;
     std::unique_ptr<WebCore::GraphicsContext> m_context;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to