Update Smithay

For the `drm` protocol, we can't construct an `ImportNotifier`, since
that is specifically based around `ZwpLinuxBufferParamsv1`. So we need a
new method for importing with that protocol.

This could be improved, but should match current behavior.
This commit is contained in:
Ian Douglas Scott 2023-11-22 13:27:12 -08:00 committed by Victoria Brekenfeld
parent 2ffb8068b8
commit 41a69cfc9f
7 changed files with 282 additions and 306 deletions

View file

@ -30,6 +30,7 @@ use rust_embed::RustEmbed;
use smithay::utils::Rectangle;
use smithay::{
backend::{
allocator::dmabuf::Dmabuf,
drm::DrmNode,
input::Device,
renderer::{
@ -38,6 +39,7 @@ use smithay::{
RenderElementStates,
},
glow::GlowRenderer,
ImportDma,
},
},
desktop::utils::{
@ -60,7 +62,7 @@ use smithay::{
utils::{Clock, IsAlive, Monotonic},
wayland::{
compositor::{CompositorClientState, CompositorState},
dmabuf::{DmabufFeedback, DmabufState},
dmabuf::{DmabufFeedback, DmabufGlobal, DmabufState},
fractional_scale::{with_fractional_scale, FractionalScaleManagerState},
input_method::InputMethodManagerState,
keyboard_shortcuts_inhibit::KeyboardShortcutsInhibitState,
@ -274,6 +276,24 @@ impl BackendData {
_ => unreachable!("No backend was initialized"),
}
}
pub fn dmabuf_imported(
&mut self,
global: &DmabufGlobal,
dmabuf: Dmabuf,
) -> Result<(), anyhow::Error> {
match self {
BackendData::Kms(ref mut state) => state.dmabuf_imported(global, dmabuf)?,
BackendData::Winit(ref mut state) => {
state.backend.renderer().import_dmabuf(&dmabuf, None)?;
}
BackendData::X11(ref mut state) => {
state.renderer.import_dmabuf(&dmabuf, None)?;
}
_ => unreachable!("No backend set when importing dmabuf"),
}
Ok(())
}
}
pub fn client_has_no_security_context(client: &Client) -> bool {