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() let target_formats = kms
.dmabuf_formats(); .api
let target_formats = kms .single_renderer(&target_node)
.api .unwrap()
.single_renderer(&target_node) .dmabuf_formats();
.unwrap() let feedback = get_surface_dmabuf_feedback(
.dmabuf_formats(); source_node,
get_surface_dmabuf_feedback( target_node,
source_node, render_formats,
target_node, target_formats,
render_formats, surface.primary_plane_formats.clone(),
target_formats, surface.overlay_plane_formats.clone(),
surface.primary_plane_formats.clone(), );
surface.overlay_plane_formats.clone(), surface.feedback.insert(source_node, feedback.clone());
) Some(feedback)
}) }
.clone(),
)
}); });
} }
Event::Closed => {} Event::Closed => {}