Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b44fdbf979afb8e3d9ccb642a2861874a44600ec
      
https://github.com/WebKit/WebKit/commit/b44fdbf979afb8e3d9ccb642a2861874a44600ec
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    M Source/WebCore/platform/graphics/Damage.h
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AcceleratedSurface.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AcceleratedSurface.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostPlayStation.cpp
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/NonCompositedFrameRenderer.cpp
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.h
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositorPlayStation.cpp
    M 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositorPlayStation.h

  Log Message:
  -----------
  Add DamageRectangleThreshold preference to tune the damage-rectangle merge 
limit
https://bugs.webkit.org/show_bug.cgi?id=315090

Reviewed by Carlos Garcia Campos.

When damage tracking records many small dirty rectangles, the Damage
class merges them into a coarser set once a maximum is reached, to
bound bookkeeping cost. Until now that maximum was hardcoded to 4 in
every consumer.

This patch adds a DamageRectangleThreshold preference (default 4) so
the limit can be tuned at runtime. The threshold replaces the hardcoded
limit previously set in AcceleratedSurface (render-target damage)
and NonCompositedFrameRenderer (CPU-upload damage).

The layer-tree frame damage that ThreadedCompositor propagates to the
UI process is intentionally left unchanged: it uses a fixed 256px
spatial grid (the rectangle count scales with the viewport rather than
being capped), which is the right granularity for driving UI-process
repaints and should not depend on this tuning knob.

Damage interprets a maximum of 0 as "no limit"
(Damage::NoMaxRectangles, i.e. the default 256px grid), which is the
opposite of what a threshold of 0 should mean. The value is therefore
clamped to a minimum of 1 where it is applied. With that clamp, a
threshold of 1 collapses each frame's damage to a single bounding box,
making it equivalent to the existing UnifyDamagedRegions preference.

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/platform/graphics/Damage.h:
(WebCore::Damage::clampRectangleThreshold):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AcceleratedSurface.cpp:
(WebKit::AcceleratedSurface::didRenderFrame):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AcceleratedSurface.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::LayerTreeHost):
* 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostPlayStation.cpp:
(WebKit::LayerTreeHost::LayerTreeHost):
* 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/NonCompositedFrameRenderer.cpp:
(WebKit::NonCompositedFrameRenderer::resetFrameDamage):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::setDamagePropagationSettings):
(WebKit::ThreadedCompositor::setDamagePropagationFlags): Deleted.
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.h:
* 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositorPlayStation.cpp:
(WebKit::ThreadedCompositor::setDamagePropagationSettings):
(WebKit::ThreadedCompositor::setDamagePropagationFlags): Deleted.
* 
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositorPlayStation.h:

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



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

Reply via email to