gecko-embedded icon indicating copy to clipboard operation
gecko-embedded copied to clipboard

Gecko 102 に向けての調査、検討

Open dynamis opened this issue 3 years ago • 3 comments

Wayland 環境での改善について

Wayland での Fx93-96 での改善についてはこちらに詳しい: https://mastransky.wordpress.com/2021/10/01/firefox-wayland-development-in-2021/

image

I swear, no more crashes on Wayland!

Fx94 で Linux のグラフィックスバックエンドが GLX から EGL に変更: https://mozillagfx.wordpress.com/2021/10/30/switching-the-linux-graphics-stack-from-glx-to-egl/

これによるメリット:

  • Improved WebGL performance. Thanks to DMABUF zero-copy buffer sharing, WebGL can be done both sandboxed and without round-trip to system ram. WebGL is not only used in obvious places such as games, but also in more subtle ways, e.g. on Google Maps.
  • Reduced power consumption. With partial damage we don’t need to redraw the whole window any more if only a small part of the content changed. Common examples here are small animations on websites or when loading tabs.
  • Less bugs. EGL is more modern, much better suited for complex hardware accelerated desktop applications and used on more platforms, compared to GLX.
  • Hardware video decoding by default is another crucial step closer – in fact for most users it should now be only one preference away (but beware, it still has a couple of bugs).

Wayland の正式サポートについて

Fedora, Ubuntu 21.04 の Wayland サポート&彼らのビルドで Firefox も Wayland 使うようになる事を受けて、Firefox 98 から Wayland が動いてればそちらを使うようデフォルトを切り替えた: https://bugzilla.mozilla.org/show_bug.cgi?id=1749174

これで Mozilla としてようやく (Xorg) ではなく Wayland をメインとしてサポートしていくことになったと理解できそう。

Mozilla がビルドするリリース版 (Stable) ビルドで Wayland バックエンドサポートを有効化するのはまだだがこちらの bug が 1 月末に立てられてたので PIP 周りとか問題視されてる所が解決し次第、進みそう。

ちなみに Wayland を Nightly で (=試験的に) サポートし始めたのはこちらの 2019 年の bug から

Wayland Port 全体のメタバグも参考に。

Releasenotes

リリースノートと気になるポイント:

  • 92 https://www.mozilla.org/en-US/firefox/92.0/releasenotes/
    • Canonical is now building the official Firefox snap. It's also now available on two additional architectures, ARMhf and ARM64.
  • 93 https://www.mozilla.org/en-US/firefox/93.0/releasenotes/
    • Firefox now blocks downloads that rely on insecure connections, protecting against potentially malicious or unsafe downloads. Learn more and see where to find downloads in Firefox.
  • 94 https://www.mozilla.org/en-US/firefox/94.0/releasenotes/
  • 95 https://www.mozilla.org/en-US/firefox/95.0/releasenotes/
    • RLBox — a new technology that hardens Firefox against potential security vulnerabilities in third-party libraries — is now enabled on all platforms.
    • And we’ve improved page load performance by speculatively compiling JavaScript ahead of time.
  • 96 https://www.mozilla.org/en-US/firefox/96.0/releasenotes/
  • 97 https://www.mozilla.org/en-US/firefox/97.0/releasenotes/
    • Support for directly generating PostScript for printing on Linux has been removed. Printing to PostScript printers still remains a supported option, however.
  • 98 https://www.mozilla.org/en-US/firefox/98.0/releasenotes/
    • Form associated custom elements will become available on the release channel in version 98. This allows web authors to define and create custom elements that can be participated in form submission.
  • 99 https://www.mozilla.org/en-US/firefox/99.0/releasenotes/
    • The Linux sandbox was strengthened: processes exposed to web content no longer have access to the X Window system (X11).
  • 100 https://www.mozilla.org/en-US/firefox/100.0/releasenotes/
    • Improved fairness between painting and handling other events. This noticeably improves the performance of the volume slider on Twitch.
    • Soft-reloading a web page will no longer cause revalidation for all resources.
    • Geckoview APIs have been added to control the start/stop time of capturing a profile.
  • 101 https://www.mozilla.org/en-US/firefox/101.0/releasenotes/
  • 102 https://www.mozilla.org/en-US/firefox/102.0/releasenotes/

e10s について

e10s on Wayland とかどうなってるのかと思って確認し直した。

ユーザ向けのデスクトップビルドでは Fx68 の時点で e10s 無効化は prefs から出来なくなっており (環境変数 MOZ_FORCE_DISABLE_E10S=1 を必要としており) e10s 無効化はサポート外扱いになっている (カスタムビルドなどでは無効化できる): https://bugzilla.mozilla.org/show_bug.cgi?id=1548941

とはいえ Fx 68 時点で e10s on wayland が安定する形になっていたかというとそうではない

その後 e10s on wayland を正式サポートする/しないというアナウンス/bug は見当たらず扱いが不明確なところがあるが

  • e10s はリリース版/ユーザ向け版ではデフォルトオン、設定で無効化できなくされている
  • Fedora/Ubuntu の動きに合わせて Wayland を正式サポートとする

というのを踏まえると、Wayland では従来 e10s 有効無効にかかわらず Mozilla の正式サポート外であったが、e10s 有効の場合の Wayland だけ正式サポートになると言えるかも知れない。

dynamis avatar Mar 14 '22 05:03 dynamis

Fx94 で Linux のグラフィックスバックエンドが GLX から EGL に変更: https://mozillagfx.wordpress.com/2021/10/30/switching-the-linux-graphics-stack-from-glx-to-egl/

サポート環境は Nvidia などなのだが、RZ/G2 でも普通に gfx.x11-egl.force-enabled 設定を true にすることで有効化でき、ちょっと触った印象としては問題無さそうであったので、安定性検証を行ってどちらでリリースするかの検討が必要。

As of Firefox 94, users using Mesa driver >= 21 will get it by default. Users of the proprietary Nvidia driver will need to wait a little bit longer as the currently released drivers lack an important extension. However, most likely we’ll be able to enable EGL on the 470 series onwards. DMABUF support (and thus better WebGL performance) requires GBM support and will be limited to the 495 series onwards.

という説明を見る印象では GBMサポートができれば DMABUF ゼロコピーバッファシェアも使えるかもしれない点も要確認

Linux で EGL を有効化してパフォーマンスの違いを確認した結果の記事 https://linuxreviews.org/HOWTO_Make_Mozilla_Firefox_Blazing_Fast_On_Linux

dynamis avatar Sep 05 '22 21:09 dynamis

Firefox 95 にて Wasm (+WASI) を利用して外部ライブラリを (プロセス分離ではなく Wasm 化による) サンドボックスで実行する RLBox という機能が入っている。

https://hacks.mozilla.org/2021/12/webassembly-and-back-again-fine-grained-sandboxing-in-firefox-95/ https://github.com/PLSysSec/rlbox

RLBox Library Sandboxing 周りのビルドオプションはこの辺りで扱われており、WASI を必要としている。 https://searchfox.org/mozilla-esr102/source/toolkit/moz.configure#2360

Gecko 102 時点で対象としているライブラリは Graphite, Hunspell, Ogg, Expat, Woff2 https://searchfox.org/mozilla-esr102/source/toolkit/moz.configure#2364

こちらを有効化してビルドするには WASI に依存するため、WASI 周りのツールチェインも揃っていなければ有効化してビルドすることは出来ない。

ERROR: Cannot find a wasi sysroot. Please give its location with --with-wasi-sysroot. Or build with --without-wasm-sandboxed-libraries.

のような上記 moz.configure で定義されたビルドエラーに従って --without-wasm-sandboxed-libraries を付けてビルドすることで RLBox 無効化ビルドになるはず。解決できるのが望ましいが当面の制約事項となっても仕方ない想定。

dynamis avatar Sep 16 '22 01:09 dynamis

個別の設定・安定性の確認と検討については個別の issue で対応していくものとした:

  • RLBox については #105
  • WebRender については #106

dynamis avatar Sep 27 '22 12:09 dynamis