kms: Do not attempt to import dmabuf on device not supporting format

Previously, if `expected_node` couldn't import a buffer, it would print
an error, then try the next node. There shouldn't really be a reason to
attempt import if the format/modifier isn't in `dmabuf_texture_formats`.

It seems the issue I've been seeing with cosmic-workspaces crashing
the Nvidia driver is fixed by removing this, and disabling `dma_shadow_copy`
(which was producing the same error). Importing Nvidia buffers on the AMD
GPU seems to be causing issues.

Not sure how `dma_shadow_copy` should be fixed, but a test for supported
formats is easy to add here anyway.
This commit is contained in:
Ian Douglas Scott 2025-06-30 15:00:26 -07:00 committed by Ian Douglas Scott
parent db0b5108ad
commit 1844afde09

View file

@ -16,6 +16,7 @@ use smithay::{
allocator::{
dmabuf::Dmabuf,
gbm::{GbmAllocator, GbmBufferFlags},
Buffer,
},
drm::{output::DrmOutputRenderElements, DrmDeviceFd, DrmNode, NodeType},
egl::{context::ContextPriority, EGLContext, EGLDevice, EGLDisplay},
@ -456,6 +457,17 @@ impl KmsState {
&_egl.as_ref().unwrap().display
};
if !egl_display
.dmabuf_texture_formats()
.contains(&dmabuf.format())
{
trace!(
"Skipping import of dmabuf on {:?}: unsupported format",
device.render_node
);
continue;
}
let result = egl_display
.create_image_from_dmabuf(&dmabuf)
.map(|image| {