hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.61k stars 902 forks source link

Firefox crashes #7202

Closed Tofixrs closed 3 months ago

Tofixrs commented 3 months ago

Regression?

Yes

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 0e86808e5912823f1c6bea1b6d5fcae297fc9f57 (). Date: 2024-08-05 Tag: , commits: 0e86808e5912823f1c6bea1b6d5fcae297fc9f57 flags: (if any) System Information: System name: Linux Node name: lapfix Release: 6.10.3 Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat Aug 3 07:01:09 UTC 2024 GPU information: 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] [10de:25a2] (rev a1) (prog-if 00 [VGA controller]) 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne [Radeon Vega Series / Radeon Vega Mobile Series] [1002:1638] (rev c6) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX Open Kernel Module for x86_64 560.28.03 Release Build (nixbld@) Mon Aug 5 16:29:55 UTC 2024 os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240804.cb9a96f" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 24.11 (Vicuna)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuna)" VERSION_CODENAME=vicuna VERSION_ID="24.11" plugins: ======Config-Start====== Config File: /home/tofix/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/j8l2v22xypah1srykhwjlkgwwgdxnnpw-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target $mainMod=SUPER animations { bezier=md3_standard, 0.2, 0, 0, 1 bezier=md3_decel, 0.05, 0.7, 0.1, 1 bezier=md3_accel, 0.3, 0, 0.8, 0.15 bezier=overshot, 0.05, 0.9, 0.1, 1.1 bezier=crazyshot, 0.1, 1.5, 0.76, 0.92 bezier=hyprnostretch, 0.05, 0.9, 0.1, 1.0 bezier=fluent_decel, 0.1, 1, 0, 1 bezier=easeInOutCirc, 0.85, 0, 0.15, 1 bezier=easeOutCirc, 0, 0.55, 0.45, 1 animation=windows, 1, 3, md3_decel, popin 60% animation=border, 1, 10, default animation=fade, 1, 2, default animation=workspaces, 1, 3.5, md3_decel, slide animation=specialWorkspace, 1, 3, md3_decel, slidefadevert 15% enabled=true } binds { bind=$mainMod, RETURN, exec, $TERMINAL bind=$mainMod, M, exit bind=$mainMod, C, killactive bind=$mainMod, R, exec, anyrun bind=$mainMod, F, togglefloating bind=$mainMod CONTROL, F, fullscreen, 0 bind=$mainMod, left, movefocus, l bind=$mainMod, right, movefocus, r bind=$mainMod, up, movefocus, u bind=$mainMod, down, movefocus, d bind=$mainMod SHIFT, left, movewindow, l bind=$mainMod SHIFT, right, movewindow, r bind=$mainMod SHIFT, up, movewindow, u bind=$mainMod SHIFT, down, movewindow, d bind=$mainMod, mouse_down, workspace, e+1 bind=$mainMod, mouse_up, workspace, e-1 bind=$mainMod, Print, exec, /nix/store/10325h9xnlcv1cz0z7k00gd1248m1ghf-grimblast-0.1/bin/grimblast --freeze save area - | swappy -f - -o ~/Pictures/screenshots/$(date +'%s_grim.png') bind=, Print, exec, /nix/store/10325h9xnlcv1cz0z7k00gd1248m1ghf-grimblast-0.1/bin/grimblast --freeze save output - | swappy -f - -o ~/Pictures/screenshots/$(date +'%s_grim.png') bind=SHIFT, Print, exec, /nix/store/10325h9xnlcv1cz0z7k00gd1248m1ghf-grimblast-0.1/bin/grimblast --freeze save screen - | swappy -f - -o ~/Pictures/screenshots/$(date +'%s_grim.png') bind=$mainMod, TAB, exec, ags --toggle-window dashboard bind=$mainMod, V, exec, ags --toggle-window clipboard bind=$mainMod, X, exec, ags --toggle-window powermenu bind=$mainMod, D, exec, ags --toggle-window desktop-top bind=, xf86audioplay, exec, playerctl play-pause bind=, xf86audionext, exec, playerctl next bind=, xf86audioprev, exec, playerctl previous bind=, xf86audiostop, exec, playerctl stop bind=, xf86audiomute, exec, wpctl set-mute @DEFAULT_SINK@ toggle bind=, xf86monbrightnessup, exec, brightnessctl set 50- bind=, xf86monbrightnessdown, exec, brightnessctl set 50+ bind=, code:179, exec, spotify bind=CTRL, xf86audionext, exec, playerctl position 5 bind=CTRL, xf86audioprev, exec, playerctl position 5 - bind=$mainMod, l, exec, /nix/store/cjl9c1i7syib13jk1iap8hfqcx5xq31x-hyprlock-0.4.1/bin/hyprlock bind=$mainMod CTRL, C, exec, hyprpicker -a -r -f hex bind=$mainMod, 1, workspace, 1 bind=$mainMod, 2, workspace, 2 bind=$mainMod, 3, workspace, 3 bind=$mainMod, 4, workspace, 4 bind=$mainMod, 5, workspace, 5 bind=$mainMod, 6, workspace, 6 bind=$mainMod, 7, workspace, 7 bind=$mainMod, 8, workspace, 8 bind=$mainMod, 9, workspace, 9 bind=$mainMod, 0, workspace, 10 bind=$mainMod SHIFT, 1, movetoworkspace, 1 bind=$mainMod SHIFT, 2, movetoworkspace, 2 bind=$mainMod SHIFT, 3, movetoworkspace, 3 bind=$mainMod SHIFT, 4, movetoworkspace, 4 bind=$mainMod SHIFT, 5, movetoworkspace, 5 bind=$mainMod SHIFT, 6, movetoworkspace, 6 bind=$mainMod SHIFT, 7, movetoworkspace, 7 bind=$mainMod SHIFT, 8, movetoworkspace, 8 bind=$mainMod SHIFT, 9, movetoworkspace, 9 bind=$mainMod SHIFT, 0, movetoworkspace, 10 bind=$mainMod CONTROL, 1, movetoworkspacesilent, 1 bind=$mainMod CONTROL, 2, movetoworkspacesilent, 2 bind=$mainMod CONTROL, 3, movetoworkspacesilent, 3 bind=$mainMod CONTROL, 4, movetoworkspacesilent, 4 bind=$mainMod CONTROL, 5, movetoworkspacesilent, 5 bind=$mainMod CONTROL, 6, movetoworkspacesilent, 6 bind=$mainMod CONTROL, 7, movetoworkspacesilent, 7 bind=$mainMod CONTROL, 8, movetoworkspacesilent, 8 bind=$mainMod CONTROL, 9, movetoworkspacesilent, 9 bind=$mainMod CONTROL, 0, movetoworkspacesilent, 10 binde=$mainMod CONTROL, up, resizeactive, 0 -20 binde=$mainMod CONTROL, down, resizeactive, 0 20 binde=$mainMod CONTROL, left, resizeactive, -20 0 binde=$mainMod CONTROL, right, resizeactive, 20 0 binde=, xf86audiolowervolume, exec, wpctl set-volume @DEFAULT_SINK@ 5%- binde=, xf86audioraisevolume, exec, wpctl set-volume @DEFAULT_SINK@ 5%+ bindm=$mainMod, mouse:272, movewindow bindm=$mainMod, mouse:273, resizewindow } debug { disable_logs=false } decoration { col.shadow=rgb(11111b) inactive_opacity=0.900000 rounding=5 } dwindle { preserve_split=true pseudotile=true } general { border_size=2 col.active_border=rgb(cba6f7) rgb(f38ba8) 45deg col.inactive_border=rgb(313244) gaps_in=2.500000 gaps_out=7 } gestures { workspace_swipe=true workspace_swipe_create_new=true workspace_swipe_forever=true } input { touchpad { natural_scroll=true } kb_layout=pl numlock_by_default=true } master { new_status=master } misc { disable_hyprland_logo=true vrr=1 } exec-once=ags exec-once=sleep 1 && swww init && swww img /home/tofix/wallpaper.png exec-once=keepassxc layerrule=blur,desktop-top monitor=eDP-1,1920x1080@144,0x0,1,vrr,1 windowrulev2=float, class:^(org.kde.polkit-kde-authentication-agent-1)$ windowrulev2=float, class:^(Steam)$ title:^(Friends List)$ windowrulev2=size 500 500, class:^(Steam)$ title:^(Friends List)$ windowrulev2=float, class:^(steam)$ title:^(Friends List)$ windowrulev2=size 500 500, class:^(steam)$ title:^(Friends List)$ windowrulev2=size 930 495, class:^(firefox)$ title:^(Picture-in-Picture)$ windowrulev2=float, class:^(firefox)$ title:^(Picture-in-Picture)$ windowrulev2=suppressevent, fullscreen, class:^(firefox)$ title:^(Picture-in-Picture)$ windowrulev2=suppressevent, fullscreen, class:^(libreoffice-startcenter)$ windowrulev2=float, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ windowrulev2=suppressevent, fullscreen, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ windowrulev2=suppressevent, maximazie, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ windowrulev2=move 0 0, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ windowrulev2=suppressevent, fullscreen, class:^(firefox)$, title:^(Firefox — Sharing Indicator)$ windowrulev2=noinitialfocus, class:^(steam)$, title:^(notificationtoasts) windowrulev2=float, class:^(com-atlauncher-App)$ title:^(ATLauncher Console)$ windowrulev2=float, class:^(org.keepassxc.KeePassXC)$ title: (Unlock) windowrulev2=tile,class:^dev.warp.Warp.*$ windowrulev2=float, class:^(org.keepassxc.KeePassXC)$ title: (Passkey credentials) ======Config-End======== ```

Description

Firefox randomly crashes Seems to happen after the commit 640d1618519d42dd592f7af5e9984ad52eb8b820

How to reproduce

Use firefox for a while the crashes are really random

Crash reports, logs, images, videos

Firefox spits out the error wp_linux_drm_syncobj_surface_v1: Missing timeline

vaxerski commented 3 months ago

update firefox and use egl-wayland-git from nvidia. This is both a ff bug and an nvidia one

Tofixrs commented 3 months ago

update firefox and use egl-wayland-git from nvidia. This is both a ff bug and an nvidia one

Im already using a beta of firefox and my nixos system doesnt have egl-wayland installed at all so uh what do i do

vaxerski commented 3 months ago

idk I dont use nvidia or nix. All I know is that it's fixed in nvidia's egl-wayland-git

Hobr commented 3 months ago

suffered the same problem:) have you fixed it?

matt1432 commented 3 months ago

I'm having the same problem. I wonder if an overlay of the package in question would fix it. Not sure what the package is on nix but you might @fufexan

Hobr commented 3 months ago

It looks like egl-wayland 1.1.14 was broken with NVIDIA 555 and later, after I downgrade the driver's version to nvidiaPackages.production(550.107.021), I haven't encounter this problem again. Just now egl-wayland 1.1.15 released, it says 'Significant stability fixes for explicit sync which prevents crashes with Firefox/moonlight/more.'.

matt1432 commented 3 months ago

Here is the nixpkgs PR that would fix this: https://github.com/NixOS/nixpkgs/pull/333586 https://nixpk.gs/pr-tracker.html?pr=333586

Jademalo commented 3 months ago

I did a quick egl-wayland overlay with the 560.31.02 drivers (rebuild took about half an hour), and with explicit sync enabled hyprland itself still freezes.

This post from nvidia seems to imply it should be fixed, but there's clearly something going on still.

matt1432 commented 3 months ago

Yeah after trying it, I am still having issues. I tried going back to 555 but firefox still crashes like crazy even with egl-wayland 1.15

Hobr commented 3 months ago

My firefox also crashes in 555, but 550 is running fine.

Jademalo commented 3 months ago

Over the last few hours I've had a load of crashes with explicit sync disabled, 560.31.02, and latest egl-wayland with firefox beta 130. I think there's probably something else up, but I don't exactly know what.

Tofixrs commented 2 months ago

After the pr updating egl-wayland to 1.1.15 landed in unstable it seems to not crash for me, seems to be fixed

Jademalo commented 2 months ago

I've only stopped getting a ton of crashes with nightly, although I still have had a couple.

romanstingler commented 2 months ago

I've only stopped getting a ton of crashes with nightly, although I still have had a couple. if it crashes install egl-wayland-git arch has reverted to 1.13 for now

Jademalo commented 2 months ago

I'm running Nix with a direct build of the tag with flakes and an overlay, so I'm running the latest egl-wayland

Most of the crashes aren't actually explicit sync related though, it just seems generally really unstable.

aliyss commented 2 months ago

@Jademalo Have more or less a similar config.

Here's what worked for me (Based on @Ramblurr 's config): https://github.com/Ramblurr/nixcfg/blob/edbbcb2de109b3a362e90bf00fbaf85a69b2768f/modules-unstable/hardware/nvidia.nix#L81

  environment.etc."egl/egl_external_platform.d".source = let
    nvidia_wayland = pkgs.writeText "10_nvidia_wayland.json" ''
      {
          "file_format_version" : "1.0.0",
          "ICD" : {
              "library_path" : "${
        (pkgs.egl-wayland.overrideAttrs (old: {
          version = "1.1.15";
          src = pkgs.fetchFromGitHub {
            owner = "Nvidia";
            repo = "egl-wayland";
            rev = "1.1.15";
            hash = "sha256-7spfmYwJ6U97x83219/kMwdJXS2vir+U0MUnYWJOLB4=";
          };
        }))
      }/lib/libnvidia-egl-wayland.so"
          }
      }
    '';
    nvidia_gbm = pkgs.writeText "15_nvidia_gbm.json" ''
      {
          "file_format_version" : "1.0.0",
          "ICD" : {
              "library_path" : "${config.hardware.nvidia.package}/lib/libnvidia-egl-gbm.so.1"
          }
      }
    '';
  in
    lib.mkForce (
      pkgs.runCommandLocal "nvidia-egl-hack" {} ''
        mkdir -p $out
        cp ${nvidia_wayland} $out/10_nvidia_wayland.json
        cp ${nvidia_gbm} $out/15_nvidia_gbm.json
      ''
    );

Tbh.... I have no clue what I'm doing. It works on my machine though.

Jademalo commented 2 months ago

@aliyss Wait - This is wild, why is the 560 driver being built with egl-wayland 1.13?

1.15 is on nixos-unstable now, I would've thought the driver would be built against it now.

I've just double checked mine and indeed it's building against 1.13, I'll give this a shot and see if it fixes it. From my understanding of what it does it absolutely should

EDIT: See below, nix is weird lol

Thanks for letting me know about this, much appreciated!

Jademalo commented 2 months ago

Need to look into this more still, but here's a patch that works for me with the current 560 beta on unstable;

environment.etc."egl/egl_external_platform.d".source = 
    let
      nvidia_wayland = pkgs.writeText "10_nvidia_wayland.json" ''
        {
            "file_format_version" : "1.0.0",
            "ICD" : {
                "library_path" : "${pkgs.egl-wayland}/lib/libnvidia-egl-wayland.so"
            }
        }
      '';
      nvidia_gbm = pkgs.writeText "15_nvidia_gbm.json" ''
        {
            "file_format_version" : "1.0.0",
            "ICD" : {
                "library_path" : "${config.hardware.nvidia.package}/lib/libnvidia-egl-gbm.so.1"
            }
        }
      '';
      nvidia_xcb = pkgs.writeText "20_nvidia_xcb.json" ''
        {
          "file_format_version": "1.0.0",
          "ICD": {
            "library_path": "${config.hardware.nvidia.package}/lib/libnvidia-egl-xcb.so.1"
          }
        }
      '';
      nvidia_xlib = pkgs.writeText "20_nvidia_xlib.json" ''
        {
          "file_format_version": "1.0.0",
          "ICD": {
            "library_path": "${config.hardware.nvidia.package}/lib/libnvidia-egl-xlib.so.1"
          }
        }
      '';
    in
      lib.mkForce (
        pkgs.runCommandLocal "nvidia-egl-hack" {} ''
          mkdir -p $out
          cp ${nvidia_wayland} $out/10_nvidia_wayland.json
          cp ${nvidia_gbm} $out/15_nvidia_gbm.json
          cp ${nvidia_xcb} $out/20_nvidia_xcb.json
          cp ${nvidia_xlib} $out/20_nvidia_xlib.json
        ''
      );

This seems to brute force override the entire folder, so you've got to reconstruct everything inside of it lol. Gonna see if I can write an overlay for the driver package itself so we're not having to reconstruct this folder but it looks to be ridiculously overcomplicated.

If only you could link something nested in a ton of links, lol.

Ramblurr commented 2 months ago

FYI that part of my confif hasn't been updated in awhile.

Jademalo commented 2 months ago

In the two hours since I added that, Firefox hasn't crashed once. I think this is the solution!

It's annoyingly inelegant, but until NVIDIA update the version of egl-wayland they distribute with their driver it's the best option. I had a look at overriding the nvidia driver derivation itself but I can't see an easy way to do it since it uses a separate builder script. Everything else is more complicated than this method.

I was genuinely so close to going back to Windows for a while, lol. ty @aliyss and @Ramblurr !

aliyss commented 2 months ago

Thank you!

I was genuinely so close to going back to Windows for a while, lol.

Worst case you could have just launched hyperland.conf with MOZ_WAYLAND_ENABLE=0 firefox. There's never a reason to switch to Windows. 🙈

matt1432 commented 2 months ago

I managed to make this workaround without any IFD and by taking up a bit less lines

    environment.etc = let
      mkEglFile = n: library: let
        suffix = lib.optionalString (library != "wayland") ".1";
        pkg =
          if library != "wayland"
          then config.hardware.nvidia.package
          else pkgs.egl-wayland;

        fileName = "${toString n}_nvidia_${library}.json";
        library_path = "${pkg}/lib/libnvidia-egl-${library}.so${suffix}";
      in {
        "egl/egl_external_platform.d/${fileName}".source = pkgs.writeText fileName (builtins.toJSON {
          file_format_version = "1.0.0";
          ICD = {inherit library_path;};
        });
      };
    in
      {"egl/egl_external_platform.d".enable = false;}
      // mkEglFile 10 "wayland"
      // mkEglFile 15 "gbm"
      // mkEglFile 20 "xcb"
      // mkEglFile 20 "xlib";
Jademalo commented 2 months ago

Oh nice @matt1432, this is much more elegant. Way more advanced than I dare to touch with nix, lol.

I've been poking around with trying to add an overlay to the package, and while I've not been successful in the traditional sense, I have actually figured out something a bit less hack-y.

      hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
      version = "560.31.02";
      sha256_64bit = "sha256-0cwgejoFsefl2M6jdWZC+CKc58CqOXDjSi4saVPNKY0=";
      sha256_aarch64 = "sha256-m7da+/Uc2+BOYj6mGON75h03hKlIWItHORc5+UvXBQc=";
      openSha256 = "sha256-X5UzbIkILvo0QZlsTl9PisosgPj/XRmuuMH+cDohdZQ=";
      settingsSha256 = "sha256-A3SzGAW4vR2uxT1Cv+Pn+Sbm9lLF5a/DGzlnPhxVvmE=";
      persistencedSha256 = "sha256-BDtdpH5f9/PutG3Pv9G4ekqHafPm3xgDYdTcQumyMtg=";
      preInstall = ''
        rm -f ./libnvidia-egl-wayland.so*
        cp ${pkgs.egl-wayland}/lib/libnvidia-egl-wayland.so.1.* .
        chmod 777 ./libnvidia-egl-wayland.so.1.*
      '';
    };

Annoyingly you can't just tack preInstall on to the end of config.boot.kernelPackages.nvidiaPackages.beta, so you've got to redefine the version and the hashes from here - https://github.com/NixOS/nixpkgs/blob/c3aa7b8938b17aebd2deecf7be0636000d62a2b9/pkgs/os-specific/linux/nvidia-x11/default.nix#L53

This literally replaces the library in the downloaded nvidia driver before install. No faffing around with changing the egl json files and recreating them, just actually updating the library in the driver. The downside to this is when the next driver update comes out you'll have to manually get the new hashes, but fingers crossed that driver update will actually have egl-wayland 1.1.15 in it.