1
0
Fork 0
forked from wry/wry

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.
This commit is contained in:
Julian Orth 2025-02-05 14:00:06 +01:00
parent 36a43c1459
commit b91c42aa38

View file

@ -264,7 +264,7 @@ impl PwClientNodeOwner for StartedScreencast {
}; };
let modifier; let modifier;
let planes; let planes;
match self.allocate_buffer(fmt, modifiers, 1, 1) { match self.allocate_buffer(fmt, modifiers) {
Ok(bo) => { Ok(bo) => {
let dmabuf = bo.dmabuf(); let dmabuf = bo.dmabuf();
modifier = dmabuf.modifier; modifier = dmabuf.modifier;
@ -309,12 +309,7 @@ impl PwClientNodeOwner for StartedScreencast {
self.dpy.con.remove_obj(&*buffer); self.dpy.con.remove_obj(&*buffer);
} }
for _ in 0..self.port.buffers.borrow().len() { for _ in 0..self.port.buffers.borrow().len() {
let res = self.allocate_buffer( let res = self.allocate_buffer(self.format.get(), &[self.modifier.get()]);
self.format.get(),
&[self.modifier.get()],
self.width.get(),
self.height.get(),
);
match res { match res {
Ok(b) => { Ok(b) => {
let params = dmabuf.create_params(); let params = dmabuf.create_params();
@ -364,8 +359,6 @@ impl StartedScreencast {
&self, &self,
format: &'static Format, format: &'static Format,
modifiers: &[Modifier], modifiers: &[Modifier],
width: i32,
height: i32,
) -> Result<Rc<dyn BufferObject>, BufferAllocationError> { ) -> Result<Rc<dyn BufferObject>, BufferAllocationError> {
let Some(ctx) = self.dpy.render_ctx.get() else { let Some(ctx) = self.dpy.render_ctx.get() else {
return Err(BufferAllocationError::NoRenderContext); return Err(BufferAllocationError::NoRenderContext);
@ -387,8 +380,8 @@ impl StartedScreencast {
} }
let buffer = ctx.ctx.ctx.allocator().create_bo( let buffer = ctx.ctx.ctx.allocator().create_bo(
&self.dpy.state.dma_buf_ids, &self.dpy.state.dma_buf_ids,
width, self.width.get(),
height, self.height.get(),
format, format,
modifiers, modifiers,
usage, usage,