kms: Dmabuf Feedback support
This commit is contained in:
parent
486266f7bb
commit
c8bb417d9b
8 changed files with 234 additions and 26 deletions
74
src/state.rs
74
src/state.rs
|
|
@ -20,15 +20,18 @@ use smithay::{
|
|||
backend::{
|
||||
drm::DrmNode,
|
||||
renderer::{
|
||||
element::{default_primary_scanout_output_compare, RenderElementStates},
|
||||
element::{
|
||||
default_primary_scanout_output_compare, utils::select_dmabuf_feedback,
|
||||
RenderElementStates,
|
||||
},
|
||||
glow::GlowRenderer,
|
||||
},
|
||||
},
|
||||
desktop::utils::{
|
||||
send_frames_surface_tree, surface_presentation_feedback_flags_from_states,
|
||||
surface_primary_scanout_output, take_presentation_feedback_surface_tree,
|
||||
update_surface_primary_scanout_output, with_surfaces_surface_tree,
|
||||
OutputPresentationFeedback,
|
||||
send_dmabuf_feedback_surface_tree, send_frames_surface_tree,
|
||||
surface_presentation_feedback_flags_from_states, surface_primary_scanout_output,
|
||||
take_presentation_feedback_surface_tree, update_surface_primary_scanout_output,
|
||||
with_surfaces_surface_tree, OutputPresentationFeedback,
|
||||
},
|
||||
input::{pointer::CursorImageStatus, Seat, SeatState},
|
||||
output::{Mode as OutputMode, Output, Scale},
|
||||
|
|
@ -45,7 +48,7 @@ use smithay::{
|
|||
wayland::{
|
||||
compositor::CompositorState,
|
||||
data_device::DataDeviceState,
|
||||
dmabuf::DmabufState,
|
||||
dmabuf::{DmabufFeedback, DmabufState},
|
||||
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitState,
|
||||
output::OutputManagerState,
|
||||
presentation::PresentationState,
|
||||
|
|
@ -130,6 +133,11 @@ pub enum BackendData {
|
|||
Unset,
|
||||
}
|
||||
|
||||
pub struct SurfaceDmabufFeedback {
|
||||
pub render_feedback: DmabufFeedback,
|
||||
pub scanout_feedback: DmabufFeedback,
|
||||
}
|
||||
|
||||
impl BackendData {
|
||||
pub fn kms(&mut self) -> &mut KmsState {
|
||||
match self {
|
||||
|
|
@ -363,7 +371,12 @@ impl Common {
|
|||
self.last_active_seat.as_ref().expect("No seat?")
|
||||
}
|
||||
|
||||
pub fn send_frames(&self, output: &Output, render_element_states: &RenderElementStates) {
|
||||
pub fn send_frames(
|
||||
&self,
|
||||
output: &Output,
|
||||
render_element_states: &RenderElementStates,
|
||||
dmabuf_feedback: Option<&SurfaceDmabufFeedback>,
|
||||
) {
|
||||
let time = self.clock.now();
|
||||
let throttle = Some(Duration::from_secs(1));
|
||||
|
||||
|
|
@ -401,6 +414,14 @@ impl Common {
|
|||
throttle,
|
||||
surface_primary_scanout_output,
|
||||
);
|
||||
if let Some(feedback) = dmabuf_feedback {
|
||||
grab_state.send_dmabuf_feedback(
|
||||
output,
|
||||
feedback,
|
||||
render_element_states,
|
||||
surface_primary_scanout_output,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -432,6 +453,14 @@ impl Common {
|
|||
);
|
||||
});
|
||||
window.send_frame(output, time, throttle, surface_primary_scanout_output);
|
||||
if let Some(feedback) = dmabuf_feedback {
|
||||
window.send_dmabuf_feedback(
|
||||
output,
|
||||
feedback,
|
||||
render_element_states,
|
||||
surface_primary_scanout_output,
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -466,7 +495,22 @@ impl Common {
|
|||
time,
|
||||
throttle,
|
||||
surface_primary_scanout_output,
|
||||
)
|
||||
);
|
||||
if let Some(feedback) = dmabuf_feedback {
|
||||
send_dmabuf_feedback_surface_tree(
|
||||
&wl_surface,
|
||||
output,
|
||||
surface_primary_scanout_output,
|
||||
|surface, _| {
|
||||
select_dmabuf_feedback(
|
||||
surface,
|
||||
render_element_states,
|
||||
&feedback.render_feedback,
|
||||
&feedback.scanout_feedback,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -482,6 +526,20 @@ impl Common {
|
|||
);
|
||||
});
|
||||
layer_surface.send_frame(output, time, throttle, surface_primary_scanout_output);
|
||||
if let Some(feedback) = dmabuf_feedback {
|
||||
layer_surface.send_dmabuf_feedback(
|
||||
output,
|
||||
surface_primary_scanout_output,
|
||||
|surface, _| {
|
||||
select_dmabuf_feedback(
|
||||
surface,
|
||||
render_element_states,
|
||||
&feedback.render_feedback,
|
||||
&feedback.scanout_feedback,
|
||||
)
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue