Closed Bug 1323612 Opened 7 years ago Closed 7 years ago

Build webrender on android

Categories

(Core :: Graphics: WebRender, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: sotaro, Assigned: sotaro)

References

Details

Attachments

(3 files, 17 obsolete files)

2.49 KB, patch
Details | Diff | Splinter Review
1.08 KB, patch
froydnj
: review+
Details | Diff | Splinter Review
14.88 KB, patch
kats
: review+
Details | Diff | Splinter Review
We need to make graphic branch works on android
Blocks: webrender
For now, we need to set Android NDK's API leven to 18. Since WebRender requests OpenGL ES 3.0 on android and it is supported since api level 18 on android.
android build requests rust librarys of armv7-linux-androideabi. Without them, "./mach build" emitted the following error.

----------------------------------------------------------------------

 0:00.80 DEBUG: Executing: `/usr/local/bin/rustc --crate-type staticlib --target=armv7-linux-androideabi -o /tmp/conftestsC6uc0.rlib /tmp/conftestym0zSN.rs`
 0:00.80 DEBUG: The command returned non-zero exit status 101.
 0:00.80 DEBUG: Its error output was:
 0:00.80 DEBUG: | error[E0463]: can't find crate for `std`
 0:00.80 DEBUG: |   |
 0:00.80 DEBUG: |   = note: the `armv7-linux-androideabi` target may not be installed
 0:00.80 DEBUG: |
 0:00.80 DEBUG: | error: aborting due to previous error
 0:00.80 DEBUG: |
 0:00.80 ERROR: Cannot compile for arm-unknown-linux-androideabi with /usr/local/bin/rustc
 0:00.80 The target may be unsupported, or you may not have
I did not know the official place to download the librarys of armv7-linux-androideabi. Then I referred servo build. bootstrap_commands.py[1] did download of pre-built compiler and prebuilt libraries. I manually downloaded the library from [2].

[1] https://dxr.mozilla.org/servo/source/python/servo/bootstrap_commands.py

[2] https://static-rust-lang-org.s3.amazonaws.com/dist/2016-11-29/rust-std-nightly-armv7-linux-androideabi.tar.gz
I used the following mozconfig to build on android

--------------------------------------------------

# Build Firefox for Android:
ac_add_options --enable-application=mobile/android
ac_add_options --target=arm-linux-androideabi

# With the following Android SDK and NDK:
ac_add_options --with-android-sdk="/absolute/path/to/android-sdk"
ac_add_options --with-android-ndk="/absolute/path/to/android-ndk-r11b" 

ac_add_options --with-android-version="18"
ac_add_options --enable-rust
ac_add_options --enable-webrender
Attached patch wip patch (obsolete) — Splinter Review
Attached patch wip patch (obsolete) — Splinter Review
Fixed start up freeze. But gecko rendering result was not shown.
Attachment #8818756 - Attachment is obsolete: true
See Also: → 1323316
Attached patch wip patch (obsolete) — Splinter Review
Output webrender composition result. Some gl calls seems to work, but image rendering of webrender did not work well. The symptom seems same to Bug 1323316 Comment 1.
Attachment #8818820 - Attachment is obsolete: true
Depends on: 1324326
Depends on: 1324345
Depends on: 1324355
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8818837 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8819774 - Attachment is obsolete: true
Depends on: 1324648
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8820170 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Addressed profiler's glyph rendering. Image rendering still did not work.
Attachment #8820568 - Attachment is obsolete: true
During checking I noticed that gl::RED works on ANGLE on windows as GL_FORMAT_A, but gl::RED did not work on my nexus5X(arm). It might be a reason why GL_FORMAT_BGRA is used for ImageFormat::A8.
Attached patch wip patch (obsolete) — Splinter Review
Rebased. Rendering result and problems were same, but oom crash happened more easy.
Attachment #8821005 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8827340 - Attachment is obsolete: true
FFI is broken on android, bug 1332737 is going to address it.
Depends on: 1332737
(In reply to Sotaro Ikeda [:sotaro] from comment #16)
> FFI is broken on android, bug 1332737 is going to address it.

It causes crash.
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8827341 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8830552 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8830928 - Attachment is obsolete: true
With https://github.com/servo/webrender/pull/791, I confirmed rendering on android device.
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8830946 - Attachment is obsolete: true
Attached patch wip patch (obsolete) — Splinter Review
Attachment #8830988 - Attachment is obsolete: true
With attachment 8831127 [details] [diff] [review], content is rendered, but scroll and touch did not work since APZ is not implemented yet.
:kats, is it possible to enable touch without apz? Touch did not work, but I could check the navigation by bluetooth keyboard.
Flags: needinfo?(bugmail)
Not really, we don't have any main-thread touch scrolling code. I can probably hack something up to add to the fennec browser.js if you really want.
Flags: needinfo?(bugmail)
This is what i had in mind. I'm doing a regular fennec build now to see if it works.
Comment on attachment 8831152 [details] [diff] [review]
very slightly tested scrolling patch

I tried this patch in a regular firefox for android build and it seemed to do what I expected. So I think it should give you some basic ability to scroll in a webrender android build as well. I don't know if you'll be able to tap on links though, probably not.
Attachment #8831152 - Attachment description: totally untested scrolling patch → very slightly tested scrolling patch
Thanks!
attachment 8831152 [details] [diff] [review] and with some modifications to nsWindow, I also confirmed the scroll:-)
Attached patch wip patch (obsolete) — Splinter Review
Add attachment 8831152 [details] [diff] [review] and change to nsWindow. Confirmed that main thread scroll works. Touch still do now work though.
Attachment #8831127 - Attachment is obsolete: true
It's worth noting that for the time being you need the following in your mozconfig to build this:

ac_add_options --with-android-version=18
ac_add_options --enable-webrender
Assignee: nobody → sotaro.ikeda.g
Depends on: 1337625
Attachment #8831193 - Attachment is obsolete: true
(In reply to George Wright (:gw280) (needinfo me!) from comment #32)
> It's worth noting that for the time being you need the following in your
> mozconfig to build this:
> 
> ac_add_options --with-android-version=18
> ac_add_options --enable-webrender

With attachment 8852425 [details] [diff] [review], we do not need "ac_add_options --with-android-version=18".
No longer depends on: 1337625
Depends on: 1351643
Depends on: 1351480
Attachment #8852425 - Attachment is obsolete: true
Attachment #8854358 - Flags: review?(bugmail)
Comment on attachment 8854358 [details] [diff] [review]
patch - Support webrender on Android

Review of attachment 8854358 [details] [diff] [review]:
-----------------------------------------------------------------

So I think we should split this into two. One patch just for the moz.configure change. That should get webrender building on Android. The rest of the changes are really runtime fixups for when webrender is enabled, and belong in another patch. And the moz.configure change should probably be reviewed by :froydnj or one of the other build peers.

::: gfx/layers/ipc/CompositorBridgeParent.cpp
@@ +711,5 @@
> +  if (!gfxVars::UseWebRender()) {
> +    if (mCompositor->Resume()) {
> +      resumed = true;
> +    }
> +  } else {

bool resumed = gfxVars::UseWebRender() ? mWrBridge->Resume() : mCompositor->Resume();

::: gfx/layers/wr/WebRenderBridgeParent.cpp
@@ +141,5 @@
>    MOZ_ASSERT(mApi);
>  
> +#ifdef MOZ_WIDGET_ANDROID
> +  // XXX temporal hack.
> +  // XXX Remove it when APZ is supproted.

s/temporal/temporary/
s/supproted/supported/

::: gfx/webrender_bindings/RendererOGL.cpp
@@ +139,5 @@
> +  }
> +  // RenewSurface internally calls MakeCurrent.
> +  return mGL->RenewSurface(mWidget);
> +#endif
> +  return true;

Change the #endif to an #else, and put an #endif at the end of the function body
Attachment #8854358 - Flags: review?(bugmail)
Attachment #8854688 - Flags: review?(nfroyd)
Attachment #8854689 - Flags: review?(bugmail)
Attachment #8854688 - Flags: review?(nfroyd) → review+
Attachment #8854689 - Flags: review?(bugmail) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/projects/graphics/rev/e6038d993d43
(Part 1) - Enable WebRender build on Android. r=froydnj
https://hg.mozilla.org/projects/graphics/rev/aa1f37911d77
(Part 2) - Add runtime fixups for WebRender on Android. r=kats
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/projects/graphics/rev/c5a346f39e07
Remove unused dependency in moz.configure rule. r=bustage
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: