Closed Bug 1794380 Opened 2 years ago Closed 1 year ago

Accelerated canvas with out-of-process webgl is broken on Android

Categories

(Core :: Graphics: Canvas2D, defect)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: jnicol, Assigned: sotaro)

References

Details

Attachments

(1 file)

At all hands we separately discussed enabling both webgl.out-of-process and gfx.canvas.accelerated on Android, after quickly checking they weren't completely broken.

Kelsey has already enabled out-of-process webgl in bug 1793679.

While we tested each of these features worked independently, we didn't test them in conjunction. But since I had left gfx.canvas.accelerated enabled on my phone following all hands, then bug 1793679 landed, canvases are now broken on my device. They just show as black rectangles. So there's a bug when these are both enabled together.

Lee, if you were planning to enable accelerated canvas on Android soon, please hold off until we get to the bottom of this. I'll see if I can figure out what the problem is, though if you have any suggestions on where to look that would be helpful.

Flags: needinfo?(lsalzman)

Bummer, but good catch!

I've tracked this down to RenderAndroidSurfaceTextureHost::Lock() returning early here. In debug builds we hit the assert just above because mPrepareStatus has not been set. This is because neither PrepareForUse() or NotifyForUse() are being called prior to Lock().

In normal OOP webgl, we do not hit this bug because the TextureHost gets created the "normal" way, by CompositableParentManager::ReceiveCompositableUpdate which calls PrepareForUse(), and then AsyncImagePipelineManager::UpdateImageKeys() calls NotifyForUse.

But with accelerated canvas, the texture host gets created from RemoteTextureMap::PushTexture() (called from HostWebGLContext::CopyToSwapChain).

Sotaro, do we need to add calls to PrepareForUse(), NotifyForUse() and NotifyNotUsed() to RemoteTextureMap?

Flags: needinfo?(sotaro.ikeda.g)

When I opend the following url with pref gfx.canvas.accelerated = true on android with Pixel 3a, I saw a crash in gpu process.

I am going to look into RenderAndroidSurfaceTextureHost tomorrow.

Triage - rating as S3 because a workaround exists, a case could be made for S2 though.

Severity: -- → S3

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

When I opend the following url with pref gfx.canvas.accelerated = true on android with Pixel 3a, I saw a crash in gpu process.

I am going to look into RenderAndroidSurfaceTextureHost tomorrow.

The crash did not happen when GeckoView app was built with "ac_add_options --target=aarch64".

Depends on: 1795004

For now, it seems better to keep PrepareForUse(), NotifyForUse() and NotifyNotUsed() to handle SurfaceTexture limitation.

Assignee: nobody → sotaro.ikeda.g
Status: NEW → ASSIGNED
Flags: needinfo?(sotaro.ikeda.g)
Attachment #9298389 - Attachment description: WIP: Bug 1794380 - Fix accelerated canvas with out-of-process webgl → WIP: Bug 1794380 - Fix accelerated canvas with out-of-process webgl on Android
Attachment #9298389 - Attachment description: WIP: Bug 1794380 - Fix accelerated canvas with out-of-process webgl on Android → WIP: Bug 1794380 - Fix RemoteTexture with WebGL sync present on Android
Blocks: 1800178
Blocks: 1800188
Flags: needinfo?(lsalzman)
Attachment #9298389 - Attachment description: WIP: Bug 1794380 - Fix RemoteTexture with WebGL sync present on Android → Bug 1794380 - Fix RemoteTexture with WebGL sync present on Android

Tests passed with RemoteTexture with WebGL sync present on Android.

Accelerated canvas seems to work on android device, but pref gfx.canvas.accelerated=true caused test failures. It seems like a different problem.

With pref gfx.canvas.accelerated=true, canvas renderings were broken on android emulator. The boroken rendering seemed to happen by GL of android emulator. The boroken rendering did not happen with tests on android hardware.

https://treeherder.mozilla.org/jobs?repo=try&revision=0e9b0fd6f7fdf62e6b2a259f98cfb6326df5bc3f

Blocks: 1801824

Sotaro, is it possible to check whether an up-to-date version of the emulator works? If so, perhaps we can upgrade the version used on CI

Flags: needinfo?(sotaro.ikeda.g)
Pushed by sikeda.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/57c22df61a2a
Fix RemoteTexture with WebGL sync present on Android r=gfx-reviewers,lsalzman
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch

(In reply to Jamie Nicol [:jnicol] from comment #10)

Sotaro, is it possible to check whether an up-to-date ersion of the emulator works? If so, perhaps we can upgrade the version used on CI

This is going to be handled at Bug 1801824.\

Updating emulator version became simple by Bug 1718341. And just updating emulator version caused a lot of test failure.

Test failures of R-nofis was addressed by updating emulator. Test failures of R-swr-nofis was not addressed by updating emulator. I am going to look into the test failures of R-swr-nofis.

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

Attachment

General

Created:
Updated:
Size: