2022-07-04 15:26:26 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
|
2025-12-19 18:49:22 +01:00
|
|
|
use crate::state::State;
|
2022-07-04 15:26:26 +02:00
|
|
|
use smithay::{
|
2023-11-22 13:27:12 -08:00
|
|
|
backend::allocator::dmabuf::Dmabuf,
|
2022-07-04 16:00:29 +02:00
|
|
|
delegate_dmabuf,
|
2023-11-22 13:27:12 -08:00
|
|
|
wayland::dmabuf::{DmabufGlobal, DmabufHandler, DmabufState, ImportNotifier},
|
2022-07-04 15:26:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
impl DmabufHandler for State {
|
|
|
|
|
fn dmabuf_state(&mut self) -> &mut DmabufState {
|
|
|
|
|
&mut self.common.dmabuf_state
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-04 16:00:29 +02:00
|
|
|
fn dmabuf_imported(
|
|
|
|
|
&mut self,
|
|
|
|
|
global: &DmabufGlobal,
|
|
|
|
|
dmabuf: Dmabuf,
|
2023-11-22 13:27:12 -08:00
|
|
|
import_notifier: ImportNotifier,
|
|
|
|
|
) {
|
2025-12-19 18:49:22 +01:00
|
|
|
let client = import_notifier.client();
|
|
|
|
|
match self.backend.dmabuf_imported(client.clone(), global, dmabuf) {
|
2024-01-17 11:34:19 +00:00
|
|
|
Err(err) => {
|
|
|
|
|
tracing::debug!(?err, "dmabuf import failed");
|
|
|
|
|
import_notifier.failed()
|
|
|
|
|
}
|
2025-12-19 18:49:22 +01:00
|
|
|
Ok(_) => {
|
2024-01-17 11:34:19 +00:00
|
|
|
let _ = import_notifier.successful::<State>();
|
|
|
|
|
}
|
2022-07-04 15:26:26 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
delegate_dmabuf!(State);
|