Move import_dmabuf to backends

This commit is contained in:
Ivan Molodetskikh
2024-01-03 11:16:47 +04:00
parent 628891db2c
commit 57a7347620
4 changed files with 35 additions and 11 deletions
+12 -1
View File
@@ -5,9 +5,10 @@ use std::rc::Rc;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use smithay::backend::allocator::dmabuf::Dmabuf;
use smithay::backend::renderer::damage::OutputDamageTracker;
use smithay::backend::renderer::gles::GlesRenderer;
use smithay::backend::renderer::{DebugFlags, ImportEgl, Renderer};
use smithay::backend::renderer::{DebugFlags, ImportDma, ImportEgl, Renderer};
use smithay::backend::winit::{self, WinitEvent, WinitGraphicsBackend};
use smithay::output::{Mode, Output, PhysicalProperties, Scale, Subpixel};
use smithay::reexports::calloop::LoopHandle;
@@ -199,6 +200,16 @@ impl Winit {
renderer.set_debug_flags(renderer.debug_flags() ^ DebugFlags::TINT);
}
pub fn import_dmabuf(&mut self, dmabuf: &Dmabuf) -> Result<(), ()> {
match self.backend.renderer().import_dmabuf(dmabuf, None) {
Ok(_texture) => Ok(()),
Err(err) => {
debug!("error importing dmabuf: {err:?}");
Err(())
}
}
}
pub fn connectors(&self) -> Arc<Mutex<HashMap<String, Output>>> {
self.connectors.clone()
}