Closed Bug 1895168 Opened 6 months ago Closed 5 months ago

Slow canvases block the compositor thread

Categories

(Core :: Graphics: WebRender, defect, P1)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: nical, Assigned: nical)

References

(Blocks 3 open bugs)

Details

I've seen a few other bugs on file which were attributed to the canvas slowness, let's dedicate this one to the synchronization between the canvas renderer and the compositor. We really need to not do that since it causes slow canvases to block all rendering including the UI.

See the test case and profile in bug 1894847.

At some point the compositor blocks until the canvas is done rendering in RemoteTextureMap::WaitForRemoteTexture.
If the canvas has a very heavy workload, rendering can be blocked for a very long time (seconds). Adding WebGPU into the mix makes it even easier to hit because shader compilationg with FXC (on windows) can block the canvas renderer threads for multiple seconds.

If blocking is a necessity, we could use the low priority scene builder thread to block instead of the compositor thread. That way APZ and updating the UI would still work.

Sotaro, any ideas?

Flags: needinfo?(sotaro.ikeda.g)

There is a bug for removing the wait of RemoteTextureMap::WaitForRemoteTextureOwner() as Bug 1863257.

WebRenderAPI already has a capability of waiting remote texture, it could be extended as to wait also RemoteTextureOwner.

Flags: needinfo?(sotaro.ikeda.g)
Depends on: 1863257
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED

Did you actually mean to close this bug as FIXED?

Flags: needinfo?(nical.bugzilla)

Assuming it was by mistake.

Status: RESOLVED → REOPENED
Flags: needinfo?(nical.bugzilla)
Resolution: FIXED → ---

It was fixed by bug 1863257 which unfortunately was backed out since.

Bug 1898650 re-remove the sync wait on Nightly.

Assigning to Nical for tracking purposes.

Assignee: nobody → nical.bugzilla
Priority: P2 → P1

With the patches of bug 1899231 applied, background canvas demos can still heavily jank a profiler page.
I opened the testcase from bug 1894847 and profiled it. Then i tried navigating inside the profiler page. The UI was very janky.

Profile of the demo running : https://share.firefox.dev/3VgiFsU
Profile of interacting with the profiler UI while the demo runs in the background (Slow/janky) : https://share.firefox.dev/3RthYvv

Status: REOPENED → RESOLVED
Closed: 6 months ago5 months ago
Resolution: --- → FIXED

Sotaro landed the fix in another bug. Heavy canvas workloads can still slow things down but don't appear to freeze the whole UI for multiple seconds which is what this bug was about.

Blocks: 1894847
You need to log in before you can comment on or make changes to this bug.