wl_buffer: remember client dmabuf when converting udmabuf to shm
This commit is contained in:
parent
7122b89cb9
commit
d90ddba50a
5 changed files with 12 additions and 9 deletions
|
|
@ -54,7 +54,7 @@ pub struct WlBuffer {
|
|||
pub client: Rc<Client>,
|
||||
pub rect: Rect,
|
||||
pub format: &'static Format,
|
||||
pub dmabuf: Option<DmaBuf>,
|
||||
pub client_dmabuf: Option<DmaBuf>,
|
||||
render_ctx_version: Cell<u32>,
|
||||
pub storage: RefCell<Option<WlBufferStorage>>,
|
||||
shm: bool,
|
||||
|
|
@ -80,7 +80,7 @@ impl WlBuffer {
|
|||
format: &'static Format,
|
||||
width: i32,
|
||||
height: i32,
|
||||
dmabuf: Option<DmaBuf>,
|
||||
client_dmabuf: Option<DmaBuf>,
|
||||
storage: Option<WlBufferStorage>,
|
||||
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<Client>,
|
||||
format: &'static Format,
|
||||
dmabuf: DmaBuf,
|
||||
client_dmabuf: DmaBuf,
|
||||
img: &Rc<dyn GfxImage>,
|
||||
) -> Rc<Self> {
|
||||
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<DmaBuf>,
|
||||
stride: i32,
|
||||
format: &'static Format,
|
||||
mem: &Rc<ClientMem>,
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ impl WlShmPoolRequestHandler for WlShmPool {
|
|||
req.offset as usize,
|
||||
req.width,
|
||||
req.height,
|
||||
None,
|
||||
req.stride,
|
||||
format,
|
||||
&self.mem.get(),
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
p.offset as usize,
|
||||
dmabuf.width,
|
||||
dmabuf.height,
|
||||
Some(dmabuf.clone()),
|
||||
p.stride as _,
|
||||
format.format,
|
||||
&client_mem,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue