Closed Bug 2093091 Opened 5 days ago Closed 3 days ago

Canvases presented through ImageBridge can stop updating, or be missing from compositor snapshots, while a remote texture is pending

Categories

(Core :: Graphics, defect)

defect

Tracking

()

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: aosmond, Assigned: aosmond)

References

(Blocks 1 open bug)

Details

Attachments

(3 external files)

Async image hosts (WebRenderImageHost with an async ref, used by OffscreenCanvas and WebGPU presenting through ImageBridge) only show a remote texture once its ready check completes. That pending ready check can be lost, can go stale, or is not waited on:

  1. RemoteTextureMap::SuppressRemoteTextureReadyCheck is called when queued WebRender transactions are flushed without waiting, for example when a WebRender bridge is torn down. It drops every pending ready check waiting for an unregistered owner, including checks made by unrelated image hosts. Those hosts are never called back and keep mWaitingReadyCallback set, so UseRemoteTexture ignores all later textures and the canvas stops updating.

  2. WebRenderImageHost does not keep its ready check in sync with its pending textures. Clearing the pending textures does not always reset mWaitingReadyCallback, and a ready callback for an owner that went away is treated as obsolete, leaving the host waiting.

  3. WebRenderBridgeParent::RecvGetSnapshot, which the reftest and WPT harnesses use for their screenshots, does not wait for pending ready checks. A snapshot taken after a frame was sent, but before its ready callback ran, shows the previous frame or nothing. This is a possible cause of the remaining failures in bug 1788351, after the test change in bug 2092395.

Proposed fix:

  • Replace SuppressRemoteTextureReadyCheck with CancelRemoteTextureReadyCheck, which only cancels the checks made by the caller.
  • Track WebRenderImageHost's pending ready check by generation, cancel it when the pending textures are cleared, and check again on any callback.
  • When taking a compositor snapshot, wait for the newest pending remote texture of each async image pipeline, use it, and generate a frame before flushing.

SuppressRemoteTextureReadyCheck dropped every pending ready check waiting
for an unregistered owner, including those of other image hosts, which
would then never be woken. Cancel only the caller's own checks, and
release them after the call since they may hold the last reference to the
caller.

Clearing the pending remote textures did not reset mWaitingReadyCallback,
so the host could ignore every later texture, and a ready callback for an
owner that went away was treated as obsolete and left it waiting. Track
the pending ready check by generation instead of by owner, cancel it when
the pending textures are cleared, and check again on any callback.

Remote textures presented via ImageBridge are only shown once their ready
check completes, so a snapshot taken in the meantime, such as for a reftest,
could miss the latest frame or show nothing at all.

Blocks: 1896789
Pushed by aosmond@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/af13fcc7d2f0 https://hg.mozilla.org/integration/autoland/rev/2eda5a850c09 Part 1. Only cancel the remote texture ready checks of the caller. r=gfx-reviewers,lsalzman https://github.com/mozilla-firefox/firefox/commit/5b40e4921d04 https://hg.mozilla.org/integration/autoland/rev/a269f04d98bf Part 2. Keep WebRenderImageHost's remote texture ready check in sync with its pending textures. r=gfx-reviewers,lsalzman https://github.com/mozilla-firefox/firefox/commit/df7c14f5e7f5 https://hg.mozilla.org/integration/autoland/rev/d82261fb103f Part 3. Wait for pending async remote textures when taking a compositor snapshot. r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 3 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: