Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 80225aaf7451c18e20832dec77948e514d39d368 https://github.com/WebKit/WebKit/commit/80225aaf7451c18e20832dec77948e514d39d368 Author: Cameron McCormack <hey...@apple.com> Date: 2024-07-26 (Fri, 26 Jul 2024)
Changed paths: M LayoutTests/TestExpectations A LayoutTests/fast/canvas/image-buffer-resource-limits-expected.txt A LayoutTests/fast/canvas/image-buffer-resource-limits.html A LayoutTests/platform/glib/fast/canvas/image-buffer-resource-limits-expected.txt M LayoutTests/platform/mac-wk1/TestExpectations M LayoutTests/platform/win/TestExpectations M Source/WebCore/Headers.cmake M Source/WebCore/WebCore.xcodeproj/project.pbxproj M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp M Source/WebCore/page/ChromeClient.h A Source/WebCore/platform/graphics/ImageBufferResourceLimits.h M Source/WebCore/testing/Internals.cpp M Source/WebCore/testing/Internals.h M Source/WebCore/testing/Internals.idl M Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp M Source/WebKit/GPUProcess/RemoteSharedResourceCache.h M Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.cpp M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h Log Message: ----------- Add limits to the number of ImageBuffers that the GPU process can create https://bugs.webkit.org/show_bug.cgi?id=273326 rdar://95930955 Reviewed by Matt Woodrow. On Cocoa ports, ImageBuffers created in the GPU process consume both global and process-wide resources. Accelerated ImageBuffers consume IOSurface handles (which the kernel has a limited number of, and which also have a per process limit) and Metal objects (which are also limited per process). Unaccelerated ImageBuffers consume Mach port handles for their ShareableBitmap handles (which are per process). Prevent leaks (both undiagnosed and from poorly behaving Web content creating 2D canvases) from exhausting these resources by placing limits on the number of ImageBuffers the GPU process can create. These limits are: * 200,000 ImageBuffers for the GPU process (a number a bit lower than the 256K Mach port limit) * 50,000 canvas ImageBuffers for each Web Content process (to prevent one Web Content process from using the entire global limit) * 10,000 accelerated ImageBuffers for the GPU process (a number a bit lower than the 16K per-process IOSurface limit) * 5,000 accelerated canvas ImageBuffers for each Web Content process (to prevent one Web Content process from using the entire global limit) * LayoutTests/fast/canvas/image-buffer-resource-limits-expected.txt: Added. * LayoutTests/fast/canvas/image-buffer-resource-limits.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/Headers.cmake: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::getEffectiveRenderingModeForTesting): * Source/WebCore/page/ChromeClient.h: (WebCore::ChromeClient::getImageBufferResourceLimitsForTesting const): * Source/WebCore/platform/graphics/ImageBufferResourceLimits.h: Added. * Source/WebCore/testing/Internals.cpp: (WebCore::Internals::getEffectiveRenderingModeOfNewlyCreatedAcceleratedImageBuffer): (WebCore::Internals::getImageBufferResourceLimits): * Source/WebCore/testing/Internals.h: * Source/WebCore/testing/Internals.idl: * Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp: (WebKit::RemoteSharedResourceCache::didCreateImageBuffer): (WebKit::RemoteSharedResourceCache::didReleaseImageBuffer): (WebKit::RemoteSharedResourceCache::reachedAcceleratedImageBufferLimit const): (WebKit::RemoteSharedResourceCache::reachedImageBufferForCanvasLimit const): (WebKit::RemoteSharedResourceCache::getResourceLimitsForTesting const): * Source/WebKit/GPUProcess/RemoteSharedResourceCache.h: * Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.cpp: (WebKit::RemoteImageBuffer::RemoteImageBuffer): (WebKit::RemoteImageBuffer::~RemoteImageBuffer): (WebKit::RemoteImageBuffer::stopListeningForIPC): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp: (WebKit::adjustImageBufferRenderingMode): (WebKit::RemoteRenderingBackend::allocateImageBuffer): (WebKit::RemoteRenderingBackend::getImageBufferResourceLimitsForTesting): * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h: * Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in: * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: (WebKit::RemoteRenderingBackendProxy::sendWithAsyncReply): (WebKit::RemoteRenderingBackendProxy::getImageBufferResourceLimitsForTesting): * Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: (WebKit::RemoteRenderingBackendProxy::sendWithAsyncReply): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::getImageBufferResourceLimitsForTesting const): * Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h: Canonical link: https://commits.webkit.org/281395@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes