vulkan: enforce that dmabuf buffers are aligned to 4 bytes
This commit is contained in:
parent
3e52e4266f
commit
09a56edd47
2 changed files with 7 additions and 0 deletions
|
|
@ -16,6 +16,8 @@ use {
|
|||
uapi::OwnedFd,
|
||||
};
|
||||
|
||||
pub(super) const TRANSFER_QUEUE_BUFFER_ALIGNMENT: u64 = 4;
|
||||
|
||||
pub struct VulkanDmabufBuffer {
|
||||
pub(super) device: Rc<VulkanDevice>,
|
||||
pub(super) size: u64,
|
||||
|
|
@ -31,6 +33,9 @@ impl VulkanDevice {
|
|||
offset: u64,
|
||||
size: u64,
|
||||
) -> Result<Rc<VulkanDmabufBuffer>, VulkanError> {
|
||||
if offset % TRANSFER_QUEUE_BUFFER_ALIGNMENT != 0 {
|
||||
return Err(VulkanError::DmaBufBufferOffsetAlignment);
|
||||
}
|
||||
let mut memory_fd_properties = MemoryFdPropertiesKHR::default();
|
||||
unsafe {
|
||||
self.external_memory_fd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue