[Webkit-unassigned] [Bug 271765] New: [WPE] Add a soft limit to the amount of GPU memory BitmapTexturePool can hold

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 27 08:35:39 PDT 2024


            Bug ID: 271765
           Summary: [WPE] Add a soft limit to the amount of GPU memory
                    BitmapTexturePool can hold
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WPE WebKit
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: magomez at igalia.com
                CC: bugs-noreply at webkitgtk.org

As it works now, BitmapTexturePool can keep unused textures around for up to 3 seconds. This is a problem in some situations where there are a lot of allocations and releases of textures with different sizes that can't be reused. These textures stay in the pool consuming potentially a lot of GPU memory. In extreme cases these textures can consume the whole GPU memory on constrained devices.

This situation can be easily reproducible with this page for example:

      #animated {
          width: 100px;
          height: 100px;
          background-color: red;
          position: relative;
          animation-name: example;
          animation-duration: 20s;
          animation-iteration-count: infinite;
          animation-timing-function: linear;
      @keyframes example {
          0%   {width: 100px; height: 100px;}
          100% {width: 5000px; height: 5000px;}
    <div id="animated"></div>

The div has a fast animation that makes it grow up from 100x100 to 5000x5000. Every frame of the animation requires creating a backingStore with a new size for the div, which requires allocating textures from the BitmapTexturePool for each of the tiles. These tiles have increasing sizes during the animation (for example, 20x20, then 21x21, then 22x22, until 512x512 max), so the textures used for them will also have those sizes, that can't be reused from previous steps of the animation. So with each frame of the animation we're allocating a new set of textures and keeping the old ones in the pool for 3 seconds. When running the HTML above, the pool can get to store more than 100MB of textures.

We need some mechanism inside BitmapTexturePool to try to control this extreme growth.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240327/5f72784a/attachment-0001.htm>

More information about the webkit-unassigned mailing list