kms: Correctly handle the source node not being initialized

This commit is contained in:
Victoria Brekenfeld 2025-07-31 18:55:19 +02:00 committed by Victoria Brekenfeld
parent 86493b7898
commit a409770df7

View file

@ -304,32 +304,30 @@ impl Surface {
state state
.common .common
.send_dmabuf_feedback(&output_clone, &states, |source_node| { .send_dmabuf_feedback(&output_clone, &states, |source_node| {
Some( if let Some(cached_feedback) = surface.feedback.get(&source_node) {
surface Some(cached_feedback.clone())
.feedback } else {
.entry(source_node) // If we have freed the node, because it didn't have any active buffers/surfaces,
.or_insert_with(|| { // we might not be able to evaluate surface feedback yet.
let render_formats = kms let render_formats =
.api kms.api.single_renderer(&source_node).ok()?.dmabuf_formats();
.single_renderer(&source_node) // In contrast we must have the target node, if we have an active surface
.unwrap()
.dmabuf_formats();
let target_formats = kms let target_formats = kms
.api .api
.single_renderer(&target_node) .single_renderer(&target_node)
.unwrap() .unwrap()
.dmabuf_formats(); .dmabuf_formats();
get_surface_dmabuf_feedback( let feedback = get_surface_dmabuf_feedback(
source_node, source_node,
target_node, target_node,
render_formats, render_formats,
target_formats, target_formats,
surface.primary_plane_formats.clone(), surface.primary_plane_formats.clone(),
surface.overlay_plane_formats.clone(), surface.overlay_plane_formats.clone(),
) );
}) surface.feedback.insert(source_node, feedback.clone());
.clone(), Some(feedback)
) }
}); });
} }
Event::Closed => {} Event::Closed => {}