From 303b3f3ca27b227cc6e9c8848e03024da2882edd Mon Sep 17 00:00:00 2001 From: Nova Date: Fri, 9 Dec 2022 06:59:28 -0500 Subject: [PATCH] refactor(wayland): remove manual dmabuf importing --- src/wayland/dmabuf.rs | 22 ---------------------- src/wayland/mod.rs | 8 ++------ src/wayland/state.rs | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 30 deletions(-) delete mode 100644 src/wayland/dmabuf.rs diff --git a/src/wayland/dmabuf.rs b/src/wayland/dmabuf.rs deleted file mode 100644 index 887c2ef..0000000 --- a/src/wayland/dmabuf.rs +++ /dev/null @@ -1,22 +0,0 @@ -use super::state::WaylandState; -use smithay::{ - backend::allocator::dmabuf::Dmabuf, - delegate_dmabuf, - wayland::dmabuf::{self, DmabufGlobal, DmabufHandler, DmabufState}, -}; - -impl DmabufHandler for WaylandState { - fn dmabuf_state(&mut self) -> &mut DmabufState { - &mut self.dmabuf_state - } - - fn dmabuf_imported( - &mut self, - _global: &DmabufGlobal, - dmabuf: Dmabuf, - ) -> Result<(), dmabuf::ImportError> { - self.pending_dmabufs.push(dmabuf); - Ok(()) - } -} -delegate_dmabuf!(WaylandState); diff --git a/src/wayland/mod.rs b/src/wayland/mod.rs index efc45bb..10d95c0 100644 --- a/src/wayland/mod.rs +++ b/src/wayland/mod.rs @@ -8,7 +8,6 @@ mod state; mod surface; mod xdg_activation; mod xdg_shell; -mod dmabuf; use self::{panel_item::PanelItem, state::WaylandState, surface::CORE_SURFACES}; use crate::wayland::state::ClientState; @@ -17,7 +16,7 @@ use once_cell::sync::OnceCell; use parking_lot::Mutex; use slog::Drain; use smithay::{ - backend::{egl::EGLContext, renderer::{gles2::Gles2Renderer, ImportDma}}, + backend::{egl::EGLContext, renderer::{gles2::Gles2Renderer}}, reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket, Resource}, }; use tracing::info; @@ -153,10 +152,7 @@ impl Wayland { .wl_surface() .and_then(|surf| surf.client()) .map(|c| c.id()) else { continue }; - let mut state = self.state.lock(); - for dmabuf in state.pending_dmabufs.drain(..) { - let _ = self.renderer.import_dmabuf(&dmabuf, None); - } + let state = self.state.lock(); let Some(seat_data) = state.seats.get(&client_id).cloned() else { continue }; let output = state.output.clone(); core_surface.process( diff --git a/src/wayland/state.rs b/src/wayland/state.rs index 24c6188..9f67adc 100644 --- a/src/wayland/state.rs +++ b/src/wayland/state.rs @@ -7,7 +7,7 @@ use smithay::{ allocator::dmabuf::Dmabuf, renderer::{gles2::Gles2Renderer, ImportDma}, }, - delegate_output, delegate_shm, + delegate_dmabuf, delegate_output, delegate_shm, output::{Mode, Output, Scale, Subpixel}, reexports::{ wayland_protocols_misc::server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as DecorationMode, @@ -21,7 +21,7 @@ use smithay::{ wayland::{ buffer::BufferHandler, compositor::CompositorState, - dmabuf::{DmabufGlobal, DmabufState}, + dmabuf::{self, DmabufGlobal, DmabufHandler, DmabufState}, output::OutputManagerState, shell::{ kde::decoration::KdeDecorationState, @@ -157,5 +157,19 @@ impl ShmHandler for WaylandState { &self.shm_state } } +impl DmabufHandler for WaylandState { + fn dmabuf_state(&mut self) -> &mut DmabufState { + &mut self.dmabuf_state + } + + fn dmabuf_imported( + &mut self, + _global: &DmabufGlobal, + _dmabuf: Dmabuf, + ) -> Result<(), dmabuf::ImportError> { + Ok(()) + } +} +delegate_dmabuf!(WaylandState); delegate_shm!(WaylandState); delegate_output!(WaylandState);