Closed Bug 1696905 Opened 4 years ago Closed 3 years ago

Picture cache tiles are rendered behind full-screen video

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED
90 Branch
Tracking Status
firefox90 --- fixed

People

(Reporter: nical, Assigned: nical)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

When OS composition is unavailable or disabled, watching a full-screen youtube video I see draw calls emitted for each picture cache tile behind the full-screen video.

They don't pass the depth test but they add up to a non-negligible amount of useless draw calls (40 on a 4k screen) as well as some wasted gpu work.

I traced it down to this condition: https://searchfox.org/mozilla-central/rev/fa48ebee58d59fa846919c3e2c3122b08db57c9c/gfx/wr/webrender/src/picture.rs#4712

On youtube there is a screenful of tiles behind the video that have non-root spatial node index, adding up to 20 extra draw calls and lots of overdraw.

The condition was introduced in https://phabricator.services.mozilla.com/D69760. From a glance at the bug this patch was solving it looks like we could still have a separate tag to mark non-fixed position tiles as occluded for the purpose of compositing, even if we keep requesting/rendering them when they invalidate.

On the side I have been looking into another simple occlusion culling algorithm which is fully precise for axis-aligned rect (doesn't need a z-buffer) and I think would be a good fit for the compositing pass.

Flags: needinfo?(gwatson)

Yes, I only vaguely recall the details of that patch - but from the description it does sounds like we could separate that logic a bit, and then be able to occlude non-fixed tiles again.

Switching to another occlusion culling algorithm sounds good to me - but if we can let's wait until the non-opaque compositor surface work lands. It doesn't change the occlusion culling logic itself, but it does change a lot of code around there (in particular the z_id and ordering of compositor and content surfaces). I'm hoping to have patches for this up and reviewed by the end of the week, ready to land as soon as the upcoming soft freeze is complete.

Flags: needinfo?(gwatson)

This patch introduces a simple culling algorithm that splits compositor tiles into only their visible parts, removing the need for a depth buffer. This reduces the draw-call count as well well as the memory usage and bandwidth associated with the depth buffer.

Assignee: nobody → nical.bugzilla
Attachment #9218685 - Attachment description: WIP: Bug 1696905 - CPU-side occlusion culling for picture cache tiles. → Bug 1696905 - CPU-side occlusion culling for picture cache tiles. r=#gfx-reviewers
Status: NEW → ASSIGNED

It used to be more convenient to store them in separate arrays but with the new occlusion culling code we don't benefit from it and have to undo it to traverse tiles from front to back.
This is a cleanup patch that should not change the behavior of the code.

Depends on D113532

Pushed by nsilva@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3e741504af67 CPU-side occlusion culling for picture cache tiles. r=gfx-reviewers,lsalzman,gw https://hg.mozilla.org/integration/autoland/rev/de6dfc676a68 Store composite tiles in a single array. r=gfx-reviewers,bradwerth
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 90 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: