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

Failed to initialize window when libwayland is not symllinked properly #2335

Closed
dsseng opened this issue Dec 30, 2021 · 2 comments · Fixed by #2336
Closed

Failed to initialize window when libwayland is not symllinked properly #2335

dsseng opened this issue Dec 30, 2021 · 2 comments · Fixed by #2336

Comments

@dsseng
Copy link
Contributor

dsseng commented Dec 30, 2021

Description
GL backend does not work on Wayland.

Repro steps
0. wgpu repository

  1. WGPU_BACKEND=gl cargo run --example cube panics
  2. WAYLAND_DISPLAY= WGPU_BACKEND=gl cargo run --example cube works

Expected vs observed behavior
Expected: Both Wayland and X11 (Xwayland) work with both Vulkan and GLES
Got: Wayland only works with Vulkan, X11 is fine with both

Error: [2021-12-30T12:23:13Z ERROR wgpu_core::device] surface configuration failed: incompatible window kind

Extra materials
I'm going to investigate the issue on my own currently and submit a PR in case of successful fix.

Platform
GNOME Shell/Mutter 41.2 on Fedora 35
AMDGPU (Ryzen 4500U)
wgpu from master branch

@dsseng
Copy link
Contributor Author

dsseng commented Dec 30, 2021

Resolved by looking for Wayland libraries in /lib64.
Instead of /lib64/libwayland-client.so I found /lib64/libwayland-client.so.0
Same for libwayland-egl: /lib64/libwayland-egl.so.1
When I added those version numbers into wgpu-hal/src/gles/egl.rs I got window with image working on my system, so it's packaging issue (maybe to be reported to Fedora maintainers).

It looks like we either should embed libwayland, use its Rust alternative or search for versioned libs: https://github.com/Smithay/wayland-rs/blob/ddd92dcaf6736c1822f7698cf0d8446f03773d36/wayland-sys/src/client.rs#L89

Btw there should at least be some graceful handling for case where we get X11 WSI and Wayland window here

@dsseng
Copy link
Contributor Author

dsseng commented Dec 30, 2021

Internals of the issue:

  1. Winit uses wayland-rs (as shown before, it's either able to find shared libraries or has Rust equivalent built-in)
  2. Winit detects Wayland successfully and gives us a new Wayland window
  3. wgpu-hal fails to find libraries for Wayland and switches over to X11
  4. No way, we have X11 WSI and a Wayland window
    This could also be solved by falling back to creating different window so other bugs of such type (difference between Winit and wgpu-hal window types) won't lead to the same error

@dsseng dsseng changed the title Wayland + GL (ES) crash Failed to initialize window when libwayland is not symllinked properly Dec 30, 2021
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

Successfully merging a pull request may close this issue.

1 participant