Diff
Modified: trunk/Source/WebCore/ChangeLog (271672 => 271673)
--- trunk/Source/WebCore/ChangeLog 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebCore/ChangeLog 2021-01-20 22:07:48 UTC (rev 271673)
@@ -1,3 +1,17 @@
+2021-01-20 Chris Dumez <cdu...@apple.com>
+
+ [GPUProcess] Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=220770
+
+ Reviewed by Geoffrey Garen.
+
+ Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess. This is so
+ that Jetsam knows which process to terminate to reclaim memory.
+
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (WebCore::IOSurface::setOwnership):
+
2021-01-20 Yusuke Suzuki <ysuz...@apple.com>
Accelerate HTMLInputElement creation
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (271672 => 271673)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2021-01-20 22:07:48 UTC (rev 271673)
@@ -157,6 +157,8 @@
WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, WTF::Function<void(std::unique_ptr<WebCore::IOSurface>)>&&);
#endif // HAVE(IOSURFACE_ACCELERATOR)
+ WEBCORE_EXPORT void setOwnership(task_t newOwner);
+
void migrateColorSpaceToProperties();
private:
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (271672 => 271673)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2021-01-20 22:07:48 UTC (rev 271673)
@@ -476,6 +476,20 @@
#endif // HAVE(IOSURFACE_ACCELERATOR)
+void IOSurface::setOwnership(task_t newOwner)
+{
+#if HAVE(IOSURFACE_SET_OWNERSHIP)
+ if (!m_surface)
+ return;
+
+ auto result = IOSurfaceSetOwnership(m_surface.get(), newOwner, kIOSurfaceMemoryLedgerTagGraphics, 0);
+ if (result != kIOReturnSuccess)
+ RELEASE_LOG_ERROR(IOSurface, "IOSurface::setOwnership: Failed to claim ownership of IOSurface %p. Error: %d", m_surface.get(), result);
+#else
+ UNUSED_PARAM(newOwner);
+#endif
+}
+
void IOSurface::migrateColorSpaceToProperties()
{
auto colorSpaceProperties = adoptCF(CGColorSpaceCopyPropertyList(m_colorSpace.get()));
Modified: trunk/Source/WebKit/ChangeLog (271672 => 271673)
--- trunk/Source/WebKit/ChangeLog 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebKit/ChangeLog 2021-01-20 22:07:48 UTC (rev 271673)
@@ -1,3 +1,18 @@
+2021-01-20 Chris Dumez <cdu...@apple.com>
+
+ [GPUProcess] Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=220770
+
+ Reviewed by Geoffrey Garen.
+
+ Mark IOSurface backing for RemoteGraphicsContextGL's displayBuffer as owned by the WebProcess. This is so
+ that Jetsam knows which process to terminate to reclaim memory.
+
+ * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+ (WebKit::RemoteGraphicsContextGLProxy::prepareForDisplay):
+ * WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp:
+ (WebKit::ImageBufferShareableMappedIOSurfaceBackend::create):
+
2021-01-20 Wenson Hsieh <wenson_hs...@apple.com>
[iOS] "touchend" events should be dispatched and handled asynchronously
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (271672 => 271673)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp 2021-01-20 22:07:48 UTC (rev 271673)
@@ -90,6 +90,9 @@
sendSync(Messages::RemoteGraphicsContextGL::PrepareForDisplay(), Messages::RemoteGraphicsContextGL::PrepareForDisplay::Reply(displayBufferSendRight), m_graphicsContextGLIdentifier, 10_s);
auto displayBuffer = IOSurface::createFromSendRight(WTFMove(displayBufferSendRight), sRGBColorSpaceRef());
if (displayBuffer) {
+ // Claim in the WebProcess ownership of the IOSurface constructed by the GPUProcess so that Jetsam knows which processes to kill.
+ displayBuffer->setOwnership(mach_task_self());
+
auto& sc = platformSwapChain();
sc.recycleBuffer();
sc.present({ WTFMove(displayBuffer), nullptr });
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp (271672 => 271673)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp 2021-01-20 21:54:37 UTC (rev 271672)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp 2021-01-20 22:07:48 UTC (rev 271673)
@@ -69,12 +69,8 @@
if (!surface)
return nullptr;
-#if HAVE(IOSURFACE_SET_OWNERSHIP)
// Claim in the WebProcess ownership of the IOSurface constructed by the GPUProcess so that Jetsam knows which processes to kill.
- auto result = IOSurfaceSetOwnership(surface->surface(), mach_task_self(), kIOSurfaceMemoryLedgerTagGraphics, 0);
- if (result != kIOReturnSuccess)
- RELEASE_LOG_ERROR(Process, "Failed to claim ownership of IOSurface %p. Error: %d", surface->surface(), result);
-#endif
+ surface->setOwnership(mach_task_self());
return makeUnique<ImageBufferShareableMappedIOSurfaceBackend>(parameters, WTFMove(surface));
}