1
0
Fork 0
forked from wry/wry

vulkan: use sync objects if possible

This commit is contained in:
Julian Orth 2026-03-01 17:25:40 +01:00
parent 2ac3519f2d
commit 3d3132fe39
23 changed files with 535 additions and 86 deletions

View file

@ -211,7 +211,10 @@ impl TestBackend {
};
}
let udmabuf = ("udmabuf", constructor!(Udmabuf::new()));
let vulkan = ("Vulkan", constructor!(create_vk_allocator(), nomap));
let vulkan = (
"Vulkan",
constructor!(create_vk_allocator(&self.state), nomap),
);
let gbm = ("GBM", constructor!(create_gbm_allocator()));
let allocators = match need_drm {
true => [vulkan, gbm, udmabuf],
@ -243,9 +246,10 @@ fn create_gbm_allocator() -> Result<GbmDevice, TestBackendError> {
create_drm_allocator(|drm| GbmDevice::new(&drm).map_err(TestBackendError::CreateGbmDevice))
}
fn create_vk_allocator() -> Result<Rc<dyn Allocator>, TestBackendError> {
fn create_vk_allocator(state: &State) -> Result<Rc<dyn Allocator>, TestBackendError> {
create_drm_allocator(|drm| {
create_vulkan_allocator(&drm).map_err(TestBackendError::CreateVulkanAllocator)
create_vulkan_allocator(&drm, &state.eventfd_cache)
.map_err(TestBackendError::CreateVulkanAllocator)
})
}

View file

@ -96,7 +96,12 @@ impl TestClient {
pub async fn take_screenshot(&self, include_cursor: bool) -> Result<Vec<u8>, TestError> {
let (dmabuf, dev) = self.jc.take_screenshot(include_cursor).await?;
let qoi = buf_to_bytes(dev.as_ref(), &dmabuf, ScreenshotFormat::Qoi)?;
let qoi = buf_to_bytes(
&self.run.state.eventfd_cache,
dev.as_ref(),
&dmabuf,
ScreenshotFormat::Qoi,
)?;
Ok(qoi)
}