Closed Bug 1453367 Opened 7 years ago Closed 6 years ago

Stand up WebRender on Android/GeckoView

Categories

(Core :: Graphics: WebRender, enhancement, P1)

Unspecified
Android
enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: jrmuizel, Assigned: kats)

References

(Blocks 1 open bug)

Details

(Whiteboard: [geckoview:p2])

Attachments

(3 files, 1 obsolete file)

It would be really valuable to see how well it runs there.
Attached patch webrender-android.diff (obsolete) — Splinter Review
Here is a patch with hacks I used to see if WebRender would work. IIRC it didn't crash but also didn't draw anything. Will try to find time to work on it some more, but no promises!
Summary: Standup WebRender on Android → Stand up WebRender on Android
Depends on: 1457390
By following https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_for_Android_build carefully, I was able to get an android gecko build with source-level native debugging working. I didn't need to apply the attached patch, but I did run into several issues. I've worked around a couple, but have hit a blocker that will need some help from someone on the Gecko team. To get a build with WR, I did the following: * Hard-coded gfxPlatform::WebRenderEnvvarEnabled() to return true. * Disabled the android-specific code in InitWebRenderConfig() that force disables WR. The first problem I ran into is an assert in CompositorBridgeParent::RecvForceIsFirstPaint() due to mCompositionManager being null. The implementation of this method in CrossProcessCompositorBridgeParent.h is a no-op, so I locally made it a no-op in the android build too. I don't know if this is correct. After that, the code hits an assert MOZ_ASSERT(metadata) in ClipManager::DefineScrollLayers(), where aASR->mScrollableFrame->ComputeScrollMetadata() returns None. Any suggestions on what should be occurring in this code path or why it's different on android compared to desktop?
Flags: needinfo?(jmuizelaar)
Flags: needinfo?(bugmail)
(In reply to Glenn Watson [:gw] from comment #2) > After that, the code hits an assert MOZ_ASSERT(metadata) in > ClipManager::DefineScrollLayers(), where > aASR->mScrollableFrame->ComputeScrollMetadata() returns None. > > Any suggestions on what should be occurring in this code path or why it's > different on android compared to desktop? This difference might be caused by "containerful root scroll frames". You can simulate this condition on Desktop by setting the pref layout.scroll.root-frame-containers to true.
Yup, I can confirm that I get the same assertion failure on desktop with WR + that pref enabled.
If I set the layout.scroll.root-frame-containers pref to the same value as desktop, and comment out a couple of MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()) calls in AndroidDynamicToolbarAnimator, it *almost* seems to be working. The webpage view appears to be all white, however if you use a touch to try and scroll down, the actual content of the webpage is clearly visible where the rubber-band overscroll effect draws. From what I can see of the content in the rubber-band effect, the web page content looks to be correctly drawn. Does anyone have any ideas what may cause such behavior?
(In reply to Glenn Watson [:gw] from comment #5) > From what I can see of the content in the rubber-band effect, the web page > content looks to be correctly drawn. > > Does anyone have any ideas what may cause such behavior? This is likely a result of the no-op'd RecvForceIsFirstPaint thing. The Fennec code has a SurfaceView that it sets a background color before the first paint of a page (either during initial load or after a tab switch). The background color is set to transparent when it gets the first-paint notification, at [1]. Likely that's not getting hit, resulting in the background color remaining non-transparent, obscuring the painted content. For a temporary hack you can change [2] and [3] to use Color.TRANSPARENT and see if that gets you any further. [1] https://searchfox.org/mozilla-central/rev/033d45ca70ff32acf04286244644d19308c359d5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#290 [2] https://searchfox.org/mozilla-central/rev/033d45ca70ff32acf04286244644d19308c359d5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#202 [3] https://searchfox.org/mozilla-central/rev/033d45ca70ff32acf04286244644d19308c359d5/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java#180
Flags: needinfo?(bugmail)
Attached image amazon.png
Screenshot of WR running in Gecko on a Nexus 9 tablet.
Attached patch wr.patchSplinter Review
This is a patch which contains all the local hacks I applied to get WR running on Android in Gecko, in case anyone else wants to experiment locally.
Attachment #8967026 - Attachment is obsolete: true
Nice! It's good to see there's only a few things that really need fixing. I'll file bugs with details.
Assignee: nobody → gwatson
OS: Unspecified → Android
Whiteboard: [geckoview:p2]
Flags: needinfo?(jmuizelaar)
Adjusting title so that this explicitly refers to GeckoView. Firefox for Android (aka Fennec) is in maintenance mode, so there's not much point trying to enable WR there. And GeckoView is e10s-enabled, which will definitely impact the zooming implementation if nothing else. So time spent here is better spent on GeckoView than on Fennec, because work done for Fennec may not be applicable for GeckoView.
Summary: Stand up WebRender on Android → Stand up WebRender on Android/GeckoView
Assignee: gwatson → kats
I had to bisect a problem so I created builds based on the last few Android nightly m-c revisions. Putting this here in case anybody needs it later. Note that WR is enabled by default in the GeckoView Example app (the geckoview_example.apk is in the artifacts list of the build job) but not in Fennec itself. https://treeherder.mozilla.org/#/jobs?repo=try&author=kgupta%40mozilla.com&group_state=expanded&fromchange=d5d68cf6e33f568ee806bd1a868188d8587ced57&tochange=53892fbb31ba1fff82fb70a62b0725dd6ee30ca8
Now that it no longer crashes on startup, we can allow enabling WR on GeckoView. It's still not trivial at the moment since none of the GeckoView-based products have an about:config, but at least you can set env vars. So for the GeckoView example app, for instance, you can download the .apk from TreeHerder (it's an artifact on the android build job) and install it, and then run like so: adb shell am start -n org.mozilla.geckoview_example/.GeckoViewActivity --es env0 MOZ_WEBRENDER=1 to run with WR enabled. There is also some discussion around publishing a Reference Browser to the Play Store, and adding some settings there to enable WR.
Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dc03893f95d7 Allow enabling WebRender on non-Fennec Android. r=jnicol
No longer depends on: 1499785
No longer depends on: 1499789
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: