From 1844afde09d7c552c3f46edc86cc45c29a3196ce Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Mon, 30 Jun 2025 15:00:26 -0700 Subject: [PATCH] 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. --- src/backend/kms/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/backend/kms/mod.rs b/src/backend/kms/mod.rs index 8e0d39db..532d6590 100644 --- a/src/backend/kms/mod.rs +++ b/src/backend/kms/mod.rs @@ -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| {