Closed Bug 1669567 Opened 4 years ago Closed 3 years ago

The picture cache texture array gets resized too many times on first scroll

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: jnicol, Assigned: jnicol)

References

Details

Attachments

(2 files)

On this device (Samsung A5 2017), on the first render we allocate the main picture cache array with 8 layers. We then grow this in increments of 4 layers. With a single fling on mozilla.com, I see it grow to 12, 16, then 20 within the space of a few seconds. Each of these allocations can take around 30ms on this mid-range android phone, which means that the user's first scroll after opening firefox is very stuttery.

This is presumably either a case of not evicting picture cache tiles aggressively enough, or not picking a realistic initial size. I'd lean more towards the former. (Is there much point in holding on to off-screen tiles?) Glenn, how do we decide to evict picture cache allocations from the cache? Is it via the normal LRU mechanism? Should we consider evicting them manually and immediately when they go offscreen instead?

Summary: The picture cache texture array gets resized too many times → The picture cache texture array gets resized too many times on first scroll
Flags: needinfo?(gwatson)

Looking at the specs, so I can emulate locally, is that a 1920 x 1080 device? And is the behavior similar whether running in portrait and landscape?

Yep, 1080x1920. I only tested in portrait mode. I'd expect there to be fewer tiles in landscape, because it still needs 2 columns of 1024-wide tiles, but the number of rows would be smaller. But even if the number of tiles is lower the behaviour could be similar.

Previously we used a single texture array for a given tile size,
and resized the texture array as more tiles were needed.

However, this results in expensive driver stalls and GPU copy times
when resizing the array.

Instead, use a fixed slice count for each texture array, and support
multiple textures with the same tile size.

This may result in slightly more draw calls during compositing of
picture cache tiles due to batch breaks, but will remain a small
number due to the limited number of picture cache tiles that are
allocated at any one time.

Added a patch with a potential solution to test on device and see if that's reasonable.

Flags: needinfo?(gwatson)
Pushed by gwatson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fe44655a70ca
Use fixed size texture arrays for picture cache slices. r=jnicol

My comment in riot earlier that we retain tiles for a full screen size either side of the viewport was incorrect - it's only one tile height either side of the viewport that we retain.

I changed that to not retain anything not visible and the eviction seemed to be working correctly - I could count the number of tiles on screen, and it matched the number of live picture cache tiles.

So, if you are seeing many more than that, you might want to locally change [1] to not inflate at all, and then add some debug logs to see how many slices are being created and why those extra tiles exist in your use case.

[1] https://searchfox.org/mozilla-central/source/gfx/wr/webrender/src/picture.rs#2713

Keywords: leave-open

Most platforms have scrollbars > 16 pixels in width. This typically
reduces the number of native layers allocated on most platforms for
scrollbars. This is quite important as the fixed overhead of each
native layer is relatively high on DC and CA.

See Also: → 1669960
Pushed by gwatson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/18fb8d11fd2d
Increase the default tile size used for scrollbars. r=jnicol

Lee, looks like this failure is a crash inside SWGL - any ideas what might cause it (the patch changes the dimensions of tiles used for scroll bars).

Flags: needinfo?(gwatson) → needinfo?(lsalzman)
Depends on: 1671055
Flags: needinfo?(lsalzman)
Pushed by gwatson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c4d6ac24a7f6
Increase the default tile size used for scrollbars. r=jnicol
Regressions: 1670509

The leave-open keyword is there and there is no activity for 6 months.
:jnicol, maybe it's time to close this bug?

Flags: needinfo?(jnicol)

Yes I believe this is fixed now as we no longer use texture arrays for picture cache tiles

Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(jnicol)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: