mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-22 02:01:55 +07:00
Send dmabuf feedbacks from the backend
This commit is contained in:
+1
-2
@@ -4,7 +4,6 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use smithay::backend::renderer::gles::GlesRenderer;
|
use smithay::backend::renderer::gles::GlesRenderer;
|
||||||
use smithay::output::Output;
|
use smithay::output::Output;
|
||||||
use smithay::wayland::dmabuf::DmabufFeedback;
|
|
||||||
|
|
||||||
use crate::input::CompositorMod;
|
use crate::input::CompositorMod;
|
||||||
use crate::niri::OutputRenderElements;
|
use crate::niri::OutputRenderElements;
|
||||||
@@ -49,7 +48,7 @@ impl Backend {
|
|||||||
output: &Output,
|
output: &Output,
|
||||||
elements: &[OutputRenderElements<GlesRenderer>],
|
elements: &[OutputRenderElements<GlesRenderer>],
|
||||||
target_presentation_time: Duration,
|
target_presentation_time: Duration,
|
||||||
) -> Option<&DmabufFeedback> {
|
) {
|
||||||
match self {
|
match self {
|
||||||
Backend::Tty(tty) => tty.render(niri, output, elements, target_presentation_time),
|
Backend::Tty(tty) => tty.render(niri, output, elements, target_presentation_time),
|
||||||
Backend::Winit(winit) => winit.render(niri, output, elements),
|
Backend::Winit(winit) => winit.render(niri, output, elements),
|
||||||
|
|||||||
+5
-6
@@ -837,18 +837,18 @@ impl Tty {
|
|||||||
output: &Output,
|
output: &Output,
|
||||||
elements: &[OutputRenderElements<GlesRenderer>],
|
elements: &[OutputRenderElements<GlesRenderer>],
|
||||||
target_presentation_time: Duration,
|
target_presentation_time: Duration,
|
||||||
) -> Option<&DmabufFeedback> {
|
) {
|
||||||
let span = tracy_client::span!("Tty::render");
|
let span = tracy_client::span!("Tty::render");
|
||||||
|
|
||||||
let Some(device) = self.output_device.as_mut() else {
|
let Some(device) = self.output_device.as_mut() else {
|
||||||
error!("missing output device");
|
error!("missing output device");
|
||||||
return None;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let tty_state: &TtyOutputState = output.user_data().get().unwrap();
|
let tty_state: &TtyOutputState = output.user_data().get().unwrap();
|
||||||
let Some(surface) = device.surfaces.get_mut(&tty_state.crtc) else {
|
let Some(surface) = device.surfaces.get_mut(&tty_state.crtc) else {
|
||||||
error!("missing surface");
|
error!("missing surface");
|
||||||
return None;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
span.emit_text(&surface.name);
|
span.emit_text(&surface.name);
|
||||||
@@ -873,6 +873,7 @@ impl Tty {
|
|||||||
}
|
}
|
||||||
|
|
||||||
niri.update_primary_scanout_output(output, &res.states);
|
niri.update_primary_scanout_output(output, &res.states);
|
||||||
|
niri.send_dmabuf_feedbacks(output, &surface.dmabuf_feedback);
|
||||||
|
|
||||||
if res.damage.is_some() {
|
if res.damage.is_some() {
|
||||||
let presentation_feedbacks =
|
let presentation_feedbacks =
|
||||||
@@ -895,7 +896,7 @@ impl Tty {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return Some(&surface.dmabuf_feedback);
|
return;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("error queueing frame: {err}");
|
error!("error queueing frame: {err}");
|
||||||
@@ -914,8 +915,6 @@ impl Tty {
|
|||||||
|
|
||||||
// Queue a timer to fire at the predicted vblank time.
|
// Queue a timer to fire at the predicted vblank time.
|
||||||
queue_estimated_vblank_timer(niri, output.clone(), target_presentation_time);
|
queue_estimated_vblank_timer(niri, output.clone(), target_presentation_time);
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn change_vt(&mut self, vt: i32) {
|
pub fn change_vt(&mut self, vt: i32) {
|
||||||
|
|||||||
@@ -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::dpi::LogicalSize;
|
||||||
use smithay::reexports::winit::window::WindowBuilder;
|
use smithay::reexports::winit::window::WindowBuilder;
|
||||||
use smithay::utils::Transform;
|
use smithay::utils::Transform;
|
||||||
use smithay::wayland::dmabuf::DmabufFeedback;
|
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::niri::{OutputRenderElements, RedrawState, State};
|
use crate::niri::{OutputRenderElements, RedrawState, State};
|
||||||
@@ -152,7 +151,7 @@ impl Winit {
|
|||||||
niri: &mut Niri,
|
niri: &mut Niri,
|
||||||
output: &Output,
|
output: &Output,
|
||||||
elements: &[OutputRenderElements<GlesRenderer>],
|
elements: &[OutputRenderElements<GlesRenderer>],
|
||||||
) -> Option<&DmabufFeedback> {
|
) {
|
||||||
let _span = tracy_client::span!("Winit::render");
|
let _span = tracy_client::span!("Winit::render");
|
||||||
|
|
||||||
self.backend.bind().unwrap();
|
self.backend.bind().unwrap();
|
||||||
@@ -201,8 +200,6 @@ impl Winit {
|
|||||||
if output_state.unfinished_animations_remain {
|
if output_state.unfinished_animations_remain {
|
||||||
self.backend.window().request_redraw();
|
self.backend.window().request_redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn toggle_debug_tint(&mut self) {
|
pub fn toggle_debug_tint(&mut self) {
|
||||||
|
|||||||
+2
-7
@@ -1153,12 +1153,7 @@ impl Niri {
|
|||||||
let elements = self.render(renderer, output, true);
|
let elements = self.render(renderer, output, true);
|
||||||
|
|
||||||
// Hand it over to the backend.
|
// Hand it over to the backend.
|
||||||
let dmabuf_feedback = backend.render(self, output, &elements, presentation_time);
|
backend.render(self, output, &elements, presentation_time);
|
||||||
|
|
||||||
// Send the dmabuf feedbacks.
|
|
||||||
if let Some(feedback) = dmabuf_feedback {
|
|
||||||
self.send_dmabuf_feedbacks(output, feedback);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the frame callbacks.
|
// 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");
|
let _span = tracy_client::span!("Niri::send_dmabuf_feedbacks");
|
||||||
|
|
||||||
// We can unconditionally send the current output's feedback to regular and layer-shell
|
// We can unconditionally send the current output's feedback to regular and layer-shell
|
||||||
|
|||||||
Reference in New Issue
Block a user