1
0
Fork 0
forked from wry/wry

video: add udmabuf allocator

This commit is contained in:
Julian Orth 2024-09-01 20:23:04 +02:00
parent 2579834a60
commit 62cd29056a
33 changed files with 883 additions and 256 deletions

View file

@ -9,13 +9,14 @@ use {
testrun::ParseFull,
},
utils::{buffd::MsgParser, cell_ext::CellExt},
video::dmabuf::DmaBuf,
wire::{
jay_compositor::{self, *},
jay_screenshot::Dmabuf,
JayCompositorId,
},
},
std::{cell::Cell, rc::Rc},
uapi::OwnedFd,
};
pub struct TestJayCompositor {
@ -49,10 +50,16 @@ impl TestJayCompositor {
Ok(())
}
pub async fn take_screenshot(&self, include_cursor: bool) -> Result<Dmabuf, TestError> {
pub async fn take_screenshot(
&self,
include_cursor: bool,
) -> Result<(DmaBuf, Option<Rc<OwnedFd>>), TestError> {
let js = Rc::new(TestJayScreenshot {
id: self.tran.id(),
result: Cell::new(None),
state: self.tran.run.state.clone(),
drm_dev: Default::default(),
planes: Default::default(),
result: Default::default(),
});
self.tran.send(TakeScreenshot2 {
self_id: self.id,
@ -62,7 +69,7 @@ impl TestJayCompositor {
self.tran.add_obj(js.clone())?;
self.tran.sync().await;
match js.result.take() {
Some(Ok(res)) => Ok(res),
Some(Ok(res)) => Ok((res, js.drm_dev.take())),
Some(Err(res)) => bail!("Compositor could not take a screenshot: {}", res),
None => bail!("Compositor did not send a screenshot"),
}