From 57a73476207bd33a26b39964feb01bb673be8a2b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Wed, 3 Jan 2024 11:16:47 +0400 Subject: Move import_dmabuf to backends --- src/backend/tty.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/backend/tty.rs') diff --git a/src/backend/tty.rs b/src/backend/tty.rs index e0858e6b..679073e5 100644 --- a/src/backend/tty.rs +++ b/src/backend/tty.rs @@ -8,6 +8,7 @@ use std::time::Duration; use anyhow::{anyhow, Context}; use libc::dev_t; +use smithay::backend::allocator::dmabuf::Dmabuf; use smithay::backend::allocator::gbm::{GbmAllocator, GbmBufferFlags, GbmDevice}; use smithay::backend::allocator::Fourcc; use smithay::backend::drm::compositor::{DrmCompositor, PrimaryPlaneElement}; @@ -974,6 +975,17 @@ impl Tty { } } + pub fn import_dmabuf(&mut self, dmabuf: &Dmabuf) -> Result<(), ()> { + let device = self.output_device.as_mut().ok_or(())?; + match device.gles.import_dmabuf(dmabuf, None) { + Ok(_texture) => Ok(()), + Err(err) => { + debug!("error importing dmabuf: {err:?}"); + Err(()) + } + } + } + pub fn connectors(&self) -> Arc>> { self.connectors.clone() } -- cgit