Skip to content

Commit

Permalink
vulkan: attach last-use-syncfile to internal framebuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
mahkoh committed Oct 8, 2024
1 parent cc8db84 commit 901a0fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/gfx_apis/vulkan/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -824,11 +824,18 @@ impl VulkanRenderer {
if attach_async_shm_sync_file {
if let VulkanImageMemory::Internal(shm) = &texture.tex.ty {
if let Some(data) = &shm.async_data {
data.last_sample.set(Some(sync_file.clone()));
data.last_gfx_use.set(Some(sync_file.clone()));
}
}
}
}
if attach_async_shm_sync_file {
if let VulkanImageMemory::Internal(shm) = &fb.ty {
if let Some(data) = &shm.async_data {
data.last_gfx_use.set(Some(sync_file.clone()));
}
}
}
import(fb, fb_release_sync, None, DMA_BUF_SYNC_WRITE);
}

Expand Down
2 changes: 1 addition & 1 deletion src/gfx_apis/vulkan/shm_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ impl VulkanRenderer {
callback_id: Cell::new(0),
regions: Default::default(),
cpu: cpu.clone(),
last_sample: Default::default(),
last_gfx_use: Default::default(),
data_copied: Default::default(),
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/gfx_apis/vulkan/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub struct VulkanShmImageAsyncData {
pub(super) callback_id: Cell<u64>,
pub(super) regions: RefCell<Vec<BufferImageCopy2<'static>>>,
pub(super) cpu: Rc<CpuWorker>,
pub(super) last_sample: Cell<Option<SyncFile>>,
pub(super) last_gfx_use: Cell<Option<SyncFile>>,
pub(super) data_copied: Cell<bool>,
}

Expand Down Expand Up @@ -215,7 +215,7 @@ impl VulkanShmImage {
img.renderer.check_defunct()?;
let Some(transfer_queue_idx) = img.renderer.device.distinct_transfer_queue_family_idx
else {
let Some(sync_file) = data.last_sample.take() else {
let Some(sync_file) = data.last_gfx_use.take() else {
img.queue_state.set(QueueState::Released {
to: QueueFamily::Transfer,
});
Expand Down

0 comments on commit 901a0fe

Please sign in to comment.