- Revision
- 292398
- Author
- simon.fra...@apple.com
- Date
- 2022-04-05 09:44:44 -0700 (Tue, 05 Apr 2022)
Log Message
Pass an IOSurfacePool to ImageBuffer::releaseBufferToPool()
https://bugs.webkit.org/show_bug.cgi?id=238768
Reviewed by Said Abou-Hallawa.
In order to move away from a singleton IOSurfacePool, we need to pass the pool
which the IOSurface will be added to.
Source/WebCore:
* platform/graphics/ConcreteImageBuffer.h:
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::CreationContext::CreationContext):
* platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::releaseBufferToPool):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::releaseBufferToPool):
* platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
Source/WebKit:
For RemoteLayerBackingStore, pass the singleton WebProcess pool
(this is the non-GPU Process code path).
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::Buffer::discard):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (292397 => 292398)
--- trunk/Source/WebCore/ChangeLog 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/ChangeLog 2022-04-05 16:44:44 UTC (rev 292398)
@@ -1,3 +1,22 @@
+2022-04-05 Simon Fraser <simon.fra...@apple.com>
+
+ Pass an IOSurfacePool to ImageBuffer::releaseBufferToPool()
+ https://bugs.webkit.org/show_bug.cgi?id=238768
+
+ Reviewed by Said Abou-Hallawa.
+
+ In order to move away from a singleton IOSurfacePool, we need to pass the pool
+ which the IOSurface will be added to.
+
+ * platform/graphics/ConcreteImageBuffer.h:
+ * platform/graphics/ImageBuffer.h:
+ (WebCore::ImageBuffer::CreationContext::CreationContext):
+ * platform/graphics/ImageBufferBackend.h:
+ (WebCore::ImageBufferBackend::releaseBufferToPool):
+ * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
+ (WebCore::ImageBufferIOSurfaceBackend::releaseBufferToPool):
+ * platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
+
2022-04-05 Wenson Hsieh <wenson_hs...@apple.com>
Unreviewed, fix the internal iOS build after r292370
Modified: trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h (292397 => 292398)
--- trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2022-04-05 16:44:44 UTC (rev 292398)
@@ -325,11 +325,13 @@
return nullptr;
}
- void releaseBufferToPool() override
+#if HAVE(IOSURFACE)
+ void releaseBufferToPool(IOSurfacePool* pool) override
{
if (auto* backend = ensureBackendCreated())
- backend->releaseBufferToPool();
+ backend->releaseBufferToPool(pool);
}
+#endif
ImageBufferBackend::Parameters m_parameters;
std::unique_ptr<BackendType> m_backend;
Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (292397 => 292398)
--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h 2022-04-05 16:44:44 UTC (rev 292398)
@@ -38,7 +38,9 @@
class Filter;
class HostWindow;
+#if HAVE(IOSURFACE)
class IOSurfacePool;
+#endif
class ImageBuffer : public ThreadSafeRefCounted<ImageBuffer, WTF::DestructionThread::Main>, public CanMakeWeakPtr<ImageBuffer> {
public:
@@ -45,10 +47,18 @@
struct CreationContext {
// clang 13.1.6 throws errors if we use default initializers here.
HostWindow* hostWindow;
+#if HAVE(IOSURFACE)
IOSurfacePool* surfacePool;
- CreationContext(HostWindow* window = nullptr, IOSurfacePool* pool = nullptr)
+#endif
+ CreationContext(HostWindow* window = nullptr
+#if HAVE(IOSURFACE)
+ , IOSurfacePool* pool = nullptr
+#endif
+ )
: hostWindow(window)
+#if HAVE(IOSURFACE)
, surfacePool(pool)
+#endif
{ }
};
@@ -100,8 +110,9 @@
virtual bool isInUse() const = 0;
virtual void releaseGraphicsContext() = 0;
- virtual void releaseBufferToPool() = 0;
-
+#if HAVE(IOSURFACE)
+ virtual void releaseBufferToPool(IOSurfacePool*) = 0;
+#endif
// Returns true on success.
virtual bool setVolatile() = 0;
virtual SetNonVolatileResult setNonVolatile() = 0;
Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h (292397 => 292398)
--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h 2022-04-05 16:44:44 UTC (rev 292398)
@@ -40,6 +40,9 @@
class GraphicsContext;
class GraphicsContextGL;
+#if HAVE(IOSURFACE)
+class IOSurfacePool;
+#endif
class Image;
class NativeImage;
class PixelBuffer;
@@ -126,7 +129,9 @@
virtual bool isInUse() const { return false; }
virtual void releaseGraphicsContext() { ASSERT_NOT_REACHED(); }
- virtual void releaseBufferToPool() { }
+#if HAVE(IOSURFACE)
+ virtual void releaseBufferToPool(IOSurfacePool*) { }
+#endif
// Returns true on success.
virtual bool setVolatile() { return true; }
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp (292397 => 292398)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp 2022-04-05 16:44:44 UTC (rev 292398)
@@ -260,9 +260,9 @@
m_volatilityState = volatilityState;
}
-void ImageBufferIOSurfaceBackend::releaseBufferToPool()
+void ImageBufferIOSurfaceBackend::releaseBufferToPool(IOSurfacePool* pool)
{
- IOSurface::moveToPool(WTFMove(m_surface), &IOSurfacePool::sharedPool());
+ IOSurface::moveToPool(WTFMove(m_surface), pool);
}
void ImageBufferIOSurfaceBackend::ensureNativeImagesHaveCopiedBackingStore()
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h (292397 => 292398)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h 2022-04-05 16:44:44 UTC (rev 292398)
@@ -68,7 +68,7 @@
bool isInUse() const override;
void releaseGraphicsContext() override;
- void releaseBufferToPool() override;
+ void releaseBufferToPool(IOSurfacePool*) override;
bool setVolatile() final;
SetNonVolatileResult setNonVolatile() final;
Modified: trunk/Source/WebKit/ChangeLog (292397 => 292398)
--- trunk/Source/WebKit/ChangeLog 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebKit/ChangeLog 2022-04-05 16:44:44 UTC (rev 292398)
@@ -1,3 +1,19 @@
+2022-04-05 Simon Fraser <simon.fra...@apple.com>
+
+ Pass an IOSurfacePool to ImageBuffer::releaseBufferToPool()
+ https://bugs.webkit.org/show_bug.cgi?id=238768
+
+ Reviewed by Said Abou-Hallawa.
+
+ In order to move away from a singleton IOSurfacePool, we need to pass the pool
+ which the IOSurface will be added to.
+
+ For RemoteLayerBackingStore, pass the singleton WebProcess pool
+ (this is the non-GPU Process code path).
+
+ * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+ (WebKit::RemoteLayerBackingStore::Buffer::discard):
+
2022-04-05 Zan Dobersek <zdober...@igalia.com>
[Unix] Add UnixFileDescriptor, use it in IPC::Semaphore
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (292397 => 292398)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm 2022-04-05 16:32:33 UTC (rev 292397)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm 2022-04-05 16:44:44 UTC (rev 292398)
@@ -41,7 +41,7 @@
#import <QuartzCore/QuartzCore.h>
#import <WebCore/BifurcatedGraphicsContext.h>
#import <WebCore/GraphicsContextCG.h>
-#import <WebCore/IOSurface.h>
+#import <WebCore/IOSurfacePool.h>
#import <WebCore/ImageBuffer.h>
#import <WebCore/PlatformCALayerClient.h>
#import <WebCore/WebLayer.h>
@@ -687,7 +687,7 @@
void RemoteLayerBackingStore::Buffer::discard()
{
if (imageBuffer)
- imageBuffer->releaseBufferToPool();
+ imageBuffer->releaseBufferToPool(&WebCore::IOSurfacePool::sharedPool());
imageBuffer = nullptr;
#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
displayListImageBuffer = nullptr;