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

@ -31,13 +31,23 @@ use smithay::{
},
wayland::{
buffer::BufferHandler,
dmabuf::{DmabufGlobal, DmabufHandler, ImportError},
dmabuf::{DmabufGlobal, DmabufHandler},
},
};
use tracing::trace;
use std::{convert::TryFrom, path::PathBuf, sync::Arc};
pub enum ImportError {
Failed,
InvalidFormat,
}
pub trait DrmHandler {
fn dmabuf_imported(&mut self, global: &DmabufGlobal, dmabuf: Dmabuf)
-> Result<(), ImportError>;
}
#[derive(Debug)]
pub struct WlDrmState;
@ -98,7 +108,7 @@ where
+ Dispatch<wl_drm::WlDrm, DrmInstanceData>
+ Dispatch<WlBuffer, Dmabuf>
+ BufferHandler
+ DmabufHandler
+ DrmHandler
+ 'static,
{
fn request(
@ -163,7 +173,7 @@ where
match dma.build() {
Some(dmabuf) => {
match state.dmabuf_imported(&data.dmabuf_global, dmabuf.clone()) {
Ok(_) => {
Ok(()) => {
// import was successful
data_init.init(id, dmabuf);
trace!("Created a new validated dma wl_buffer via wl_drm.");