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

GPU Slow (Wayland/Hyprland) [M2 Macbook Air] #192

Open
Pickles888 opened this issue Apr 28, 2024 · 10 comments
Open

GPU Slow (Wayland/Hyprland) [M2 Macbook Air] #192

Pickles888 opened this issue Apr 28, 2024 · 10 comments

Comments

@Pickles888
Copy link

Pickles888 commented Apr 28, 2024

I have not tried going on X11 yet but on wayland my GPU seems to be very slow. I am currently using hyprland but I had the same issue on GNOME. I am not sure if it is a problem with it using the integrated GPU or with GPU acceleration not working. I know its not a hardware issue because previously on asahi with Arch Linux it ran very smoothly. (sorry if my terminology is incorrect)

EDIT: Something else that might be relevant is that my battery drains very fast. (could be caused by the use of integrated graphics?)

I have tried:

  • setting github:tpwrules/nixos-apple-silicon"; in my flake and updating
  • setting environment.sessionVariables.WLR_DRM_DEVICES = "/dev/dri/card0"; (made hyprland work)

output of of nix-shell -p glxinfo --run glxinfo | grep 'OpenGL renderer string':

OpenGL renderer string: Apple M2 (G14G B0)

my configuration.nix (I am using flakes, the firmware directory is not set because I set it in the module :P | EDIT: I put the module back to default and now use the normal way to put it in the flake):

{ config, lib, pkgs, inputs, ... }: {
  imports = [ ./hardware-configuration.nix ./apple-silicon-support ];

  grub.enable = false;
  bluetooth.enable = true;
  workman.enable = true;

  environment.sessionVariables.WLR_DRM_DEVICES = "/dev/dri/card0";

  hardware = {
    opengl = {
      enable = true;
      driSupport32Bit = lib.mkForce false;
      driSupport = true;
    };

    asahi = {
      useExperimentalGPUDriver = true;
      experimentalGPUInstallMode = "overlay";
      withRust = true;
    };
  };

  boot = {
    consoleLogLevel = 0;
    kernelParams = [ "apple_dcp.show_notch=1" ];
  };

  sound.enable = true;

  networking.wireless.iwd = {
    enable = true;
    settings.General.EnableNetworkConfiguration = true;
  };

  networking.hostName = "NixLaptop";
  nix.settings.experimental-features = [ "nix-command" "flakes" ];
  system.stateVersion = "23.11"; # Did you read the comment?
}

My hyprland config (home-manager):

{ config, lib, pkgs, inputs, ... }: {
  wayland.windowManager.hyprland = {
    enable = true;
    xwayland.enable = true;
    settings = {
      monitor = "DP-1,1920x1080@240,0x0,1"; # "${config.hyprland.display}";
      env = [
        "XCURSOR_SIZE,24"
        "XCURSOR_THEME,${config.home.pointerCursor.name}"
        "GTK_THEME,${config.gtk.theme.name}"
      ];

      exec-once = [
        "swaybg -i /etc/nixos/assets/evening-sky.png"
        "swaync"
        "hypridle"
        "lxqt-policykit-agent"
      ];

      input = {
        kb_layout = "us,us";
        kb_variant = "workman,,";
        follow_mouse = "1";
        accel_profile = "flat";
        sensitivity = "0.2";
        touchpad = {
          natural_scroll = true;
          scroll_factor = "0.7";
          clickfinger_behavior = true;
          tap-and-drag = true;
          tap-to-click = false;
        };
      };

      general = {
        gaps_in = "10";
        gaps_out = "10";
        border_size = "0";
        layout = "dwindle";
        allow_tearing = "false";
      };

      decoration = {
        rounding = "12";
        blur = {
          enabled = true;
          size = "4";
          passes = "5";
        };

        drop_shadow = "no";
        active_opacity = "0.9";
        inactive_opacity = "0.7";
      };

      animations = {
        enabled = "yes";
        bezier = [
          "linear, 0.5, 0.5, 0.5, 0.5"
          "antiEase, 0.6, 0.4, 0.6, 0.4"
          "ease, 0.4, 0.6, 0.4, 0.6"
          "smooth, 0.5, 0.9, 0.6, 0.95"
          "htooms, 0.95, 0.6, 0.9, 0.5"
          "powered, 0.5, 0.2, 0.6, 0.5"
        ];

        animation = [
          "windows, 1, 2.5, smooth"
          "windowsOut, 1, 1, htooms, popin 80%"
          "fade, 1, 5, smooth"
          "workspaces, 1, 6, default"
        ];
      };

      dwindle = {
        pseudotile = "yes";
        preserve_split = "yes";
      };

      misc = { force_default_wallpaper = "0"; };

      # Cut out binds because it was long and irrelevant #
    };
  };
}

My flake:

{
  description = "asynth's nixos configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixvim = {
      url = "github:nix-community/nixvim";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    apple-silicon-support.url = "github:tpwrules/nixos-apple-silicon";
  };

  outputs = { nixpkgs, nixvim, home-manager, ... }@inputs:
    let
      customLib =
        import ./customLib/default.nix { inherit inputs home-manager; };
    in with customLib; {
      nixosConfigurations = {
        NixPC = mkSystem "x86_64-linux" ./hosts/pc/configuration.nix
          ./hosts/pc/home.nix { inherit inputs nixvim customLib; };

        liveiso = mkSystem "x86_64-linux" ./hosts/liveiso/configuration.nix
          ./hosts/liveiso/home.nix { inherit inputs; };

        NixLaptop = mkSystem "aarch64-linux" ./hosts/laptop/configuration.nix
          ./hosts/liveiso/home.nix { inherit inputs nixvim customLib; };
      };

      home-managerModules.default = ./home-managerModules;
      modules.default = ./modules;
    };
}
@zvolin
Copy link

zvolin commented May 5, 2024

What do you mean by 'slow' and what's the measure?
This line looks a bit suspicious, is this correct resolution and refresh rate?

monitor = "DP-1,1920x1080@240,0x0,1";

@zvolin
Copy link

zvolin commented May 5, 2024

on M2 Pro I have this:

❯ hyprctl monitors
Monitor eDP-1 (ID 0):
	[email protected] at 0x0

@zvolin
Copy link

zvolin commented May 5, 2024

One idea is to check if you can find anything suspicios in drm debug log.
Another idea is dual booting and comparing glxinfo or drm logs 🤔

@3rd
Copy link

3rd commented May 5, 2024

Had the same issue when trying out Hyprland on an M2 Air, it's super fast on X11.
For me it was "slow" in basic things like window animations or scrolling inside a web browser.

@zvolin
Copy link

zvolin commented May 5, 2024

I see my device has the same gpu and I don't experience any slowness. Random idea, but maybe it's this notch?

kernelParams = [ "apple_dcp.show_notch=1" ];

@Pickles888
Copy link
Author

Pickles888 commented May 6, 2024

󰅷 hyprctl monitors     
Monitor eDP-1 (ID 0):
	[email protected] at 0x0

unsetting the notch thing did not work

I also unset the monitor and it did not help.

@Pickles888
Copy link
Author

I did drm debug logging:
gist because otherwise it was too long

@zvolin
Copy link

zvolin commented May 11, 2024

here's mine for comparison

@zvolin
Copy link

zvolin commented May 11, 2024

I think that amount of DRM_IOCTL_SYNCOBJ_WAIT in your logs may be related to the 'slowness' feeling, but I have no idea what could cause it, not even if they are unexpected

@foldfree
Copy link

foldfree commented Jul 9, 2024

using hyprland fine on m2 air with theses settings:

configuration.nix

  hardware.asahi = {
    withRust = true;
    useExperimentalGPUDriver = true;
    experimentalGPUInstallMode = "replace";
    setupAsahiSound = true;
  };

and hyprland.conf

monitor=,highres,auto,2
exec-once=xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2

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

4 participants