gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.79k stars 938 forks source link

error 7: failed to import supplied dmabufs: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a #3747

Open flukejones opened 1 year ago

flukejones commented 1 year ago

Unable to run wgpu examples on an Nvidia hybrid laptop in wayland session due to error 7: failed to import supplied dmabufs: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a (error is cut off in log). It looks like everything initializes fine otherwise.

Reproduce

Own an Nvidia hybrid laptop running Linux, Wayland session (I do not have X11 installed).

RUST_LOG=debug RUST_BACKTRACE=full __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia cargo run --example boids

Platform OS: Fedora Linux 38 (Workstation Edition) x86_64 Kernel: 6.4.0-0.rc0.20230426git0cfd8703e7da.4.fc38.x86_64 Shell: bash 5.2.15 Resolution: 5120x2160 DE: GNOME 44.0 WM: Mutter CPU: 12th Gen Intel i9-12900H (20) @ 4.900GHz GPU: NVIDIA Geforce RTX 3070 Ti Laptop GPU GPU: Intel Alder Lake-P

wgpu-log-1.txt

RUST_LOG=debug RUST_BACKTRACE=full __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia cargo run --example boids

The above is the same with WGPU_BACKEND=vulkan

wgpu-log-2(gl).txt

RUST_LOG=debug RUST_BACKTRACE=full __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia WGPU_ADAPTER_NAME=3070 WGPU_BACKEND=gl cargo run --example boids

I seem to be completely unable to run wgpu examples on the Nvidia GPU. Running on Intel GPU is fine.

teoxoy commented 1 year ago

You might be hitting this issue: https://github.com/NVIDIA/egl-wayland/issues/41#issuecomment-952843907

Can you try to run vkcube-wayland?

Based on the resolution (5120x2160), that would indicate a 21:9 aspect which would most likely be a monitor.

Are you trying to run the examples on the monitor or the laptop screen? If on the monitor, do you know if the port is directly connected to the dGPU? (If it is, you don't need PRIME at all)

flukejones commented 1 year ago

huh, okay then:

❯ vkcube-wayland 
Selected GPU 1: NVIDIA GeForce RTX 3070 Ti Laptop GPU, type: DiscreteGpu
warning: queue 0x55dd716121e0 destroyed while proxies still attached:
  wl_registry@9 still attached
Segmentation fault (core dumped)

❯ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia vkcube-wayland
Selected GPU 0: NVIDIA GeForce RTX 3070 Ti Laptop GPU, type: DiscreteGpu
warning: queue 0x560900435ee0 destroyed while proxies still attached:
  wl_registry@9 still attached
[destroyed object]: error 7: failed to import supplied dmabufs: Arguments are inconsistent (for example, a valid context requires buffers not supplied by a

Will test with an output on dgpu momentarily (errors are same for laptop screen, I guess because that is also on iGPU).

flukejones commented 1 year ago

The same issues occur on dGPU connected display

flukejones commented 1 year ago

It appears to be a known issue and being worked on (followed through a few links) - https://github.com/NVIDIA/egl-wayland/issues/72

flukejones commented 1 year ago

Per reply at https://github.com/NVIDIA/egl-wayland/issues/72#issuecomment-1583576889

This feature has been implemented by @dkorkmazturk. It will be available in the next major driver version, 545 (not the recently released 535 beta).