general improvement and bug fixes, cursor scaling, DMA-BUF routing and nested backend recovery

ignore performance-baseline.md

more improvement and code quality fixes
This commit is contained in:
Samuel Onoja committed 2026-10-04 18:33:05 +01:00
1 parent 405c74af9f
commit 73f21e20ce
23 files changed
+2287 -457

No files matched your search

+29 -1
View File
@@ -107,6 +107,16 @@ impl DirectBackendState {
self.active && !self.topology.reconciling && !self.lid.pending()
}
pub(crate) fn process_dmabuf_imports(&mut self, imports: &mut crate::dmabuf_imports::ImportManager) {
if !self.active || self.topology.reconciling {
return;
}
for device in self.devices.values_mut().filter(|device| device.drm.is_active()) {
imports.process(device.dmabuf_global, &mut device.renderer, Some(device.render_node));
}
}
pub(crate) fn scene_output(&self, state: &Ferese, output: &Output) -> Output {
let source = self
.devices
@@ -950,6 +960,7 @@ fn open_device(state: &mut Ferese, path: &Path) -> Result<DrmNode, Box<dyn Error
let dmabuf_global = state
.dmabuf_state
.create_global_with_default_feedback::<Ferese>(&display_handle, &feedback);
state.dmabuf_imports.register(dmabuf_global);
state
.direct_backend
.as_mut()
@@ -1088,6 +1099,23 @@ fn cursor_affected_outputs(state: &Ferese) -> Vec<Output> {
.collect()
}
pub(crate) fn cursor_animation_visible(state: &Ferese) -> bool {
if let Some(backend) = state.direct_backend.as_ref() {
backend.can_render()
&& backend.devices.values().any(|device| {
device
.outputs
.values()
.any(|output| output.power.can_render() && redraw::cursor_on_output(state, &output.output))
})
} else {
state
.space
.outputs()
.any(|output| redraw::cursor_on_output(state, output))
}
}
#[track_caller]
pub(crate) fn render_surface(
state: &mut Ferese,
@@ -1272,7 +1300,6 @@ fn render_output(
let frame = state.sample_frame(&scene_output, horizon);
let rendered = {
(|| -> Result<bool, Box<dyn Error>> {
state.process_dmabuf_imports(&mut device.renderer, Some(device.render_node));
let elements = if output.mirror_source.is_some() {
mirror::elements(state, &mut device.renderer, &scene_output, &frame, &mut output)?
} else {
@@ -1562,6 +1589,7 @@ fn remove_device(state: &mut Ferese, node: DrmNode) {
};
state.loop_handle.remove(device.notifier);
state.dmabuf_imports.remove(device.dmabuf_global);
state
.dmabuf_state
.disable_global::<Ferese>(&state.display_handle, &device.dmabuf_global);
+1 -1
View File
@@ -67,7 +67,7 @@ pub(super) fn capture_mirror(
}
}
fn capture_request<T, E: Display>(
pub(crate) fn capture_request<T, E: Display>(
state: &mut Ferese,
output: &Output,
include_cursor: bool,
+6 -17
View File
@@ -123,22 +123,11 @@ pub(super) fn cursor_on_output(state: &crate::Ferese, output: &smithay::output::
.to_f64()
}
CursorImageStatus::Named(icon) => {
let Some(cursor) = state.named_cursors.get(icon) else {
CursorImageStatus::Named(_) => {
let Some(cursor) = state.named_cursor_frame() else {
return false;
};
let scale = output.current_scale().fractional_scale();
// Named buffers use buffer scale 1: Smithay scales their size
// with the output, while the hotspot is subtracted physically.
let size = cursor.size;
Rectangle::<f64, Logical>::new(
(
location.x - f64::from(cursor.hotspot.x) / scale,
location.y - f64::from(cursor.hotspot.y) / scale,
)
.into(),
(f64::from(size.w), f64::from(size.h)).into(),
)
cursor.logical_rect(location)
}
CursorImageStatus::Hidden => return false,
@@ -353,9 +342,9 @@ mod tests {
);
assert!(cursor_on_output(&state, &outputs[0]));
assert!(cursor_on_output(&state, &outputs[1]), "cursor image straddles the seam");
if let CursorImageStatus::Named(icon) = &state.cursor_status {
let cursor = state.named_cursors.get(icon).unwrap();
let x = 1920.0 - f64::from(cursor.size.w) * 0.75 + f64::from(cursor.hotspot.x) / 2.0;
if let Some(cursor) = state.named_cursor_frame() {
let x = 1920.0 - f64::from(cursor.size.w) / f64::from(cursor.buffer_scale) * 0.75
+ f64::from(cursor.hotspot.x) / f64::from(cursor.buffer_scale);
pointer.motion(
&mut state,
None,