1
0
Fork 0
forked from wry/wry

dmabuf: optimize sync-file export/import

This commit is contained in:
Julian Orth 2025-10-01 23:37:04 +02:00
parent 0884a5c656
commit 86680e0cc8
2 changed files with 10 additions and 0 deletions

View file

@ -1649,6 +1649,9 @@ impl VulkanRenderer {
let fd = dma_buf_export_sync_file(&plane.fd, flag)
.map_err(VulkanError::IoctlExportSyncFile)?;
import_sync_file(fd)?;
if buf.template.dmabuf.is_one_file() {
break;
}
}
}
AcquireSync::SyncFile { sync_file } => {

View file

@ -60,6 +60,10 @@ impl DmaBuf {
})
}
pub fn is_one_file(&self) -> bool {
!self.is_disjoint()
}
pub fn udmabuf_size(&self) -> Option<usize> {
if self.planes.len() != 1 {
return None;
@ -103,6 +107,9 @@ impl DmaBuf {
pub fn import_sync_file(&self, flags: u32, sync_file: &OwnedFd) -> Result<(), OsError> {
for plane in &self.planes {
dma_buf_import_sync_file(&plane.fd, flags, sync_file)?;
if self.is_one_file() {
break;
}
}
Ok(())
}