egl-wayland: Incompatibility with rust wayland-client crate
When trying to run wezterm under Wayland, EGL initialization fails with BAD_NATIVE_WINDOW.
Getting this under a debugger, it looks like this runtime check is the critical piece:
#1 wlEglIsWaylandWindowValid (window=window@entry=0x55555a44f740) at ../src/wayland-eglsurface.c:74
74 return WL_CHECK_INTERFACE_TYPE(surface, wl_surface_interface);
Poking around at the surface that was passed in:
>>> p surface
$5 = (struct wl_surface *) 0x555559938800
>>> p *(void**)surface
$8 = (void *) 0x555559904ea8 <wayland_client::protocol::wl_surface::wl_surface_interface>
>>> p *(struct wl_interface*)0x555559904ea8
$12 = {
name = 0x555558d3994c "wl_surface",
version = 4,
method_count = 10,
methods = 0x555559904d78 <wayland_client::protocol::wl_surface::wl_surface_requests>,
event_count = 2,
events = 0x555559904e78 <wayland_client::protocol::wl_surface::wl_surface_events>
}
And comparing with the wl_surface
type that is checked against by this part of the macro:
>>> p &wl_surface_interface
$13 = (const struct wl_interface *) 0x7ffff7d4aa00 <wl_surface_interface>
>>> p wl_surface_interface
$14 = {
name = 0x7ffff7d46a88 "wl_surface",
version = 4,
method_count = 10,
methods = 0x7ffff7d4a540 <wl_surface_requests>,
event_count = 2,
events = 0x7ffff7d4a500 <wl_surface_events>
}
The interface appears to be compatible if the check were to perform a comparison of what’s inside the wl_interface
, even though the addresses are not identical.
Why aren’t the addresses identical?
The rust client implementation employs code generation to produce most of its code; here’s an example of the definition of that particular interface:
The rust client does, however, call out to the system libraries so that it should be comptible with EGL libraries. This same code runs fine when run against the nouveau driver.
So! Should NVIDIA/egl-wayland project be performing a deeper wl_interface comparison here to unblock this usage?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17
Thanks! I add the symlink then the wgpu examples start running! But if the mouse hovers on them, the window runs very slowly and not responding sometimes. It seems not the driver’s fault. Maybe rust’s GUI library needs some improvements. Alacritty and some other rust GUI apps also experience input latency AFAIK. Anyway it worked! Thanks for your help!
Should be fixed by https://github.com/NVIDIA/egl-wayland/commit/2eb4628d64a8297fb4c08aa796fdf33ff54a670f Again, sorry sorry sorry this took so damned long. Note that there are a few more changes to this library coming in the next few days, so I’m going to wait to those to land, but will bump the release as soon as they do.
I believe the first release to include this will be the 495 series beta release, due some time next week if all goes to plan.
@cubanismo Hi! I have the 495.29.05 beta driver installed. When running wgpu’s examples with Wayland, there are still errors:
wgpu’s code disables presentation for the platform because it detects something wrong with EGL support. If I edit the check, there are BAD_NATIVE_WINDOW errors appearing. Some discussions here.
And when running winit examples, the code didn’t report errors but there are no windows visible on the screen, only icons on the desktop dock.
It seems that there is still incompatibility among the driver and rust wayland-client crate. Could Nvidia do more to improve this? Thanks!