Cc'ing MAINTAINER

On Wed, Nov 10, 2021 at 03:32:21PM +0100, Patrick Wildt wrote:
> on my ARM64 workstation firefox has recently begun crashing all the
> time.  Turns out it's because QCMS (whatever that is), uses some HW
> acceleration (SIMD using NEON/VFP) on ARM64, and the LLVM-backed Rust-
> compiler seems to not produce a pseudo-op that instead of emitting
> a proper ASM instruction creates a call to it:
> 
>          U llvm.fptosi.sat.v4i32.v4f32

This is the same symbol I see when firefox tabs crash, e.g. due to
scrolling.  No idea if it a specific element on the page or the amount
of stuff firefox loads into memory, but I can reproduce this reliably
with `firefox https://wiki.pine64.org/wiki/Pinebook_Pro' and scrolling
down.  The tab crashes and firefox prints this on the console:

        firefox:/usr/local/lib/firefox/libxul.so.107.0: undefined symbol 
'llvm.fptosi.sat.v4i32.v4f32'
        ld.so: firefox: lazy binding failed!

> This change is a workaround which simply makes QCMS not use NEON on
> AArch64.  In the end the right fix would be in Rust/LLVM to create
> proper ASM, but I don't know where to look.  Maybe a future update
> of Rust/LLVM will fix it automatically.
> 
> This patch will continue to compile the NEON extensions, so nm(1)
> will still show the reference, but the extensions won't be used.
> 
> Not sure this is worth committing.  For now I'll use this locally.

Using firefox-94.0 on a recent snapshot.
This problem did not exist with firefox-93.0 (I think) on a snapshot
around a month ago, i.e. I was browsing the very same wiki all the time.

I can't build and test this on arm64 at the moment, sorry.
But if that makes Firefox usable on arm64 again, I'd be super happy.

> diff --git a/www/mozilla-firefox/Makefile b/www/mozilla-firefox/Makefile
> index 3de60915c21..1448b6f78ff 100644
> --- a/www/mozilla-firefox/Makefile
> +++ b/www/mozilla-firefox/Makefile
> @@ -6,6 +6,7 @@ ONLY_FOR_ARCHS =      amd64 aarch64
>  # Don't forget to bump www/firefox-i18n after updates.
>  
>  MOZILLA_VERSION =    94.0
> +REVISION =           0
>  MOZILLA_BRANCH =     release
>  MOZILLA_PROJECT =    firefox
>  MOZILLA_CODENAME =   browser
> diff --git a/www/mozilla-firefox/patches/patch-gfx_qcms_src_transform_rs 
> b/www/mozilla-firefox/patches/patch-gfx_qcms_src_transform_rs
> new file mode 100644
> index 00000000000..1764109fba6
> --- /dev/null
> +++ b/www/mozilla-firefox/patches/patch-gfx_qcms_src_transform_rs
> @@ -0,0 +1,26 @@
> +$OpenBSD$

Nit:  imho, it's nice to see patches with comments as they appear in
`make patch' output and one doesn't have to look at CVS logs hoping to
find details as to what was patched and why.

> +
> +Index: gfx/qcms/src/transform.rs
> +--- gfx/qcms/src/transform.rs.orig
> ++++ gfx/qcms/src/transform.rs
> +@@ -21,7 +21,7 @@
> + // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + 
> + #![allow(clippy::missing_safety_doc)]
> +-#[cfg(all(any(target_arch = "arm", target_arch = "aarch64"), feature = 
> "neon"))]
> ++#[cfg(all(any(target_arch = "arm"), feature = "neon"))]
> + use crate::transform_neon::{
> +     qcms_transform_data_bgra_out_lut_neon, 
> qcms_transform_data_rgb_out_lut_neon,
> +     qcms_transform_data_rgba_out_lut_neon,
> +@@ -1367,10 +1367,8 @@ pub fn transform_create(
> + 
> +             #[cfg(all(target_arch = "arm", feature = "neon"))]
> +             let neon_supported = is_arm_feature_detected!("neon");
> +-            #[cfg(all(target_arch = "aarch64", feature = "neon"))]
> +-            let neon_supported = is_aarch64_feature_detected!("neon");
> + 
> +-            #[cfg(all(any(target_arch = "arm", target_arch = "aarch64"), 
> feature = "neon"))]
> ++            #[cfg(all(any(target_arch = "arm"), feature = "neon"))]
> +             if neon_supported {
> +                 if in_type == RGB8 {
> +                     transform.transform_fn = 
> Some(qcms_transform_data_rgb_out_lut_neon)
> 

Reply via email to