Closed Bug 1506088 Opened 6 years ago Closed 5 years ago

Allow webrender recording on android

Categories

(Core :: Graphics: WebRender, defect, P5)

Unspecified
Android
defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox65 --- affected

People

(Reporter: jnicol, Unassigned)

References

(Blocks 1 open bug)

Details

Tried the following command:

> adb shell am start -n org.mozilla.geckoview_example/.GeckoViewActivity --es env0 MOZ_WR_RECORDING=1

and it doesn't work. There are a couple problems.

First, it seems like the environment variable is propagated to the child process after webrender has been initialized, so it doesn't try to record. Not sure how we handle environment variables, I'm just basing this assumption on seeing "GeckoThread: env var: MOZ_WR_RECORDING=1" in the logcat after the webrender initialization messages. 

If that is worked around, we encounter a crash because the default recording path is not writeable. So we crash in BinaryRecorder::new when we unwrap() the result of File::create(). We might want to make BinaryRecorder::new fail gracefully, and we definitely need to pick a path which we can write to.
Did you mean to use ENABLE_WR_RECORDING instead of MOZ_WR_RECORDING? [1]

I would expect the env var to get set for all processes, because it's put in the environment by the Java code at [2] before we start gecko at all. And since MOZ_WEBRENDER=1 works, the env vars must be there before webrender starts up.

[1] https://searchfox.org/mozilla-central/rev/17f55aee76b7c4610a974cffd3453454e0c8de7b/gfx/thebes/gfxEnv.h#38
[2] https://searchfox.org/mozilla-central/rev/17f55aee76b7c4610a974cffd3453454e0c8de7b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#123
oops, yes I did. That explains that problem!

Just the path issue then.
Ok, we can either hard-code /sdcard/ to the front of the path on android, or do a less-hacky thing and use some appropriate environment variable that gets set in GeckoLoader.java or something.
/sdcard didn't work for me. Maybe apps need permission to write to the sd card, and fennec has that permission but geckoview_example doesn't? I hard coded /data/data/org.mozilla.geckoview_example, which works, but yes I think we should be using an environment variable or something to that effect.
We can try using EXTERNAL_STORAGE [1] or if that doesn't work, MOZ_ANDROID_DATA_DIR [2]. I think external storage would be preferred if it works, because downloads go into the same dir and so it should have permissions to write into it, plus people will have an easier time finding it.

[1] https://searchfox.org/mozilla-central/rev/17f55aee76b7c4610a974cffd3453454e0c8de7b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#149
[2] https://searchfox.org/mozilla-central/rev/17f55aee76b7c4610a974cffd3453454e0c8de7b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/mozglue/GeckoLoader.java#128
Also I'm not sure if WR recording stuff is still really supported. WR captures is the new hotness, and I'd like to get that working. I've filed bug 1508652 for it to keep it separate in case we want both recording and captures.

Glenn reported the WR captures working on Android. There is a separate task (discussed but not filed) for supporting continuous capture mode - it will bring the new capturing functionality on par with the old binary recording. With this in mind, I believe this bug can be closed. Please feel free to re-open!

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID

Also for future reference https://wiki.mozilla.org/Platform/GFX/Quantum_Render#Captures documents how to get captures on Android.

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