Glxgears with 40 FPS on AMD laptop

Hello.

I recently set up NixOs on my new Thinkpad L14 and it feels sluggish.

CPU is a Ryzen Pro 7 5875U (8C/16T) with an AMD Radeon integrated. This is a new laptop, performance shouldn’t be an issue for everyday tasks.

But I get ~40 FPS on glxgears. I also see/feel some lags in other apps, like high latency between typing and seeing the letters in chromium; slow mouse movement in OrcaSlicer; and some other places. Firefox runs great though.

I run glxgears with nvtop open and I see up to 1% GPU usage by it. Somehow the performance is poor but the hardware is available to do more?

I don’t even know where to start troubleshooting.

The full config for my systems is in my dotfiles GitHub repo. And the part related to my laptop’s hardware is this:

  boot.initrd.kernelModules = [ "amdgpu" ];
  boot.kernelParams = [
    "acpi_backlight=native"

    "amd_pstate=guided"

    # Load amdgpu at stage 1
    "amdgpu"

    "iommu=soft"
  ];

  # AMD GPU
  hardware.opengl.extraPackages = with pkgs; [
    vaapiVdpau

    # AMD ROCm OpenCL runtime
    rocmPackages.clr
    rocmPackages.clr.icd

    amdvlk
  ];
  hardware.opengl.extraPackages32 = with pkgs; [
    driversi686Linux.amdvlk
  ];

  environment.variables = {
    # VAAPI and VDPAU config for accelerated video.
    # See https://wiki.archlinux.org/index.php/Hardware_video_acceleration
    "VDPAU_DRIVER" = "radeonsi";
    "LIBVA_DRIVER_NAME" = "radeonsi";
  };
  # Most software has the HIP libraries hard-coded. Workaround:
  systemd.tmpfiles.rules = [
    "L+    /opt/rocm/hip   -    -    -     -    ${pkgs.rocmPackages.clr}"
  ];

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

How can I get decent performance out of this laptop with NixOs? I’m lost here :confused: What am I missing?