Add dmabuf protocol handler
Not used yet.
This commit is contained in:
parent
b1d986ee71
commit
9a822bd76d
4 changed files with 64 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -734,6 +734,7 @@ dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"libcosmic",
|
"libcosmic",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"wayland-protocols 0.31.0",
|
||||||
"zbus",
|
"zbus",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ env_logger = "0.10.0"
|
||||||
futures-channel = "0.3.25"
|
futures-channel = "0.3.25"
|
||||||
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["tokio", "wayland"] }
|
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = ["tokio", "wayland"] }
|
||||||
tokio = "1.23.0"
|
tokio = "1.23.0"
|
||||||
|
wayland-protocols = "0.31.0"
|
||||||
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
zbus = { version = "3.7.0", default-features = false, features = ["tokio"] }
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
|
|
|
||||||
53
src/wayland/dmabuf.rs
Normal file
53
src/wayland/dmabuf.rs
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
use cctk::{
|
||||||
|
sctk::{
|
||||||
|
self,
|
||||||
|
dmabuf::{DmabufFeedback, DmabufHandler, DmabufState},
|
||||||
|
},
|
||||||
|
wayland_client::{protocol::wl_buffer, Connection, QueueHandle},
|
||||||
|
};
|
||||||
|
|
||||||
|
use wayland_protocols::wp::linux_dmabuf::zv1::client::{
|
||||||
|
zwp_linux_buffer_params_v1::ZwpLinuxBufferParamsV1,
|
||||||
|
zwp_linux_dmabuf_feedback_v1::ZwpLinuxDmabufFeedbackV1,
|
||||||
|
};
|
||||||
|
|
||||||
|
use super::AppData;
|
||||||
|
|
||||||
|
impl DmabufHandler for AppData {
|
||||||
|
fn dmabuf_state(&mut self) -> &mut DmabufState {
|
||||||
|
&mut self.dmabuf_state
|
||||||
|
}
|
||||||
|
fn dmabuf_feedback(
|
||||||
|
&mut self,
|
||||||
|
_conn: &Connection,
|
||||||
|
_qh: &QueueHandle<Self>,
|
||||||
|
_proxy: &ZwpLinuxDmabufFeedbackV1,
|
||||||
|
feedback: DmabufFeedback,
|
||||||
|
) {
|
||||||
|
self.dmabuf_feedback = Some(feedback);
|
||||||
|
}
|
||||||
|
fn created(
|
||||||
|
&mut self,
|
||||||
|
_conn: &Connection,
|
||||||
|
_qh: &QueueHandle<Self>,
|
||||||
|
_params: &ZwpLinuxBufferParamsV1,
|
||||||
|
_buffer: wl_buffer::WlBuffer,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
fn failed(
|
||||||
|
&mut self,
|
||||||
|
_conn: &Connection,
|
||||||
|
_qh: &QueueHandle<Self>,
|
||||||
|
_params: &ZwpLinuxBufferParamsV1,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
fn released(
|
||||||
|
&mut self,
|
||||||
|
_conn: &Connection,
|
||||||
|
_qh: &QueueHandle<Self>,
|
||||||
|
_buffer: &wl_buffer::WlBuffer,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sctk::delegate_dmabuf!(AppData);
|
||||||
|
|
@ -15,6 +15,7 @@ use cctk::{
|
||||||
screencopy::ScreencopyState,
|
screencopy::ScreencopyState,
|
||||||
sctk::{
|
sctk::{
|
||||||
self,
|
self,
|
||||||
|
dmabuf::{DmabufFeedback, DmabufState},
|
||||||
reexports::calloop_wayland_source::WaylandSource,
|
reexports::calloop_wayland_source::WaylandSource,
|
||||||
registry::{ProvidesRegistryState, RegistryState},
|
registry::{ProvidesRegistryState, RegistryState},
|
||||||
seat::{SeatHandler, SeatState},
|
seat::{SeatHandler, SeatState},
|
||||||
|
|
@ -46,6 +47,7 @@ mod buffer;
|
||||||
use buffer::Buffer;
|
use buffer::Buffer;
|
||||||
mod capture;
|
mod capture;
|
||||||
use capture::{Capture, CaptureSource};
|
use capture::{Capture, CaptureSource};
|
||||||
|
mod dmabuf;
|
||||||
mod screencopy;
|
mod screencopy;
|
||||||
mod toplevel;
|
mod toplevel;
|
||||||
mod workspace;
|
mod workspace;
|
||||||
|
|
@ -92,6 +94,7 @@ pub enum Cmd {
|
||||||
|
|
||||||
pub struct AppData {
|
pub struct AppData {
|
||||||
qh: QueueHandle<Self>,
|
qh: QueueHandle<Self>,
|
||||||
|
dmabuf_state: DmabufState,
|
||||||
registry_state: RegistryState,
|
registry_state: RegistryState,
|
||||||
toplevel_info_state: ToplevelInfoState,
|
toplevel_info_state: ToplevelInfoState,
|
||||||
workspace_state: WorkspaceState,
|
workspace_state: WorkspaceState,
|
||||||
|
|
@ -103,6 +106,7 @@ pub struct AppData {
|
||||||
seats: Vec<wl_seat::WlSeat>,
|
seats: Vec<wl_seat::WlSeat>,
|
||||||
capture_filter: CaptureFilter,
|
capture_filter: CaptureFilter,
|
||||||
captures: RefCell<HashMap<CaptureSource, Arc<Capture>>>,
|
captures: RefCell<HashMap<CaptureSource, Arc<Capture>>>,
|
||||||
|
dmabuf_feedback: Option<DmabufFeedback>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppData {
|
impl AppData {
|
||||||
|
|
@ -224,9 +228,13 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
||||||
let (globals, event_queue) = registry_queue_init(&conn).unwrap();
|
let (globals, event_queue) = registry_queue_init(&conn).unwrap();
|
||||||
let qh = event_queue.handle();
|
let qh = event_queue.handle();
|
||||||
|
|
||||||
|
let dmabuf_state = DmabufState::new(&globals, &qh);
|
||||||
|
dmabuf_state.get_default_feedback(&qh).unwrap();
|
||||||
|
|
||||||
let registry_state = RegistryState::new(&globals);
|
let registry_state = RegistryState::new(&globals);
|
||||||
let mut app_data = AppData {
|
let mut app_data = AppData {
|
||||||
qh: qh.clone(),
|
qh: qh.clone(),
|
||||||
|
dmabuf_state,
|
||||||
workspace_state: WorkspaceState::new(®istry_state, &qh), // Create before toplevel info state
|
workspace_state: WorkspaceState::new(®istry_state, &qh), // Create before toplevel info state
|
||||||
toplevel_info_state: ToplevelInfoState::new(®istry_state, &qh),
|
toplevel_info_state: ToplevelInfoState::new(®istry_state, &qh),
|
||||||
toplevel_manager_state: ToplevelManagerState::new(®istry_state, &qh),
|
toplevel_manager_state: ToplevelManagerState::new(®istry_state, &qh),
|
||||||
|
|
@ -238,6 +246,7 @@ fn start(conn: Connection) -> mpsc::Receiver<Event> {
|
||||||
seats: Vec::new(),
|
seats: Vec::new(),
|
||||||
capture_filter: CaptureFilter::default(),
|
capture_filter: CaptureFilter::default(),
|
||||||
captures: RefCell::new(HashMap::new()),
|
captures: RefCell::new(HashMap::new()),
|
||||||
|
dmabuf_feedback: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
app_data.send_event(Event::Seats(app_data.seat_state.seats().collect()));
|
app_data.send_event(Event::Seats(app_data.seat_state.seats().collect()));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue