Laptop is super slow in KDE and Hyprland, but not in Gnome

Hello,

I’ve been using nix for a couple months on my laptop, and the things are good.
I’m using Gnome primarily, I want to try KDE and Hyprland.

The problem is KDE and Hyprland are super slow,
I used vkcube to view the FPS, As you can see here, the fps can’t even pass 30fps:

But Gnome is working correcly, if I disable vblank sync on Mangohud, it reaches 3000fps:

Is the problem linked to Nvidia, and Gnome handle the GPU correctly, KDE and Hyprland doesn’t ?
Or I’m missing an environment variable ?

Can you please help me identify the cause of this slowness ?

Here the list of environment variables:

AQ_DRM_DEVICES=/dev/dri/by-name/nvidia
CLUTTER_BACKEND=wayland
EGL_PLATFORM=wayland
__EGL_VENDOR_LIBRARY_FILENAMES=/run/opengl-driver/share/glvnd/egl_vendor.d/10_nvidia.json:/run/opengl-driver-32/share/glvnd/egl_vendor.d/10_nvidia.json
ELECTRON_OZONE_PLATFORM_HINT=wayland
GBM_BACKEND=nvidia-drm
GDK_BACKEND=wayland
__GL_ALLOW_FXAA_USAGE=0
__GL_ALLOW_UNOFFICIAL_PROTOCOL=0
__GL_ConformantBlitFramebufferScissor=1
__GL_FSSA_MODE=4
__GL_GSYNC_ALLOWED=1
__GL_IGNORE_GLSL_EXT_REQS=0
__GL_LOG_MAX_ANISO=4
__GL_MaxFramesAllowed=1
__GL_SHADER_DISK_CACHE=1
__GL_SHADER_DISK_CACHE_PATH=/var/tmp/nvidia
__GL_SHADER_DISK_CACHE_SIZE=10000000000
__GL_SHADER_DISK_CACHE_SKIP_CLEANUP=1
__GL_SHARPEN_ENABLE=0
__GL_SHARPEN_IGNORE_FILM_GRAIN=0
__GL_SHARPEN_VALUE=0
__GL_SHOW_GRAPHICS_OSD=0
__GL_SORT_FBCONFIGS=1
__GL_SYNC_DISPLAY_DEVICE=HDMI-1
__GL_SYNC_TO_VBLANK=1
__GL_THREADED_OPTIMIZATIONS=0
__GL_VRR_ALLOWED=1
__GL_WRITE_TEXT_SECTION=1
__GLX_VENDOR_LIBRARY_NAME=nvidia
__GL_YIELD=NOTHING
__HM_SESS_VARS_SOURCED=1
__HM_ZSH_SESS_VARS_SOURCED=1
KITTY_ENABLE_WAYLAND=1
KWIN_DRM_DEVICES=/dev/dri/by-name/nvidia
LIBVA_DRIVER_NAME=nvidia
MOZ_DRM_DEVICE=/dev/dri/by-name/nvidia
__NIXOS_SET_ENVIRONMENT_DONE=1
__NV_PRIME_RENDER_OFFLOAD=1
__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
PROTON_ENABLE_WAYLAND=1
QT_QPA_PLATFORM=wayland
QT_WAYLAND_DISABLE_WINDOWDECORATION=0
SDL_VIDEODRIVER=wayland
VDPAU_DRIVER=nvidia
VK_DRIVER_FILES=/run/opengl-driver/share/vulkan/icd.d/nvidia_icd.x86_64.json:/run/opengl-driver-32/share/vulkan/icd.d/nvidia_icd.i686.json
__VK_LAYER_NV_optimus=NVIDIA_only
VK_LOADER_DRIVERS_SELECT=nvidia*
WAYLAND_DISPLAY=wayland-0
WLR_DRM_DEVICES=/dev/dri/by-name/nvidia
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.6GKCA3
XDG_SESSION_TYPE=wayland

Thank you,
Taki

For KDE, you may want to take a look at this: Plasma/Wayland/Nvidia - KDE Community Wiki

For Hyprland, you may want to take a look at this: NVidia – Hyprland Wiki

Thank’s @jjramsey for the links,
It’s clear now, the problem is related to EGL, hyprland and KDE uses it, and always they select the iGPU, not nvidia card.

I followed every step force the use of nvidia card when using EGL, but no success, even I tried Zink, no change.
Gnome uses Vulkan by default that’s why it’s fast,

So for me I’ll use only Gnome until KDE or Hyprland implements Vulkan.

Here’s the output of eglinfo that shows that EGL is working on Nvidia.

❯ eglinfo -B
GBM platform:
eglinfo: eglInitialize failed

Wayland platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 570.153.02
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 570.153.02
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 570.153.02
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

X11 platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 570.153.02
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 570.153.02
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 570.153.02
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

Surfaceless platform:
EGL API version: 1.5
EGL vendor string: NVIDIA
EGL version string: 1.5
EGL client APIs: OpenGL_ES OpenGL
OpenGL core profile vendor: NVIDIA Corporation
OpenGL core profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL core profile version: 4.6.0 NVIDIA 570.153.02
OpenGL core profile shading language version: 4.60 NVIDIA
OpenGL compatibility profile vendor: NVIDIA Corporation
OpenGL compatibility profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL compatibility profile version: 4.6.0 NVIDIA 570.153.02
OpenGL compatibility profile shading language version: 4.60 NVIDIA
OpenGL ES profile vendor: NVIDIA Corporation
OpenGL ES profile renderer: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2
OpenGL ES profile version: OpenGL ES 3.2 NVIDIA 570.153.02
OpenGL ES profile shading language version: OpenGL ES GLSL ES 3.20

I had this issue a long time ago. You can work out what devices your integrated and dedicated GPUs are and force hyprland to use your preferred GPU. I pass this env and hyprland will then switch to that GPU, has to be set prior to entering a hyprland session.

I think the command is ls -la /dev/dri/ but it’s been a while.

On my phone so sorry for poor formatting.

I already defined AQ_DRM_DEVICES to use the nvidia card, and didn’t work.
But since you said it worked when you defined in the configuration file of hyprland, I said I’ll test it, and it actually worked :hushed:

I found out that environment.sessionVariables are more global than environment.variables, I changed all configurations to use environment.sessionVariables, and both Hyprland and KDE are using the nvidia gpu now.

So hyprland and KDE are fast now, but both they are having problems:

  • hyprland HDR colors are super bad.
  • In KDE, after a while, the performance drops to half and limted to 120 fps (I don’t know why)
  • Both of them, the laptop’s screen is black, only my external monitor is working.

So for me, Gnome is the best, HDR is working great, both screen working, performance super, stability is there (The only missing thing is a stable VRR).

For fractional scaling, I use this:

    programs = {
      dconf = {
        enable = true;
        profiles = {
          user.databases = [
            {
              lockAll = true;
              settings = {
                "org/gnome/desktop/interface" = {
                  text-scaling-factor = 1.25;
                };
            };
       };
   };

And it’s good for me.

While doing performance test in brave, I noticed that brave is not using the VAAPI, in youtube there’s a lot of drops.
I found that nvidia-vaapi-driver is not working correclty, it is selecting the intel GPU and not the nvidia one, this is the bug libva selecting wrong DRM device on wayland: isNvidiaDrmFd Invalid driver for DRM device: i915 · Issue #330 · elFarto/nvidia-vaapi-driver · GitHub
It was fixed in 0.0.14 (version 0.0.13 is in nixos 25.05)

So I add new overlay

self: super: {
  nvidia-vaapi-driver = super.nvidia-vaapi-driver.overrideAttrs (old: rec {
    version = "0.0.14";
    src = super.fetchFromGitHub {
      owner = "elFarto";
      repo = "nvidia-vaapi-driver";
      rev = "v${version}";
      sha256 = "sha256-Nf2Qh+POkcKXjiHlmpfSCbY+vgT63bWIaMxQHHYtE04=";
    };
  });
}

And new override for brave:

environment = {
    systemPackages = with pkgs; [
      (brave.override {
        libvaSupport = false;
        vulkanSupport = false;
        commandLineArgs = concatStringsSep " " [
          "--ozone-platform=x11"
          "--enable-gpu-compositing"
          "--enable-gpu-rasterization"
          "--enable-hardware-overlays"
          "--enable-native-gpu-memory-buffers"
          "--enable-oop-rasterization"
          "--enable-zero-copy"
          "--ignore-gpu-blocklist"
          "--enable-features=${concatStringsSep "," [
            "UseOzonePlatform"
            "AcceleratedVideoEncoder"
            "AcceleratedVideoDecoder"
            "VaapiVideoEncoder"
            "VaapiVideoDecoder"
            "VaapiIgnoreDriverChecks"
            "ParallelDownloading"
            "OverlayScrollbar"
            "FluentScrollbars"
            "FluentOverlayScrollbars"
          ]}"
          "--disable-features=${concatStringsSep "," [
            "OutdatedBuildDetector"
            "UseChromeOSDirectVideoDecoder"
          ]}"
        ];
      })
    ];
  };
};

And I’m having this in brave://gpu/:

Make sure that NIXOS_OZONE_WL = 1 is not defined or --ozone-platform=wayland is used, this will disable Hardware Acceleration.

And don’t enable Vulkan, it causes a heavy glitches when sharing the screen.

With this, 4K videos almost have 0 drops:

Thank’s everyone for helping me resolve this issue.
Have a nice day.

Glad you got it resolved!

I don’t have a Nvidia card, I have an Amd one, but I can get Hardware Acceleration with these flags on Wayland:

--disable-features=Vulkan,DefaultANGLEVulkan,VulkanFromANGLE,UseChromeOSDirectVideoDecoder,UseSkiaRenderer,GlobalShortcutsPortal,FontationsFontBackend \
--enable-features=WaylandWindowDecorations,UseOzonePlatform,FluentOverlayScrollbar,VaapiIgnoreDriverChecks,CanvasOopRasterization,VaapiVideoEncoder,VaapiVideoDecoder,VaapiVideoDecodeLinuxGL,VaapiVideoDecodeLinuxZeroCopyGL,AcceleratedVideoEncoder,AcceleratedVideoDecoder,AcceleratedVideoDecodeLinuxGL,AcceleratedVideoDecodeLinuxZeroCopyGL \
--enable-quic \
--enable-smooth-scrolling \
--ozone-platform-hint=wayland \
--ozone-platform=wayland \
--touch-events=disabled \
--use-angle=gl \
--use-gl=angle \

The trick here is to disable Vulkan and use --use-angle=gl and --use-gl=angle.

Maybe you can try it on a Nvidia, don’t know if it will still work.

I tried you suggestion, but it didn’t work, the moment I add --ozone-platform=wayland, it fallbacks to software mode:

From the logs, it’s nvidia problem (missing extension):

Thank you for your suggestion, for now I’ll keep using --ozone-platform=x11 until there’s a driver update (maybe it will be fixed).

1 Like