Closed Bug 1837070 Opened 11 months ago Closed 10 months ago

Canvas testcase changes when tabbing away and back in Firefox, but not in Chrome or Safari (GPU-Canvas + OffscreenCanvas issue)

Categories

(Core :: Graphics: Canvas2D, defect, P3)

defect

Tracking

()

VERIFIED FIXED
117 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox-esr115 --- verified
firefox115 --- wontfix
firefox116 --- wontfix
firefox117 --- verified
firefox118 --- verified

People

(Reporter: twisniewski, Assigned: aosmond)

References

(Blocks 2 open bugs, Regressed 1 open bug)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file testcase.html

In the attached testcase, the red square in the red square in the blue circle vanishes when I tab away from the testcase and return. I've only tested this on my 2018 Macbook with HWA on (with acceleration off, the red square is not gone upon tabbing back).

Can repro on Wndows Nightly.
Only repros with gpu-canvas enabled.

Till December2011, the red box wouldnt even draw (only the blue circle would be visible). SO looks like parts of this testcase were not fully supported by gpu-canvas from the initial patches.

Keywords: regression
Regressed by: gpu-canvas
Blocks: gpu-canvas
No longer regressed by: gpu-canvas

Bug 1746110 was the first time when the red box would even draw on the screen.

Summary: Canvas testcase changes when tabbing away and back in Firefox, but not in Chrome or Safari. → Canvas testcase changes when tabbing away and back in Firefox, but not in Chrome or Safari (GPU-Canvas + OffscreenCanvas issue)
Severity: -- → S3
Priority: -- → P2

This bug has been marked as a regression. Setting status flag for Nightly to affected.

:lsalzman Hello, just wanted to see if this was a planned fix for Fx 116?

https://whattrainisitnow.com/release/?version=116

Flags: needinfo?(lsalzman)

Hi :bhood! Adding you to the NI since I saw you triaged this bug. Just a reminder that soft code freeze for 116 is today.

Flags: needinfo?(bhood)

This is offscreen canvas, so not really P2 IMO. I've been on PTO, so there isn't really time to address any fix for 116.

Flags: needinfo?(lsalzman)
Priority: P2 → P3
Flags: needinfo?(bhood)

After discussion with Andrew, it seems like we're not calling OffscreenCanvas::UpdateDisplayData from a paint here: https://searchfox.org/mozilla-central/source/layout/generic/nsHTMLCanvasFrame.cpp#126

WebRenderImageHost clears it TextureHost on tabbing away, but it never gets re-established on tabbing back because of the above.

We do an analogous thing calling ShareableCanvasRender::UpdateCompositable client here which makes the non-offscreen case work: https://searchfox.org/mozilla-central/source/layout/generic/nsHTMLCanvasFrame.cpp#154

Andrew believes the fix is quite involved due to threading/worker issues not allowing us to directly access OffscreenCanvas from there. However, he is best equipped to write the proper fix for this, so I am going to pass this bug over to him.

Flags: needinfo?(aosmond)
Assignee: nobody → aosmond
Status: NEW → ASSIGNED
Flags: needinfo?(aosmond)

When we recreate the display list, e.g. after tabbing away, we need to
ensure we flush the OffscreenCanvas because our resource handles will be
invalidated. This requires the OffscreenCanvasDisplayHelper to know
which OffscreenCanvas it belongs to, and a worker reference if necessary
to do the dispatching for the flush. Otherwise we would require the
canvas to be updated manually by the web application to repaint.

Pushed by aosmond@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a23f7c7cfe46
Ensure we flush OffscreenCanvas when the display list is recreated. r=lsalzman
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch

The patch landed in nightly and beta is affected.
:aosmond, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox116 to wontfix.

For more information, please visit BugBot documentation.

Flags: needinfo?(aosmond)

One week out from release, not worth uplifting.

Flags: needinfo?(aosmond)
Flags: qe-verify+

Reproducible on a 2023-07-22 Nightly build on macOS 12.
Verified as fixed on Firefox 117.0b3(build ID: 20230803180221) and Nightly 118.0a1(build ID: 20230803214045) on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
Duplicate of this bug: 1849997

Comment on attachment 9345262 [details]
Bug 1837070 - Ensure we flush OffscreenCanvas when the display list is recreated.

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: Missing content when tabbing away from a page with an OffscreenCanvas and returning, as well as painting issues when combining an OffscreenCanvas with CSS changes such as filters
  • User impact if declined: Some websites might not display all the content with OffscreenCanvas in certain contexts
  • Fix Landed on Version: 117
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Not risky, the change is well understood and has already shipped to release
Attachment #9345262 - Flags: approval-mozilla-esr115?

Comment on attachment 9345262 [details]
Bug 1837070 - Ensure we flush OffscreenCanvas when the display list is recreated.

Approved for 115.3esr

Attachment #9345262 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Blocks: 1853207

Reproducible on a 2023-07-22 Nightly build on macOS 12.
Verified as fixed on Firefox ESR 115.3.0(build ID: 20230918121054) on macOS 12, Windows 10, Ubuntu 22.

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

Attachment

General

Created:
Updated:
Size: