diff --git a/src/ifs/wl_buffer.rs b/src/ifs/wl_buffer.rs index 47a9612f..c698eef1 100644 --- a/src/ifs/wl_buffer.rs +++ b/src/ifs/wl_buffer.rs @@ -54,7 +54,7 @@ pub struct WlBuffer { pub client: Rc, pub rect: Rect, pub format: &'static Format, - pub dmabuf: Option, + pub client_dmabuf: Option, render_ctx_version: Cell, pub storage: RefCell>, shm: bool, @@ -80,7 +80,7 @@ impl WlBuffer { format: &'static Format, width: i32, height: i32, - dmabuf: Option, + client_dmabuf: Option, storage: Option, shm: bool, color: Option<[u32; 4]>, @@ -93,7 +93,7 @@ impl WlBuffer { format, width, height, - dmabuf, + client_dmabuf, render_ctx_version: Cell::new(client.state.render_ctx_version.get()), storage: RefCell::new(storage), shm, @@ -109,7 +109,7 @@ impl WlBuffer { id: WlBufferId, client: &Rc, format: &'static Format, - dmabuf: DmaBuf, + client_dmabuf: DmaBuf, img: &Rc, ) -> Rc { Self::new( @@ -118,7 +118,7 @@ impl WlBuffer { format, img.width(), img.height(), - Some(dmabuf), + Some(client_dmabuf), Some(WlBufferStorage::Dmabuf { img: img.clone(), tex: None, @@ -136,6 +136,7 @@ impl WlBuffer { offset: usize, width: i32, height: i32, + client_dmabuf: Option, stride: i32, format: &'static Format, mem: &Rc, @@ -182,7 +183,7 @@ impl WlBuffer { format, width, height, - None, + client_dmabuf, Some(WlBufferStorage::Shm { dmabuf_buffer_params, mem, @@ -256,7 +257,7 @@ impl WlBuffer { let Some(ctx) = self.client.state.render_ctx.get() else { return false; }; - let Some(dmabuf) = &self.dmabuf else { + let Some(dmabuf) = &self.client_dmabuf else { return false; }; let img = match ctx.dmabuf_img(dmabuf) { diff --git a/src/ifs/wl_shm_pool.rs b/src/ifs/wl_shm_pool.rs index fbfec69b..6f037dbe 100644 --- a/src/ifs/wl_shm_pool.rs +++ b/src/ifs/wl_shm_pool.rs @@ -68,6 +68,7 @@ impl WlShmPoolRequestHandler for WlShmPool { req.offset as usize, req.width, req.height, + None, req.stride, format, &self.mem.get(), diff --git a/src/ifs/wl_surface.rs b/src/ifs/wl_surface.rs index 343d78bb..c1d9b93d 100644 --- a/src/ifs/wl_surface.rs +++ b/src/ifs/wl_surface.rs @@ -252,7 +252,7 @@ impl Drop for SurfaceBuffer { } return; } - if let Some(dmabuf) = &self.buffer.dmabuf { + if let Some(dmabuf) = &self.buffer.client_dmabuf { for (_, sync_file) in &sync_files { if let Err(e) = dmabuf.import_sync_file(DMA_BUF_SYNC_READ, sync_file) { log::error!("Could not import sync file: {}", ErrorFmt(e)); diff --git a/src/ifs/wl_surface/commit_timeline.rs b/src/ifs/wl_surface/commit_timeline.rs index a60bf33d..230e508b 100644 --- a/src/ifs/wl_surface/commit_timeline.rs +++ b/src/ifs/wl_surface/commit_timeline.rs @@ -703,7 +703,7 @@ impl CommitDataCollector { self.shm_uploads += 1; } if !pending.explicit_sync - && let Some(dmabuf) = &buffer.dmabuf + && let Some(dmabuf) = &buffer.client_dmabuf { for plane in &dmabuf.planes { self.implicit_dmabufs.push(plane.fd.clone()); diff --git a/src/ifs/zwp_linux_buffer_params_v1.rs b/src/ifs/zwp_linux_buffer_params_v1.rs index 269cd02c..13b62538 100644 --- a/src/ifs/zwp_linux_buffer_params_v1.rs +++ b/src/ifs/zwp_linux_buffer_params_v1.rs @@ -131,6 +131,7 @@ impl ZwpLinuxBufferParamsV1 { p.offset as usize, dmabuf.width, dmabuf.height, + Some(dmabuf.clone()), p.stride as _, format.format, &client_mem,