diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-13 10:33:51 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2023-10-13 13:30:36 +0400 |
| commit | 0a3274749563067b06af83f870ff39dc503a5355 (patch) | |
| tree | 5758345ca1ad71fcc1564a5675b039a801aa138a | |
| parent | f625dede1a2a002527f8297cfecef8b0bd4b10a2 (diff) | |
| download | niri-0a3274749563067b06af83f870ff39dc503a5355.tar.gz niri-0a3274749563067b06af83f870ff39dc503a5355.tar.bz2 niri-0a3274749563067b06af83f870ff39dc503a5355.zip | |
Send dmabuf feedbacks from the backend
| -rw-r--r-- | src/backend/mod.rs | 3 | ||||
| -rw-r--r-- | src/backend/tty.rs | 11 | ||||
| -rw-r--r-- | src/backend/winit.rs | 5 | ||||
| -rw-r--r-- | src/niri.rs | 9 |
4 files changed, 9 insertions, 19 deletions
diff --git a/src/backend/mod.rs b/src/backend/mod.rs index 532b8a9c..0fa7bf59 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -4,7 +4,6 @@ use std::time::Duration; use smithay::backend::renderer::gles::GlesRenderer; use smithay::output::Output; -use smithay::wayland::dmabuf::DmabufFeedback; use crate::input::CompositorMod; use crate::niri::OutputRenderElements; @@ -49,7 +48,7 @@ impl Backend { output: &Output, elements: &[OutputRenderElements<GlesRenderer>], target_presentation_time: Duration, - ) -> Option<&DmabufFeedback> { + ) { match self { Backend::Tty(tty) => tty.render(niri, output, elements, target_presentation_time), Backend::Winit(winit) => winit.render(niri, output, elements), diff --git a/src/backend/tty.rs b/src/backend/tty.rs index a1c75c8d..74f3e9ed 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -837,18 +837,18 @@ impl Tty { output: &Output, elements: &[OutputRenderElements<GlesRenderer>], target_presentation_time: Duration, - ) -> Option<&DmabufFeedback> { + ) { let span = tracy_client::span!("Tty::render"); let Some(device) = self.output_device.as_mut() else { error!("missing output device"); - return None; + return; }; let tty_state: &TtyOutputState = output.user_data().get().unwrap(); let Some(surface) = device.surfaces.get_mut(&tty_state.crtc) else { error!("missing surface"); - return None; + return; }; span.emit_text(&surface.name); @@ -873,6 +873,7 @@ impl Tty { } niri.update_primary_scanout_output(output, &res.states); + niri.send_dmabuf_feedbacks(output, &surface.dmabuf_feedback); if res.damage.is_some() { let presentation_feedbacks = @@ -895,7 +896,7 @@ impl Tty { } }; - return Some(&surface.dmabuf_feedback); + return; } Err(err) => { error!("error queueing frame: {err}"); @@ -914,8 +915,6 @@ impl Tty { // Queue a timer to fire at the predicted vblank time. queue_estimated_vblank_timer(niri, output.clone(), target_presentation_time); - - None } pub fn change_vt(&mut self, vt: i32) { diff --git a/src/backend/winit.rs b/src/backend/winit.rs index 41da8ab6..508f4cf0 100644 --- a/src/backend/winit.rs +++ b/src/backend/winit.rs @@ -16,7 +16,6 @@ use smithay::reexports::wayland_protocols::wp::presentation_time::server::wp_pre use smithay::reexports::winit::dpi::LogicalSize; use smithay::reexports::winit::window::WindowBuilder; use smithay::utils::Transform; -use smithay::wayland::dmabuf::DmabufFeedback; use crate::config::Config; use crate::niri::{OutputRenderElements, RedrawState, State}; @@ -152,7 +151,7 @@ impl Winit { niri: &mut Niri, output: &Output, elements: &[OutputRenderElements<GlesRenderer>], - ) -> Option<&DmabufFeedback> { + ) { let _span = tracy_client::span!("Winit::render"); self.backend.bind().unwrap(); @@ -201,8 +200,6 @@ impl Winit { if output_state.unfinished_animations_remain { self.backend.window().request_redraw(); } - - None } pub fn toggle_debug_tint(&mut self) { diff --git a/src/niri.rs b/src/niri.rs index fb5a1afc..b6109113 100644 --- a/src/niri.rs +++ b/src/niri.rs @@ -1153,12 +1153,7 @@ impl Niri { let elements = self.render(renderer, output, true); // Hand it over to the backend. - let dmabuf_feedback = backend.render(self, output, &elements, presentation_time); - - // Send the dmabuf feedbacks. - if let Some(feedback) = dmabuf_feedback { - self.send_dmabuf_feedbacks(output, feedback); - } + backend.render(self, output, &elements, presentation_time); // Send the frame callbacks. // @@ -1263,7 +1258,7 @@ impl Niri { } } - fn send_dmabuf_feedbacks(&self, output: &Output, feedback: &DmabufFeedback) { + pub fn send_dmabuf_feedbacks(&self, output: &Output, feedback: &DmabufFeedback) { let _span = tracy_client::span!("Niri::send_dmabuf_feedbacks"); // We can unconditionally send the current output's feedback to regular and layer-shell |
