Skip to content

renderengine: Skip cross-frame blur cache for dynamic blur input#1

Open
zylhdrXP wants to merge 20 commits into
Lunaris-AOSP:16.2from
zylhdrXP:16.2
Open

renderengine: Skip cross-frame blur cache for dynamic blur input#1
zylhdrXP wants to merge 20 commits into
Lunaris-AOSP:16.2from
zylhdrXP:16.2

Conversation

@zylhdrXP
Copy link
Copy Markdown

@zylhdrXP zylhdrXP commented Jun 5, 2026

The cross-frame blur cache added in f5ccc185cb keys cached blur images on a fingerprint of the layers below the blur, mixing in each layer's GraphicBuffer::getId(), alpha, transform and boundaries. getId() returns mId, which is assigned once at allocation and is stable for the lifetime of the buffer object. Video producers (e.g. TikTok) recycle a small buffer pool and write a new frame into the same buffer in place, so the id stays constant while the pixels change.

When the QS shade is expanded over a playing video, the shade's background-blur layer covers the screen and its blur input is the video below it. The video pool cycles through only a few buffer ids, and with a held panel the blur radius and blurRect are constant, so the fingerprint collapses to a handful of values that all fit in the 4-entry cache. After the first cycle every lookup hits and generate() is skipped, leaving the on-screen blurred backdrop frozen even though the video keeps decoding.

Neither the buffer id, the acquire fence nor the geometry can detect an in-place content update at composition time, so any buffer-backed layer below the blur must be treated as dynamic. Track this while computing the fingerprint and bypass the cross-frame cache (lookup and store) whenever dynamic content is present. Fully static scenes (solid-color or effect-only layers) remain eligible for the cache, preserving the QS-hold power win the cache was added for. The per-frame cachedBlurs map and the Output ClientCompositionRequestCache are unaffected.

(cherry picked from commit AlphaDroid-Project/frameworks_native@598e2e9)

clarencelol and others added 20 commits March 31, 2026 09:38
This reverts commit 7c93509.

Change-Id: I1aa4f4d64d49022b4f9d97e6ebe15d81216d65c5
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
Signed-off-by: iHSAN <ihsanulrahman@proton.me>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
This reverts commit 6d223cb.

Change-Id: Iaa6f872313cb6c6433c73d715d5f16d853d4a3f9
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
Signed-off-by: iHSAN <ihsanulrahman@proton.me>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
This reverts commit 1e7c09b.

Change-Id: I9b81b02c293ee0018a79a6028ae97bf628968fc3
Signed-off-by: Frost <159105703+Karan-Frost@users.noreply.github.com>
Signed-off-by: Dmitrii <bankersenator@gmail.com>
Signed-off-by: iHSAN <ihsanulrahman@proton.me>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Layer dataspace is initialized as unknown by default, unless
overriden by the buffer source. We don't require expensive
rendering for color conversion when the dataspace is unknown.

Change-Id: I079c520f63a65c77ba3162664656e607eafff991
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
If a invisible parent layer set a fixedTransformHint, the sub layers
of this parent layer should be updated in time, especially in the
occation that when a landscape Activity exit and return to vertical
Activity.

It can optimize performance by avoiding unnecessary buffer
reallocation while dequeuBuffer for sub layers.

Change-Id: I5327591af6c2a4ba290d2ea2059a407171e47ecf
Signed-off-by: jiayongqiang <jiayongqiang@xiaomi.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
No layers definitely doesn't mean new changes happened; so there's no
need to enforce the maximum refresh rate. Maintain current refresh rate
instead.

[gotenksIN: adapt to 14]

Change-Id: I31c9edc1a8ff3ff8340afd2f731df66755ffc9e0
Co-authored-by: Omkar Chandorkar <gotenksIN@aospa.co>
Signed-off-by: Omkar Chandorkar <gotenksIN@aospa.co>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
presentTime is missing when the user isn't touching the screen. To make
the estimation more accurate regardless of the user's input, remove this
check.

Change-Id: I27c55989b7f3d5ef5efe6b0d709135122bb6ba87
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
With the previous commit entering idle aggressively, it is important that
touch boost works well.

Since there are valid cases where we would want touch boost to work when
there are no layers detected (e.g., notification panel pull down if it
was not accounted for during the initial vote type set), change touch
boost to work regardless of layer's status.

Change-Id: I0a125cf9027440de205fa4ca611657b70b8a088f
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
30 frames for 300ms is quite enough for approximated calculation.

As an added bonus, the device reacts quicker when a higher refresh rate
should be used.

Change-Id: Id8930ab7343cc4e974b78929615e6efdd1c2b27e
Signed-off-by: Juhyung Park <qkrwngud825@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
tuned heap utilization, usap pool, and madvise limits for high-ram devices

Change-Id: I20f6009aa21b9286b11fa34347becdb9b61f0ee1
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
6gb: utilization 0.5->0.6 with usap/madvise/pinner, 4gb: bumping growthlimit and maxfree with usap/madvise, 2gb/1gb: raising minfree from 512k to reduce micro-gc churn
Change-Id: I4495ee8708a100db9e13c00120bb94735f50a744
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
client comp cache hit was clearing the expensive rendering hint mid-blur, causing the gpu boost to flap on/off frame to frame during steady state blur like qs held open. keep it asserted while a blur layer is still present.

Change-Id: I3632b4cca7ebb06d21ea1098764bef8de5e78f1c
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
clean clear-glass look on kawase v2, with adjustments: kMaxSurfaces 4->3, filterDepth 2.5->3.0, kInputScale 0.25->0.20 across all filter variants, plus a 4-entry cross-frame blur cache keyed on below-blur layer fingerprints so held-steady frames skip generate().

perfetto BackgroundBlur cost on felix outer 120Hz, QS expand+hold cycles:

metric   pre-cache   with cache   delta
count    324         279          -
avg      92.5us      58.3us       -37%
min      32.0us      7.0us        -78%
p50      72.2us      37.4us       -48%
p90      169.0us     155.8us      -8%
p95      187.5us     177.9us      -5%
p99      223.1us     240.4us      +8%
max      336.9us     292.3us      -13%

Change-Id: I89cb74e6fd2ab01d5c24b4f12162b8f24bad5e9f
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Change-Id: I82f555cd8731f56948473c42058652fa3931525e
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
MediaTek devices dither the framework hbm dimlayer from renderengine in order to
make the background match the system brightness, effectively only making the udfps icon bright.

Change-Id: I66cb2d7d2ca3d08f768c6a66521a60eaa66015aa
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Change-Id: I1939c578adc5b6e5aa221634dda9a143d0ea3aa9
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Change-Id: I2a1b99545fd369cd9f56a4279010e8f3766ff27c
Signed-off-by: rmp22 <195054967+rmp22@users.noreply.github.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Change-Id: Iedb7dfd993259fa91a8dbadbe83b32aa7c62862b
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
The cross-frame blur cache added in f5ccc185cb keys cached blur images on
a fingerprint of the layers below the blur, mixing in each layer's
GraphicBuffer::getId(), alpha, transform and boundaries. getId() returns
mId, which is assigned once at allocation and is stable for the lifetime
of the buffer object. Video producers (e.g. TikTok) recycle a small
buffer pool and write a new frame into the same buffer in place, so the
id stays constant while the pixels change.

When the QS shade is expanded over a playing video, the shade's
background-blur layer covers the screen and its blur input is the video
below it. The video pool cycles through only a few buffer ids, and with a
held panel the blur radius and blurRect are constant, so the fingerprint
collapses to a handful of values that all fit in the 4-entry cache. After
the first cycle every lookup hits and generate() is skipped, leaving the
on-screen blurred backdrop frozen even though the video keeps decoding.

Neither the buffer id, the acquire fence nor the geometry can detect an
in-place content update at composition time, so any buffer-backed layer
below the blur must be treated as dynamic. Track this while computing the
fingerprint and bypass the cross-frame cache (lookup and store) whenever
dynamic content is present. Fully static scenes (solid-color or
effect-only layers) remain eligible for the cache, preserving the
QS-hold power win the cache was added for. The per-frame cachedBlurs map
and the Output ClientCompositionRequestCache are unaffected.

(cherry picked from commit AlphaDroid-Project/frameworks_native@598e2e9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants