NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.32k stars 14.29k forks source link

Hardware acceleration not working on chromium based browsers #249152

Open smufa opened 1 year ago

smufa commented 1 year ago

Describe the bug

Hardware acceleration doesn't seem to be working on chromium based browsers. I'm using an nvidia gtx 1060 and have tried multiple nvidia drivers but it doesn't help (tried stable, beta, vulkan, vulkan_beta, legacy_470). The browsers I tried are ungoogled-chromium, google-chrome and brave

Edit: Tested with seperate computer with intel iGPU and it doesn't have this problem.

Steps To Reproduce

Steps to reproduce the behavior:

  1. nix run nixpkgs#ungoogled-chromium

Expected behavior

chrome://gpu should look like this: image but looks like this: image

Additional context

The browsers print this to stdout:

[18044:18044:0814/180808.944506:ERROR:chrome_browser_cloud_management_controller.cc(162)] Cloud management controller initialization aborted as CBCM is not enabled.
warning: queue 0x27940034b8d0 destroyed while proxies still attached:
  wl_registry@2 still attached
[18086:18086:0814/180809.076535:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18086:18086:0814/180809.076680:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=SCANOUT
[18086:18086:0814/180809.076990:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18086:18086:0814/180809.077059:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=GPU_READ
[18086:18086:0814/180809.077105:ERROR:shared_image_factory.cc(725)] CreateSharedImage: could not create backing.
[18086:18086:0814/180809.077177:ERROR:shared_image_factory.cc(579)] DestroySharedImage: Could not find shared image mailbox
[18086:18086:0814/180809.077362:ERROR:gpu_service_impl.cc(1008)] Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
[18044:18044:0814/180809.084298:ERROR:gpu_process_host.cc(952)] GPU process exited unexpectedly: exit_code=8704
warning: queue 0x27940034b8d0 destroyed while proxies still attached:
  wl_registry@2 still attached
[18180:18180:0814/180809.156743:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18180:18180:0814/180809.156832:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=SCANOUT
[18180:18180:0814/180809.157000:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18180:18180:0814/180809.157058:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=GPU_READ
[18180:18180:0814/180809.157101:ERROR:shared_image_factory.cc(725)] CreateSharedImage: could not create backing.
[18180:18180:0814/180809.157152:ERROR:shared_image_factory.cc(579)] DestroySharedImage: Could not find shared image mailbox
[18180:18180:0814/180809.157250:ERROR:gpu_service_impl.cc(1008)] Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
[18044:18044:0814/180809.164044:ERROR:gpu_process_host.cc(952)] GPU process exited unexpectedly: exit_code=8704
[18150:1:0814/180809.170403:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
warning: queue 0x27940034b8d0 destroyed while proxies still attached:
  wl_registry@2 still attached
[18189:18189:0814/180809.235076:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18189:18189:0814/180809.235147:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=SCANOUT
[18189:18189:0814/180809.235288:ERROR:gbm_wrapper.cc(253)] Failed to export buffer to dma_buf: No such file or directory (2)
[18189:18189:0814/180809.235329:ERROR:gbm_pixmap_wayland.cc(75)] Cannot create bo with format= RGBA_8888 and usage=GPU_READ
[18189:18189:0814/180809.235358:ERROR:shared_image_factory.cc(725)] CreateSharedImage: could not create backing.
[18189:18189:0814/180809.235389:ERROR:shared_image_factory.cc(579)] DestroySharedImage: Could not find shared image mailbox
[18189:18189:0814/180809.235462:ERROR:gpu_service_impl.cc(1008)] Exiting GPU process because some drivers can't recover from errors. GPU process will restart shortly.
[18150:1:0814/180809.238016:ERROR:command_buffer_proxy_impl.cc(325)] GPU state invalid after WaitForGetOffsetInRange.
[18044:18044:0814/180809.239997:ERROR:gpu_process_host.cc(952)] GPU process exited unexpectedly: exit_code=8704
[18115:7:0814/180809.256945:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.4.7-zen1, NixOS, 23.11 (Tapir), 23.11.20230810.ce5e4a6`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.15.1`
 - channels(root): `"nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Might be connected to #244742, but none of the fixes seem to help so I'm not sure, also no graphical glitches.

CarlosMendonca commented 1 year ago

+1 Having a similar issue and similar error message. I'm on Gnome + Wayland with Ozone enabled per https://nixos.wiki/wiki/Chromium. Hardware is Intel + RTX 2080 Ti. Will attach stdout later.

woojiq commented 1 year ago

I have this problem too, but it behaves very strangely. Sometimes when I turn on my laptop, chrome has hardware acceleration, but sometimes it doesn't. So I have to restart a few times (randomly actually) to get it to work. It is very strange what this could be connected with. It works on firefox, btw. P.S. I have a repo with dotfiles in case it matters.

UPD: I found out that if I unload the nvidia-drm module (not all nvidia modules) it starts working correctly (although I have to kill wayland for that).

rtkt commented 1 year ago

+1 Same issue but different symptoms I'm using default Chromium, not the ungoogled one

Chromium    119.0.6045.123 (Official Build) (64-bit) 
Revision    b9e5b8a154549bb57a57b9c822607bc3289fc5b9-refs/branch-heads/6045@{#1231}
OS  Linux
JavaScript  V8 11.9.169.6
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Command Line    /nix/store/0cig8bhc3jyi4rjq3cj0wvczzaj5cjhq-chromium-unwrapped-119.0.6045.123/libexec/chromium/chromium --flag-switches-begin --ignore-gpu-blocklist --flag-switches-end --origin-trial-disabled-features=WebGPU
Executable Path /nix/store/0cig8bhc3jyi4rjq3cj0wvczzaj5cjhq-chromium-unwrapped-119.0.6045.123/libexec/chromium/chromium
Profile Path    /home/rtkt/.config/chromium/Default
Variations Seed Type    Null

Logs from Chromium Notice multiple ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory errors GPU report from Chromium

However, Vivaldi works just fine Usually I use it cmd flags like Vulkan and zero-copy but I disabled them temporarily

Vivaldi 6.2.3105.58 (Stable channel) stable (64-bit) 
Revision    160afb130e98d47754ca92d477dfe950a5c0b4c1
OS  Linux
JavaScript  V8 11.6.189.22
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Command Line    /nix/store/914v1aq237bdncyp5mnhri622017msah-vivaldi-6.2.3105.58/bin/.vivaldi-wrapped --flag-switches-begin --flag-switches-end --origin-trial-disabled-features=WebGPU --save-page-as-mhtml
Executable Path /nix/store/914v1aq237bdncyp5mnhri622017msah-vivaldi-6.2.3105.58/opt/vivaldi/vivaldi
Profile Path    /home/rtkt/.config/vivaldi/Default
Variations Seed Type    Null

GPU report from Vivaldi

GPU configuration:

{
  pkgs,
  lib,
  ...
}: {
  # hardware.video.hidpi.enable = lib.mkDefault true;
  boot.kernelParams = [
    "amdgpu.runpm=0"
  ];
  hardware.opengl = {
    enable = true;
    extraPackages = with pkgs; [
      libvdpau
      amdvlk
      vaapiVdpau
    ];
    extraPackages32 = with pkgs; [
      driversi686Linux.amdvlk
    ];
    driSupport = true;
    driSupport32Bit = true;
  };
  services.xserver.videoDrivers = ["amdgpu"];
}
➜  nixpkgs git:(nixos-unstable) nix-info -m    
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.1-zen1, NixOS, 23.11 (Tapir), 23.11.20231117.c757e9b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
➜  nixpkgs git:(nixos-unstable) inxi -v 3
System:    Host: desktop Kernel: 6.6.1-zen1 x86_64 bits: 64 compiler: gcc v: 12.3.0 Desktop: KDE Plasma 5.27.9 
           Distro: NixOS 23.11 (Tapir) 
Machine:   Type: Desktop Mobo: Gigabyte model: GA-780T-D3L v: x.x serial: <superuser required> BIOS: Award v: FG 
           date: 11/09/2012 
CPU:       Info: 6-Core model: AMD FX-6300 bits: 64 type: MCP arch: Bulldozer rev: 0 cache: L2: 2 MiB 
           flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 42282 
           Speed: 3500 MHz min/max: 1400/3500 MHz boost: enabled Core speeds (MHz): 1: 1846 2: 3500 3: 4068 4: 3500 5: 2130 
           6: 3500 
Graphics:  Message: No device data found. 
           Device-1: AONI ELECTRONIC Canyon CNS-CWC5 Webcam type: USB driver: snd-usb-audio,uvcvideo bus-ID: 5-3:2 
           Display: x11 server: X.Org 21.1.9 driver: loaded: N/A resolution: 3440x1440 
           OpenGL: renderer: AMD Radeon RX 580 Series (polaris10 LLVM 16.0.6 DRM 3.54 6.6.1-zen1) v: 4.6 Mesa 23.1.9 
           direct render: Yes 
Network:   Message: No device data found. 
           IF-ID-1: enp2s0 state: up speed: 100 Mbps duplex: full mac: 94:de:80:3d:cd:58 
Drives:    Local Storage: total: 6.13 TiB used: 3.75 TiB (61.2%) 
Info:      Processes: 388 Uptime: N/A Memory: 15.61 GiB used: 5.57 GiB (35.7%) Init: systemd Compilers: gcc: N/A 
           Packages: 2017 Shell: Zsh v: 5.9 inxi: 3.3.04 
jchv commented 1 year ago

@rtkt I suspect that's a very different bug that has only been in Nixpkgs mainline since October 20th. Please take a look at #269104 and see if it matches what you're seeing.

rtkt commented 1 year ago

@jchv, yes it is Thanks for your comment

dstathis commented 3 months ago

Also having this problem on Brave.

eivbsmed commented 2 months ago

Got the same problem for the Vivaldi browser. When i force it on Vulkan it looks to work for a little bit then fails back to software

danilevy1212 commented 1 month ago

Got the same problem for the Vivaldi browser. When i force it on Vulkan it looks to work for a little bit then fails back to software

Same here, with brave, on unstable, even if I get HWA working, it turns unbelievably sluggish after a while. In Wayland it doesn't, but I have to force it through XWayland or it will render without HWA from the beginning. Even then, the performance is not great, can become sluggish or unresponsive, but not as bad as when I run it through x11 natively.

For me, pinning brave to latest stable version (24.05) works to turn on HWA, both in X11 and Wayland, and performance does not degrade after a while. It's actually what I am doing while I see if this issue gets resolved.

Whatever is wrong, it is because of some change introduced in the unstable nixpkgs. Don't know if due to an upstream change or the way is being packaged has changed since then.

paveloom commented 2 weeks ago

I was able to make Vivaldi find the Vulkan driver for my AMD iGPU by using the following:

VK_LOADER_DEBUG=driver \
VK_ADD_DRIVER_FILES=/run/opengl-driver/share/vulkan/icd.d/radeon_icd.x86_64.json \
vivaldi --enable-features=VaapiVideoDecoder,VaapiIgnoreDriverChecks,Vulkan,DefaultANGLEVulkan,VulkanFromANGLE

Here's the status information from the vivaldi:gpu page:

Screenshot From 2024-11-09 12-06-37