refactor(wayland): remove manual dmabuf importing

This commit is contained in:
Nova
2022-12-09 06:59:28 -05:00
parent ac5e949614
commit 303b3f3ca2
3 changed files with 18 additions and 30 deletions

View File

@@ -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);

View File

@@ -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(

View File

@@ -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);