From b91c42aa38b2610c03c546f484b90b695066a6a7 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Wed, 5 Feb 2025 14:00:06 +0100 Subject: [PATCH] screencast: always use actual width/height for test allocations Some formats/modifiers only work up to a certain size. Using 1x1 would yield combinations that won't actually work for the screencast. --- src/portal/ptl_screencast.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/portal/ptl_screencast.rs b/src/portal/ptl_screencast.rs index d27be66d..d1c1bbc2 100644 --- a/src/portal/ptl_screencast.rs +++ b/src/portal/ptl_screencast.rs @@ -264,7 +264,7 @@ impl PwClientNodeOwner for StartedScreencast { }; let modifier; let planes; - match self.allocate_buffer(fmt, modifiers, 1, 1) { + match self.allocate_buffer(fmt, modifiers) { Ok(bo) => { let dmabuf = bo.dmabuf(); modifier = dmabuf.modifier; @@ -309,12 +309,7 @@ impl PwClientNodeOwner for StartedScreencast { self.dpy.con.remove_obj(&*buffer); } for _ in 0..self.port.buffers.borrow().len() { - let res = self.allocate_buffer( - self.format.get(), - &[self.modifier.get()], - self.width.get(), - self.height.get(), - ); + let res = self.allocate_buffer(self.format.get(), &[self.modifier.get()]); match res { Ok(b) => { let params = dmabuf.create_params(); @@ -364,8 +359,6 @@ impl StartedScreencast { &self, format: &'static Format, modifiers: &[Modifier], - width: i32, - height: i32, ) -> Result, BufferAllocationError> { let Some(ctx) = self.dpy.render_ctx.get() else { return Err(BufferAllocationError::NoRenderContext); @@ -387,8 +380,8 @@ impl StartedScreencast { } let buffer = ctx.ctx.ctx.allocator().create_bo( &self.dpy.state.dma_buf_ids, - width, - height, + self.width.get(), + self.height.get(), format, modifiers, usage,