WebGL on Android is doing readback (not using SharedSurface_SurfaceTexture) by default
Categories
(Core :: Graphics: CanvasWebGL, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr68 | --- | unaffected |
firefox-esr78 | --- | unaffected |
firefox78 | --- | unaffected |
firefox79 | --- | wontfix |
firefox80 | --- | wontfix |
firefox81 | --- | wontfix |
firefox82 | --- | wontfix |
firefox83 | --- | fixed |
People
(Reporter: sotaro, Assigned: snorp)
References
(Blocks 2 open bugs, Regression)
Details
(Keywords: regression)
Attachments
(2 files)
WebGL in content process always used SharedSurface_SurfaceTexture until Bug 1632249 fix. Since the fix, SharedSurface_SurfaceTexture is not used if webgl.enable-surface-texture is false.
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
|
||
The following is old implementation for selecting SurfaceFactory_SurfaceTexture.
https://searchfox.org/mozilla-esr68/source/gfx/gl/GLScreenBuffer.cpp#94
Reporter | ||
Comment 2•4 years ago
|
||
Since Bug 1632249, at first, TexTypeForWebgl() chooses TextureType::AndroidNativeWindow only when StaticPrefs::webgl_enable_surface_texture() is true.
Then SurfaceFactory::Create() chooses a factory when texture type is TextureType::AndroidNativeWindow.
Comment 4•4 years ago
|
||
It sounds like the pref is set wrong, but we had two wrongs make a right before, when we ignored the pref!
Reporter | ||
Updated•4 years ago
|
Comment 5•4 years ago
|
||
This should match the previous behavior where non-parent processes
ignored the pref and used surface textures.
Updated•4 years ago
|
Updated•4 years ago
|
Comment 6•4 years ago
|
||
Set release status flags based on info from the regressing bug 1632249
Assignee | ||
Comment 7•4 years ago
|
||
Jamie, enabling SurfaceTexture-backed WebGL as this patch attempts to do seems to MOZ_CRASH for me in Fenix[1]. I get some relevant looking driver spew before:
07-22 16:15:06.251 26521 26542 I Adreno : GetNumBufferSupported: clamped value 2 is not suitable as it exceeded maxBufferCount requested by consumer 1
07-22 16:15:06.251 26521 26542 I Adreno : InitializeInternal:GetNumBufferSupported failed
07-22 16:15:06.251 26521 26542 I Adreno : Create: Initialize failed
07-22 16:15:06.251 26521 26542 I Adreno : GetNumBufferSupported: clamped value 2 is not suitable as it exceeded maxBufferCount requested by consumer 1
07-22 16:15:06.251 26521 26542 I Adreno : InitializeInternal:GetNumBufferSupported failed
07-22 16:15:06.251 26521 26542 I Adreno : Create: Initialize failed
Do you have a chance to look into this? Without the ST path, WebGL is doing readpixels under WebRender and it's very sad.
[1] https://crash-stats.mozilla.org/report/index/31b3f3d5-98cf-4181-8c61-227a90200722
Updated•4 years ago
|
Updated•4 years ago
|
Comment 8•4 years ago
|
||
Hey snorp, I've tried to reproduce your crash but it works fine for me on a few different devices. Webgl aquarium runs poorly, then I flip that pref and it runs much faster, without crashing.
Is there a specific website you encountered this on? Is it reproducible? Could you try a different device and see if that makes a difference?
Assignee | ||
Comment 9•4 years ago
|
||
(In reply to Jamie Nicol [:jnicol] from comment #8)
Hey snorp, I've tried to reproduce your crash but it works fine for me on a few different devices. Webgl aquarium runs poorly, then I flip that pref and it runs much faster, without crashing.
Is there a specific website you encountered this on? Is it reproducible? Could you try a different device and see if that makes a difference?
It's every website (that uses WebGL), but I've only tried it on Pixel 4 XL. I'm charging some other devices to try there.
Comment 10•4 years ago
|
||
P1 bug sitting around for a while without a fix. Jeff can we get something moving here or update the status flags? Thanks!
Assignee | ||
Comment 11•4 years ago
|
||
No problem on Pixel 2, so seems to be somewhat specific to my Pixel 4 XL.
Comment 12•4 years ago
|
||
Interesting. Thanks for testing!
Sotaro, do you have a Pixel 4 or Pixel 4XL? Kris, this is an important crash to fix. If Sotaro doesn't have a device maybe I should order one for myself?
In the meantime should we enable the pref but add some code to disable it on the Pixel 4 XL? (and maybe the Pixel 4, and maybe all Adreno 640 devices)
Assignee | ||
Comment 13•4 years ago
|
||
The problem seems related to using a single-buffer SurfaceTexture. If I use a multi-buffer one it doesn't crash, but perf is awful (about 4 fps). Profile shows fDrawElements()
taking forever, which is very curious.
We probably need to adjust the EGLConfig somehow to be compatible with a single-buffer SurfaceTexture
.
Comment 14•4 years ago
|
||
Maybe Sotaro's AHardwareBuffer work might fix it, too.
I think there are some API levels on which we're forced to use multi-buffer, so we should make sure performance isn't terrible on those!
Reporter | ||
Comment 15•4 years ago
|
||
(In reply to Jamie Nicol [:jnicol] from comment #12)
Interesting. Thanks for testing!
Sotaro, do you have a Pixel 4 or Pixel 4XL?
Sorry, I do not have them, I just have Pixel 3a and it did not cause the problem.
Comment 16•4 years ago
|
||
Since Adreno 640 will be enabled on next release with FF80 and it looks like we don't have a solution for this in mind yet, disabling WR for 640 and uplifting sounds like the right choice.
To move this forward, is there anything we can try without buying the phone?
Comment 17•4 years ago
|
||
This pref isn't currently enabled, so I don't think we have to worry about uplifting anything just yet. We should enable it though (with a workaround of some sort for affected devices).
I'm also not sure whether it's webrender specific? Presumably we're currently going through a readback path for layers too, and flipping this pref will make both layers and webrender use SurfaceTextures? It might be a useful clue if it does in fact only crash for webrender.
Snorp, does it only crash with webrender enabled? Or does it crash for either layers or webrender? Also, has canvas always crashed on your Pixel 4XL when using the SurfaceTexture path, or is it a recent regression (likely from the OOP changes)?
Assignee | ||
Comment 18•4 years ago
|
||
(In reply to Jamie Nicol [:jnicol] from comment #17)
Snorp, does it only crash with webrender enabled? Or does it crash for either layers or webrender?
It crashes the same way with or without WR.
Also, has canvas always crashed on your Pixel 4XL when using the SurfaceTexture path, or is it a recent regression (likely from the OOP changes)?
I'm not totally sure. I can try to bisect a bit.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Comment 19•4 years ago
|
||
mozregression isn't working, but I can't seem to repro the crash anymore with latest m-c. It also works in Fenix nightly. I'd say we should go ahead and land this.
Comment 20•4 years ago
|
||
Comment 21•4 years ago
|
||
Backed out changeset 25f0521ab3a1 (Bug 1654459) for causing reftest crash in webgl-color-test.html CLOSED TREE
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=313355272&repo=autoland&lineNumber=28782
Backout: https://hg.mozilla.org/integration/autoland/rev/297140bda15a1014c1af4515738b20c991b949b6
Comment 22•4 years ago
|
||
Updated•4 years ago
|
Reporter | ||
Comment 23•4 years ago
|
||
(In reply to Natalia Csoregi [:nataliaCs] from comment #22)
Also crashes: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=313382822&repo=autoland&lineNumber=2306
This looks similar to Bug 1659681.
Assignee | ||
Comment 24•4 years ago
|
||
Comment 25•4 years ago
|
||
Updated•4 years ago
|
Comment 26•4 years ago
|
||
bugherder |
Comment 27•4 years ago
|
||
Comment 28•4 years ago
|
||
Backed out changeset 1c35c35dd964 (Bug 1654459) for causing reftest failures in webgl-color-test.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/ae2a56ca44dc538b7d3a3ade4722d00174b23a2f
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=314758596&repo=autoland&lineNumber=27412
Updated•4 years ago
|
Reporter | ||
Comment 29•4 years ago
|
||
(In reply to Alexandru Michis [:malexandru] from comment #28)
Backed out changeset 1c35c35dd964 (Bug 1654459) for causing reftest failures in webgl-color-test.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/ae2a56ca44dc538b7d3a3ade4722d00174b23a2f
Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=314758596&repo=autoland&lineNumber=27412
I wonder if the problem might be related to Bug 1595026.
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 30•4 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #29)
I wonder if the problem might be related to Bug 1595026.
Yeah, that seems plausible. Also, all of the failures have "readback" in the query string, which seems significant. I would've guessed that would cause it to use the readback path and avoid SurfaceTexture entirely, but maybe that's not right? Jeff?
Reporter | ||
Comment 31•4 years ago
|
||
I confirmed that WebGL with SurfaceTexture and WebRender worked on Android8 emulator(x86) and Android 10 emulator(x86) . It did not work on Android 7 emulator(x86) . Android 7.0 emulator is current default emulator on m-c. WebGL became stable with Bug 1665300.
Reporter | ||
Comment 33•4 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #29)
(In reply to Alexandru Michis [:malexandru] from comment #28)
Backed out changeset 1c35c35dd964 (Bug 1654459) for causing reftest failures in webgl-color-test.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/ae2a56ca44dc538b7d3a3ade4722d00174b23a2f
I saw a similar rendering artifact with Android 7.1.1 emulator with GPU on Windows. The rendering happened correctly with Android 8.0 emulator with GPU on Windows.
Reporter | ||
Comment 34•4 years ago
|
||
When I run SurfaceTexture WebGL on Android 7.1.1 device with Adreno 506, the problem did not happen. WebGL was rendered as expected. Then the problem seemed to happen only on Android 7 emulator.
Comment 35•4 years ago
|
||
Comment 36•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Comment 37•4 years ago
|
||
(In reply to James Willcox (:snorp) (jwillcox@mozilla.com) (he/him) from comment #30)
(In reply to Sotaro Ikeda [:sotaro] from comment #29)
I wonder if the problem might be related to Bug 1595026.
Yeah, that seems plausible. Also, all of the failures have "readback" in the query string, which seems significant. I would've guessed that would cause it to use the readback path and avoid SurfaceTexture entirely, but maybe that's not right? Jeff?
It might not be working properly. :S Thanks for the heads-up.
Updated•4 years ago
|
Description
•