Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cosmic freezes when one opens Firefox #335

Open
garare992 opened this issue Sep 15, 2024 · 16 comments
Open

Cosmic freezes when one opens Firefox #335

garare992 opened this issue Sep 15, 2024 · 16 comments

Comments

@garare992
Copy link

No description provided.

@garare992 garare992 changed the title Cosmic freezes when Cosmic freezes when one opens Firefox Sep 15, 2024
@michaelBelsanti
Copy link
Contributor

I'm having this issue on my AMD Framework Laptop, but not on my desktop that also uses AMD graphics.

@lilyinstarlight
Copy link
Owner

Can someone share the journalctl log from a boot where cosmic froze?

@garare992
Copy link
Author

I'm also using an AMD Laptop.
image

@garare992
Copy link
Author

@lilyinstarlight how exactly am i supposed to use journalctl?

@garare992
Copy link
Author

➜ ~ journalctl -b --priority=3
Sep 26 13:47:11 nixos .cosmic-comp-wrapped[1589]: Failed to read config 'workspaces'
Sep 26 13:47:11 nixos .cosmic-comp-wrapped[1589]: failed to read local shortcuts config 'system_actions': NoConfigDirectory
Sep 26 13:47:11 nixos .cosmic-comp-wrapped[1589]: shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
Sep 26 13:47:11 nixos .cosmic-comp-wrapped[1589]: tiling exceptions defaults config error: NoConfigDirectory
Sep 26 13:47:11 nixos .cosmic-comp-wrapped[1589]: tiling exceptions custom config error: NoConfigDirectory
Sep 26 13:47:18 nixos greetd[1670]: gkr-pam: unable to locate daemon control file
Sep 26 13:47:19 nixos .cosmic-comp-wrapped[1913]: Failed to read config 'workspaces'
Sep 26 13:47:19 nixos .cosmic-comp-wrapped[1913]: failed to read local shortcuts config 'system_actions': NoConfigDirectory
Sep 26 13:47:19 nixos .cosmic-comp-wrapped[1913]: shortcuts custom config error: GetKey("custom", Os { code: 2, kind: NotFound, message: "No such file or directory" })
Sep 26 13:47:19 nixos .cosmic-comp-wrapped[1913]: tiling exceptions defaults config error: NoConfigDirectory
Sep 26 13:47:19 nixos .cosmic-comp-wrapped[1913]: tiling exceptions custom config error: NoConfigDirectory
Sep 26 13:47:19 nixos .cosmic-panel-wrapped[1986]: Exited with error code 0
Sep 26 13:47:20 nixos .cosmic-panel-wrapped[1986]: com.system76.CosmicAppletStatusArea: Acquired bus name: org.kde.StatusNotifierWatcher
Sep 26 13:47:20 nixos .cosmic-panel-wrapped[1986]: com.system76.CosmicAppList: Error getting config: com.system76.CosmicAppList [GetKey("enable_drag_source", Os { code: 2, kind: NotFound, message: "No such file or directory">
Sep 26 13:47:27 nixos systemd[1878]: Failed to start Application launched by COSMIC.
Sep 26 13:48:49 nixos systemd[1878]: Failed to start Emacs: the extensible, self-documenting text editor.
Sep 26 13:50:19 nixos systemd[1878]: Failed to start Emacs: the extensible, self-documenting text editor.
Sep 26 13:51:50 nixos systemd[1878]: Failed to start Emacs: the extensible, self-documenting text editor.
Sep 26 13:53:20 nixos systemd[1878]: Failed to start Emacs: the extensible, self-documenting text editor.
Sep 26 13:53:50 nixos systemd[1878]: Failed to start Application launched by COSMIC.
Sep 26 13:54:06 nixos .cosmic-comp-wrapped[1913]: [GL] GL_INVALID_VALUE in glTexSubImage2D(xoffset 0 + width 652 > 624)
Sep 26 13:54:20 nixos .cosmic-panel-wrapped[1986]: com.system76.CosmicAppletStatusArea: Error getting layout from icon: org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/”
Sep 26 13:54:51 nixos systemd[1878]: Failed to start Emacs: the extensible, self-documenting text editor.

@garare992
Copy link
Author

More info that I found after some tinkering just now:

  • Firefox only freezes/lags the cursor when it's maximized. I'm currently using Firefox in a non-maximized window with no issues. Yay!

  • Right clicking anywhere on a maximized Firefox window unfreezes the mouse or makes it way less laggy, which allows you to quit the application or to make the window smaller, allowing you to use it.

@michaelBelsanti
Copy link
Contributor

good info! I can also confirm that it seems to occur with most Firefox forks.

Here's my journalctl output as well: https://gist.github.com/michaelBelsanti/379566d70ac73d6b048c5d7d3fea5b9a
I've already taken a look through and didn't really find any useful information.

@michaelBelsanti
Copy link
Contributor

this patch has fixed it for me pop-os/cosmic-comp#887 (comment)

@garare992
Copy link
Author

this patch has fixed it for me pop-os/cosmic-comp#887 (comment)

How do I apply that patch?

@lilyinstarlight
Copy link
Owner

lilyinstarlight commented Oct 4, 2024

How do I apply that patch?

Something like this in your nixos config:

EDIT: See below, do not use this patch any longer

nixpkgs.overlays = [
  (final: prev: {
    cosmic-comp = prev.cosmic-comp.overrideAttrs (prevAttrs: {
      patches = (prevAttrs.patches or []) ++ [
        (pkgs.writeText "cosmic-comp-disable-direct-scanout.patch" ''
          diff --git a/src/backend/kms/surface/mod.rs b/src/backend/kms/surface/mod.rs
          index d0cfb8d..32aaf4a 100644
          --- a/src/backend/kms/surface/mod.rs
          +++ b/src/backend/kms/surface/mod.rs
          @@ -624,7 +624,8 @@ impl SurfaceThreadState {
                       cursor_size,
                       Some(gbm),
                   ) {
          -            Ok(compositor) => {
          +            Ok(mut compositor) => {
          +                compositor.use_direct_scanout(false);
                           self.active.store(true, Ordering::SeqCst);
                           self.compositor = Some(compositor);
                           Ok(())
        '')
      ];
    });
  })
];

(Though to be clear, this patch doesn't "fix" anything. It just avoids a broken amdgpu driver codepath)

@RingOfStorms
Copy link

RingOfStorms commented Oct 10, 2024

I am not sure if this deserves a different issue or not. But for me I just get really bad performance when firefox is open, many small freezes. Nothing up to 30 seconds but up to about 10 seconds max at a time where I can't use the system at all.

cosmic-comp goes to the top of my cpu usage whenever trying to do anything in firefox. But in something like chrome everything is fine.

Just mousing the cursor over the firefox window (not maximized, or maximized, doesn't matter) causes the spikes and unresponsiveness.

I added the overlay above but that did not change anything for me:
https://git.joshuabell.xyz/dotfiles/~files/25e19e92567015bcf5724b4857c474f2ca89df34/hosts/gpdPocket3/configuration.nix?position=source-30.1-53.5-1

Note that this system is Intel CPU and intel iris xe graphics

@ams-123
Copy link

ams-123 commented Oct 10, 2024

My side, after patching as per the suggestion above, the firefox lock-ups went away. That said, after the latest cosmic updates and 6.11.2 (NixOS unstable), I was able to remove the overlay and the issue seems to have gone away.

@RingOfStorms I think the overlay shared is only going to apply to AMD GPU's (amdgpu).

@lilyinstarlight
Copy link
Owner

@RingOfStorms Yeah that sounds unrelated. Your issue is more likely related to pop-os/cosmic-comp#749/pop-os/cosmic-comp#703 if you are using client-side decorations in firefox

@RingOfStorms
Copy link

Thanks, it actually ended up being this one: I had no wallpaper/bg set...
pop-os/cosmic-comp#638

It now works fine, wild that background can affect anything else like that

@lilyinstarlight
Copy link
Owner

lilyinstarlight commented Oct 10, 2024

Oh yeah that sounds like a bug in cosmic-comp... I was gonna fix default wallpapers very soon, it just needs some XDG_DATA_DIRS plumbing upstream. But lacking a wallpaper shouldn't be doing that regardless

@lilyinstarlight
Copy link
Owner

For those using the above patch, please now use environment.sessionVariables.COSMIC_DISABLE_DIRECT_SCANOUT = "1" instead after updating this flake (ref: pop-os/cosmic-comp#925)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants