Closed jokeyrhyme closed 9 months ago
Is there an open wgpu issue for this?
Not yet, I'll raise one when I'm back at a computer
After being prompted over there, I tested in X11 and other compositors...
I could not reproduce this panic in sway
, GNOME wayland, or GNOME x11, so it's likely specific to cosmic-comp
( this commit: https://github.com/pop-os/cosmic-comp/tree/9ce6a871c1ae48778aa10d61dbad7eab943195d3 )
I'd previously encountered an earlier bug in AMDVLK that was breaking wgpu so I incorrectly assumed it was another similar occurrence
So with AMDVLK, this wouldn't be using Mesa's EGL/Vulkan WSI code, and instead would use AMD's own implementation? Looking at https://github.com/GPUOpen-Drivers/pal/blob/dev/src/core/os/amdgpu/wayland/waylandWindowSystem.cpp, it seems to require wl_drm
. (While other drivers have moved to the newer dmabuf protocol.)
So it may be a bug with cosmic-comp's wl_drm
implementation.
Logs from running the client with WAYLAND_DEBUG=1
may provide some more information here.
Okay, I ran AMD_VULKAN_ICD=AMDVLK WAYLAND_DEBUG=1 RUST_BACKTRACE=1 cosmic-term
and captured the stderr
So the client is trying to use 875713112
. That's XRGB8888
. Which I think should be supported fine?
But wl_drm::format
isn't being sent here, so either the compositor isn't advertising any formats, or the client isn't waiting for the compositor before selecting the format.
Yeah, I think wl_drm::format
should appear in the log right after wl_drm::capabilities
. Is the format list empty, or did wl_drm::Format::try_from(*format as u32)
fail to convert any formats, somehow?
I can add more instrumentation somewhere and recompile to find out?
I'd probably change https://github.com/pop-os/cosmic-comp/blob/f75d89b4240fb25f6e43443efd18f95c8484a620/src/wayland/protocols/drm.rs#L93-L98 to something like:
for format in global_data.formats.iter() {
dbg!(format);
if let Ok(converted) = dbg!(wl_drm::Format::try_from(*format as u32)) {
drm_instance.format(converted as u32);
}
}
I'm not really familiar with AMDVLK, but I should be able to test it, assuming it works with any modern integrated AMD GPU.
Hmmm, I've tried compiling cosmic-comp
with cargo build --release
and cargo build
(debug) and neither results in dbg!(...)
output ending up in journalctl -xb
I even put a trivial dbg!("cosmic-comp starting up");
in main.rs to confirm, and it doesn't appear in the logs
Do I need to run cosmic-comp
or cosmic-session
with an environment variable to get this log output?
Oh yeah. dbg!
will just be written to stderr, not journald. Something like ./target/release/cosmic-comp 2>&1 | tee log-file
is what I often use to test that sort of thing. Something like tracing::error!
will instead write to both journald and stderr.
Okay, I instrumented the start of cosmic-comp::main() and cosmic-comp::wayland::protocols::drm::WlDrmState::bind() , as well as the body of the for
loop in the latter
I can see that bind()
is called multiple times when trying to run cosmic-term
, but there is no output from inside the loop, so I assume this means global_data.formats
is empty
Seems AMDVLK recently dropped support for older graphics, including the Renoir APU I have handy, but https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-2023.Q3.3 works.
I am able to reproduce the issue easily with that.
Ah, so .filter(|f| f.modifier == Modifier::Invalid)
ends up filtering out all of the formats. ("Invalid" here means formats that work with an "implicit dmabuf modifier".)
Removing that gives me wl_drm@53: error 2: buffer import failed
instead. Presumably Mesa's EGL failed to import the dmabuf.
I could make sense that Mesa is requiring explicit modifiers for import while AMDVLK needs wl_drm
which doesn't support them, but then if other compositors work with the same drivers, I'm not sure what they're doing differently.
https://github.com/Smithay/smithay/pull/1274 seems to fix this.
Also an issue to see if amdvlk will implement zwp-linux-dmabuf-v1: https://github.com/GPUOpen-Drivers/pal/issues/96
Yeah, AMDVLK should move to the dmabuf protocol, and probably make use of explicit modifiers. wl_drm
is basically a deprecated API at this point, and Mesa and compositors are interested in dropping support for it once it's no longer needed anywhere.
RADV likely offers overall better Wayland support, though there is still more to improve in Mesa's Vulkan and EGL Wayland WSI support.
This should be fixed now that the Smithay PR is merged, and cosmic-comp has updated Smithay.
I can confirm that this is fixed for me: https://github.com/pop-os/cosmic-epoch/pull/186
cosmic-term
to be unable to be launched from anywhere where environment variables are unable to be customised (e.g.cosmic-launcher
,cosmic-app-library
, etc)launching
cosmic-term
orAMD_VULKAN_ICD=AMDVLK cosmic-term
results in the following error:all of these do work, however:
AMD_VULKAN_ICD=RADV cosmic-term
works just finecosmic-launcher
, etcI do not expect this to be addressed in wgpu nor
cosmic-term
(but awareness may be handy later)