Title: [269179] trunk/Source/WebCore
Revision
269179
Author
[email protected]
Date
2020-10-30 01:40:13 -0700 (Fri, 30 Oct 2020)

Log Message

[GTK] Direct composited images may not be rendered after a window resize
https://bugs.webkit.org/show_bug.cgi?id=218292

Reviewed by Carlos Garcia Campos.

Ensure that valid buffers passed for ImageBackings are not destroyed until the
CoordinatedGraphicsScene consumes them.

* platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp:
(Nicosia::ImageBackingTextureMapperImpl::flushUpdate):
* platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::purgeBackingStores):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (269178 => 269179)


--- trunk/Source/WebCore/ChangeLog	2020-10-30 03:26:56 UTC (rev 269178)
+++ trunk/Source/WebCore/ChangeLog	2020-10-30 08:40:13 UTC (rev 269179)
@@ -1,3 +1,20 @@
+2020-10-30  Miguel Gomez  <[email protected]>
+
+        [GTK] Direct composited images may not be rendered after a window resize
+        https://bugs.webkit.org/show_bug.cgi?id=218292
+
+        Reviewed by Carlos Garcia Campos.
+
+        Ensure that valid buffers passed for ImageBackings are not destroyed until the
+        CoordinatedGraphicsScene consumes them.
+
+        * platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp:
+        (Nicosia::ImageBackingTextureMapperImpl::flushUpdate):
+        * platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
+        (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
+
 2020-10-29  Aditya Keerthi  <[email protected]>
 
         [Cocoa] Remove soft linking of NetworkExtension.framework

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp (269178 => 269179)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp	2020-10-30 03:26:56 UTC (rev 269178)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.cpp	2020-10-30 08:40:13 UTC (rev 269179)
@@ -47,6 +47,15 @@
 void ImageBackingTextureMapperImpl::flushUpdate()
 {
     LockHolder locker(m_update.lock);
+
+    // If the update happens for the same image and there's no buffer, keep the current one
+    // so it can be received by the CoordinatedGraphicsScene. In that case we only need to update
+    // the isVisible flag.
+    if ((m_layerState.update.nativeImageID == m_update.update.nativeImageID) && !m_layerState.update.buffer) {
+        m_update.update.isVisible = m_layerState.update.isVisible;
+        return;
+    }
+
     m_update.update = WTFMove(m_layerState.update);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h (269178 => 269179)


--- trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h	2020-10-30 03:26:56 UTC (rev 269178)
+++ trunk/Source/WebCore/platform/graphics/nicosia/texmap/NicosiaImageBackingTextureMapperImpl.h	2020-10-30 08:40:13 UTC (rev 269179)
@@ -60,6 +60,7 @@
 
         bool isVisible { false };
         RefPtr<Nicosia::Buffer> buffer;
+        uintptr_t nativeImageID { 0 };
     };
 
     // An immutable layer-side state object. flushUpdate() prepares
@@ -72,7 +73,6 @@
         LayerState& operator=(LayerState&&) = delete;
 
         uintptr_t imageID { 0 };
-        uintptr_t nativeImageID { 0 };
         Update update;
     };
     LayerState& layerState() { return m_layerState; }

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (269178 => 269179)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2020-10-30 03:26:56 UTC (rev 269178)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2020-10-30 08:40:13 UTC (rev 269179)
@@ -873,7 +873,7 @@
         auto& layerState = impl.layerState();
         layerState.imageID = imageID;
         layerState.update.isVisible = transformedVisibleRect().intersects(IntRect(contentsRect()));
-        if (layerState.update.isVisible && layerState.nativeImageID != nativeImageID) {
+        if (layerState.update.isVisible && layerState.update.nativeImageID != nativeImageID) {
             auto buffer = Nicosia::Buffer::create(IntSize(image.size()),
                 !image.currentFrameKnownToBeOpaque() ? Nicosia::Buffer::SupportsAlpha : Nicosia::Buffer::NoFlags);
             Nicosia::PaintingContext::paint(buffer,
@@ -882,7 +882,7 @@
                     IntRect rect { { }, IntSize { image.size() } };
                     context.drawImage(image, rect, rect, ImagePaintingOptions(CompositeOperator::Copy));
                 });
-            layerState.nativeImageID = nativeImageID;
+            layerState.update.nativeImageID = nativeImageID;
             layerState.update.buffer = WTFMove(buffer);
             m_nicosia.delta.imageBackingChanged = true;
         }
@@ -1185,7 +1185,6 @@
     if (m_nicosia.imageBacking) {
         auto& layerState = downcast<Nicosia::ImageBackingTextureMapperImpl>(m_nicosia.imageBacking->impl()).layerState();
         layerState.imageID = 0;
-        layerState.nativeImageID = 0;
         layerState.update = { };
 
         m_nicosia.imageBacking = nullptr;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to