kms: Dmabuf Feedback support
This commit is contained in:
parent
486266f7bb
commit
c8bb417d9b
8 changed files with 234 additions and 26 deletions
|
|
@ -2,13 +2,17 @@ use std::time::Duration;
|
|||
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
element::{surface::WaylandSurfaceRenderElement, AsRenderElements},
|
||||
element::{
|
||||
surface::WaylandSurfaceRenderElement, utils::select_dmabuf_feedback, AsRenderElements,
|
||||
RenderElementStates,
|
||||
},
|
||||
ImportAll, Renderer,
|
||||
},
|
||||
desktop::{
|
||||
utils::{
|
||||
send_frames_surface_tree, take_presentation_feedback_surface_tree,
|
||||
with_surfaces_surface_tree, OutputPresentationFeedback,
|
||||
send_dmabuf_feedback_surface_tree, send_frames_surface_tree,
|
||||
take_presentation_feedback_surface_tree, with_surfaces_surface_tree,
|
||||
OutputPresentationFeedback,
|
||||
},
|
||||
Window,
|
||||
},
|
||||
|
|
@ -34,6 +38,8 @@ use smithay::{
|
|||
xwayland::{xwm::X11Relatable, X11Surface},
|
||||
};
|
||||
|
||||
use crate::state::SurfaceDmabufFeedback;
|
||||
|
||||
space_elements! {
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub CosmicSurface;
|
||||
|
|
@ -369,7 +375,7 @@ impl CosmicSurface {
|
|||
{
|
||||
match self {
|
||||
CosmicSurface::Wayland(window) => {
|
||||
window.send_frame(output, time, throttle, primary_scan_out_output)
|
||||
window.send_frame(output, time, throttle, primary_scan_out_output);
|
||||
}
|
||||
CosmicSurface::X11(surface) => {
|
||||
if let Some(wl_surface) = surface.wl_surface() {
|
||||
|
|
@ -386,6 +392,47 @@ impl CosmicSurface {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn send_dmabuf_feedback<F1>(
|
||||
&self,
|
||||
output: &Output,
|
||||
feedback: &SurfaceDmabufFeedback,
|
||||
render_element_states: &RenderElementStates,
|
||||
primary_scan_out_output: F1,
|
||||
) where
|
||||
F1: FnMut(&WlSurface, &SurfaceData) -> Option<Output> + Copy,
|
||||
{
|
||||
match self {
|
||||
CosmicSurface::Wayland(window) => {
|
||||
window.send_dmabuf_feedback(output, primary_scan_out_output, |surface, _| {
|
||||
select_dmabuf_feedback(
|
||||
surface,
|
||||
render_element_states,
|
||||
&feedback.render_feedback,
|
||||
&feedback.scanout_feedback,
|
||||
)
|
||||
})
|
||||
}
|
||||
CosmicSurface::X11(surface) => {
|
||||
if let Some(wl_surface) = surface.wl_surface() {
|
||||
send_dmabuf_feedback_surface_tree(
|
||||
&wl_surface,
|
||||
output,
|
||||
primary_scan_out_output,
|
||||
|surface, _| {
|
||||
select_dmabuf_feedback(
|
||||
surface,
|
||||
render_element_states,
|
||||
&feedback.render_feedback,
|
||||
&feedback.scanout_feedback,
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn take_presentation_feedback<F1, F2>(
|
||||
&self,
|
||||
output_feedback: &mut OutputPresentationFeedback,
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ use crate::{
|
|||
element::{window::CosmicWindowRenderElement, CosmicMapped, CosmicMappedRenderElement},
|
||||
focus::target::{KeyboardFocusTarget, PointerFocusTarget},
|
||||
},
|
||||
state::SurfaceDmabufFeedback,
|
||||
utils::prelude::*,
|
||||
};
|
||||
|
||||
use smithay::{
|
||||
backend::renderer::{
|
||||
element::{AsRenderElements, RenderElement},
|
||||
element::{AsRenderElements, RenderElement, RenderElementStates},
|
||||
ImportAll, ImportMem, Renderer,
|
||||
},
|
||||
desktop::space::SpaceElement,
|
||||
|
|
@ -91,6 +92,21 @@ impl MoveGrabState {
|
|||
.active_window()
|
||||
.send_frame(output, time, throttle, primary_scan_out_output)
|
||||
}
|
||||
|
||||
pub fn send_dmabuf_feedback(
|
||||
&self,
|
||||
output: &Output,
|
||||
feedback: &SurfaceDmabufFeedback,
|
||||
render_element_states: &RenderElementStates,
|
||||
primary_scan_out_output: impl FnMut(&WlSurface, &SurfaceData) -> Option<Output> + Copy,
|
||||
) {
|
||||
self.window.active_window().send_dmabuf_feedback(
|
||||
output,
|
||||
feedback,
|
||||
render_element_states,
|
||||
primary_scan_out_output,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MoveSurfaceGrab {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue