[webkit-changes] [WebKit/WebKit] 78038e: Leaked 2D contexts might consume all OS global GPU...

Kimmo Kinnunen noreply at github.com
Thu May 2 23:53:30 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 78038e7ea408ff3a2869d9394ba4dff327492d9c
      https://github.com/WebKit/WebKit/commit/78038e7ea408ff3a2869d9394ba4dff327492d9c
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-05-02 (Thu, 02 May 2024)

  Changed paths:
    A LayoutTests/fast/canvas/image-buffer-backend-count-limit-expected.txt
    A LayoutTests/fast/canvas/image-buffer-backend-count-limit.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/mac-wk1/TestExpectations
    M LayoutTests/platform/wincairo/TestExpectations
    M Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp
    M Source/WebKit/GPUProcess/RemoteSharedResourceCache.h
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp

  Log Message:
  -----------
  Leaked 2D contexts might consume all OS global GPU resources
https://bugs.webkit.org/show_bug.cgi?id=273326
rdar://95930955

Reviewed by Matt Woodrow.

Limit all the GPUP accelerated image buffers to certain numbers:
 - 30000 total limit
 - 3000 layer tile, 2D Context backing stores limit per WP
 - 1000 2D Context backing stores limit per WP

Store the per-WP limit to the RemoteSharedResourceCache. This is shared
with all the RemoteRenderingBackend instances of a particular WP:
main thread rendering and Web Worker rendering.

If GPUP allocates unlimited amount of accelerated image buffers, the
allocations cause all of system IOSurface handles. The failures are
handled ok in GPUP code, but might cause problems in other parts of the
WebKit as well as in other processes. The underlying CGContexts will
also run into per-process Metal object count limits.

* LayoutTests/fast/canvas/image-buffer-backend-count-limit-expected.txt: Added.
* LayoutTests/fast/canvas/image-buffer-backend-count-limit.html: Added.
* Source/WebKit/GPUProcess/RemoteSharedResourceCache.cpp:
(WebKit::RemoteSharedResourceCache::didAddAcceleratedImageBuffer):
(WebKit::RemoteSharedResourceCache::didTakeAcceleratedImageBuffer):
(WebKit::RemoteSharedResourceCache::adjustAcceleratedImageBufferRenderingMode const):
* Source/WebKit/GPUProcess/RemoteSharedResourceCache.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::didCreateImageBuffer):
(WebKit::RemoteRenderingBackend::allocateImageBuffer):
(WebKit::RemoteRenderingBackend::releaseImageBuffer):
(WebKit::RemoteRenderingBackend::takeImageBuffer):

Canonical link: https://commits.webkit.org/278304@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list