refactor(wayland): remove manual dmabuf importing
This commit is contained in:
@@ -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);
|
|
||||||
@@ -8,7 +8,6 @@ mod state;
|
|||||||
mod surface;
|
mod surface;
|
||||||
mod xdg_activation;
|
mod xdg_activation;
|
||||||
mod xdg_shell;
|
mod xdg_shell;
|
||||||
mod dmabuf;
|
|
||||||
|
|
||||||
use self::{panel_item::PanelItem, state::WaylandState, surface::CORE_SURFACES};
|
use self::{panel_item::PanelItem, state::WaylandState, surface::CORE_SURFACES};
|
||||||
use crate::wayland::state::ClientState;
|
use crate::wayland::state::ClientState;
|
||||||
@@ -17,7 +16,7 @@ use once_cell::sync::OnceCell;
|
|||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use slog::Drain;
|
use slog::Drain;
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::{egl::EGLContext, renderer::{gles2::Gles2Renderer, ImportDma}},
|
backend::{egl::EGLContext, renderer::{gles2::Gles2Renderer}},
|
||||||
reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket, Resource},
|
reexports::wayland_server::{backend::GlobalId, Display, ListeningSocket, Resource},
|
||||||
};
|
};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
@@ -153,10 +152,7 @@ impl Wayland {
|
|||||||
.wl_surface()
|
.wl_surface()
|
||||||
.and_then(|surf| surf.client())
|
.and_then(|surf| surf.client())
|
||||||
.map(|c| c.id()) else { continue };
|
.map(|c| c.id()) else { continue };
|
||||||
let mut state = self.state.lock();
|
let state = self.state.lock();
|
||||||
for dmabuf in state.pending_dmabufs.drain(..) {
|
|
||||||
let _ = self.renderer.import_dmabuf(&dmabuf, None);
|
|
||||||
}
|
|
||||||
let Some(seat_data) = state.seats.get(&client_id).cloned() else { continue };
|
let Some(seat_data) = state.seats.get(&client_id).cloned() else { continue };
|
||||||
let output = state.output.clone();
|
let output = state.output.clone();
|
||||||
core_surface.process(
|
core_surface.process(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use smithay::{
|
|||||||
allocator::dmabuf::Dmabuf,
|
allocator::dmabuf::Dmabuf,
|
||||||
renderer::{gles2::Gles2Renderer, ImportDma},
|
renderer::{gles2::Gles2Renderer, ImportDma},
|
||||||
},
|
},
|
||||||
delegate_output, delegate_shm,
|
delegate_dmabuf, delegate_output, delegate_shm,
|
||||||
output::{Mode, Output, Scale, Subpixel},
|
output::{Mode, Output, Scale, Subpixel},
|
||||||
reexports::{
|
reexports::{
|
||||||
wayland_protocols_misc::server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as DecorationMode,
|
wayland_protocols_misc::server_decoration::server::org_kde_kwin_server_decoration_manager::Mode as DecorationMode,
|
||||||
@@ -21,7 +21,7 @@ use smithay::{
|
|||||||
wayland::{
|
wayland::{
|
||||||
buffer::BufferHandler,
|
buffer::BufferHandler,
|
||||||
compositor::CompositorState,
|
compositor::CompositorState,
|
||||||
dmabuf::{DmabufGlobal, DmabufState},
|
dmabuf::{self, DmabufGlobal, DmabufHandler, DmabufState},
|
||||||
output::OutputManagerState,
|
output::OutputManagerState,
|
||||||
shell::{
|
shell::{
|
||||||
kde::decoration::KdeDecorationState,
|
kde::decoration::KdeDecorationState,
|
||||||
@@ -157,5 +157,19 @@ impl ShmHandler for WaylandState {
|
|||||||
&self.shm_state
|
&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_shm!(WaylandState);
|
||||||
delegate_output!(WaylandState);
|
delegate_output!(WaylandState);
|
||||||
|
|||||||
Reference in New Issue
Block a user