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::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),
|
||||
|
||||
+5
-6
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+2
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user