Closed Bug 1741767 Opened 3 years ago Closed 3 years ago

Large Image fails to load when using the Image constructor.

Categories

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

Firefox 91
defect

Tracking

()

RESOLVED FIXED
98 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox96 --- wontfix
firefox97 --- wontfix
firefox98 --- fixed

People

(Reporter: stu210239, Assigned: bobowen)

References

(Regression)

Details

(Keywords: parity-chrome, platform-parity, regression)

Attachments

(3 files)

Attached file index.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0

Steps to reproduce:

On Windows 10 build 19043.1348, firefox version >=86
load the MNIST handwritten digit sprite file from https://storage.googleapis.com/learnjs-data/model-builder/mnist_images.png via the Image() constructor and then draw the ImageData on a canvas using drawImage.

See the attached index.html for an example.

Actual results:

The canvas is black, instead of showing the sprite file.

Expected results:

Draw the sprite file (or part of it) on the canvas.
Up to firefox 86 this worked and still works in most other browsers.

Keywords: platform-parity
Keywords: parity-chrome
Summary: Image fails to load when not rendered on DOM → Large Image fails to load when using the Image constructor.
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Status: UNCONFIRMED → NEW
Has Regression Range: --- → yes
Has STR: --- → yes
Ever confirmed: true
Regressed by: 1547286

Confirmed that the testcase works if gfx.canvas.remote is false (restart required).
Since remote 2D canvas has been enabled since Firefox 86 in release (bug 1687276), it explains reporter's regression range.

Regressed by: 1687276
Flags: needinfo?(stu210239)

I can confirm that with gfx.canvas.remote set to false, the real usecase, being machine learning on the MNIST dataset with tensorflow.js, works again.

:bobowen, can you comment to the bug?

Flags: needinfo?(bobowencode)

(In reply to Sotaro Ikeda [:sotaro] from comment #6)

:bobowen, can you comment to the bug?

My guess is that when we are calling DrawTargetD2D1::DrawSurface (in the content process) it only creates an image to fill the canvas.
For DrawTargetRecording::DrawSurface, it records the entire surface, but that fails to be created in the GPU process, because it is too big.

So, I guess we should check to see if the surface is bigger than the canvas and if it is just create a separate surface, just for this draw, that is truncated to the width and height of the canvas.

Flags: needinfo?(bobowencode)
Severity: -- → S3
Priority: -- → P3

I dug out an old patch that uses the shared memory images in the canvas recording/translation.
It needs a bit more work, but it fixes this issue.

Assignee: nobody → bobowencode
Status: NEW → ASSIGNED

This also changes SharedSurfacesParent to use a StaticMonitor, so that we can
wait for the surface to be added.

Depends on D132602

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:bobowen, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(lsalzman)
Flags: needinfo?(bobowencode)

(In reply to Release mgmt bot [:sylvestre / :calixte / :marco for bugbug] from comment #11)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:bobowen, could you have a look please?
For more information, please visit auto_nag documentation.

I was thinking that I ought to try and write a test for this before I land.

Flags: needinfo?(lsalzman)
Pushed by bobowencode@gmail.com: https://hg.mozilla.org/integration/autoland/rev/7dc323e57fd4 Use shared memory surfaces in Canvas 2D recording. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/bc03f747b472 Reftest drawing a large image to canvas. r=bobowen

The test triggers the assertion failure even without D132703 when gfx.canvas.remote is false. So this is an existing problem.

We hit this assertion when the image is too large to create a D2D1Bitmap.

Bug 1088235 introduced the assertion. Bas, do you have a way round?

Flags: needinfo?(bas)

I'll re-land with the test disabled on debug builds if it is not easy to fix the problem because this is an existing problem.

See Also: → 1749413
Flags: needinfo?(bobowencode)
Pushed by VYV03354@nifty.ne.jp: https://hg.mozilla.org/integration/autoland/rev/1f75710950a2 Use shared memory surfaces in Canvas 2D recording. r=lsalzman https://hg.mozilla.org/integration/autoland/rev/a1cc440f0d95 Reftest drawing a large image to canvas. r=bobowen
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 98 Branch
See Also: → 1750381

Filed bug 1750381 for the assertion problem.

Flags: needinfo?(bas)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: