mirror of
https://github.com/Smithay/smithay.git
synced 2024-09-28 03:21:14 +02:00
allocator/vulkan: Don't create multiple OwnedFd
from one RawFd
Some checks failed
Continuous Integration / format (push) Has been cancelled
Continuous Integration / clippy-check (push) Has been cancelled
Continuous Integration / smithay-check-features (push) Has been cancelled
Continuous Integration / check-msrv (push) Has been cancelled
Continuous Integration / check-minimal (push) Has been cancelled
Continuous Integration / smithay-tests (push) Has been cancelled
Continuous Integration / smallvil-check (push) Has been cancelled
Continuous Integration / anvil-check-features (push) Has been cancelled
Continuous Integration / WLCS: Bad Buffer Test (push) Has been cancelled
Continuous Integration / WLCS: Core tests (push) Has been cancelled
Continuous Integration / WLCS: Output tests (push) Has been cancelled
Continuous Integration / WLCS: Pointer input tests (push) Has been cancelled
Continuous Integration / Documentation on Github Pages (push) Has been cancelled
Some checks failed
Continuous Integration / format (push) Has been cancelled
Continuous Integration / clippy-check (push) Has been cancelled
Continuous Integration / smithay-check-features (push) Has been cancelled
Continuous Integration / check-msrv (push) Has been cancelled
Continuous Integration / check-minimal (push) Has been cancelled
Continuous Integration / smithay-tests (push) Has been cancelled
Continuous Integration / smallvil-check (push) Has been cancelled
Continuous Integration / anvil-check-features (push) Has been cancelled
Continuous Integration / WLCS: Bad Buffer Test (push) Has been cancelled
Continuous Integration / WLCS: Core tests (push) Has been cancelled
Continuous Integration / WLCS: Output tests (push) Has been cancelled
Continuous Integration / WLCS: Pointer input tests (push) Has been cancelled
Continuous Integration / Documentation on Github Pages (push) Has been cancelled
Fixes `fatal runtime error: IO Safety violation: owned file descriptor already closed` error in X11 backend on debug build with Rust 1.80. And presumably other issues.
This commit is contained in:
parent
e7f08570bc
commit
c542d097b9
1 changed files with 3 additions and 2 deletions
|
@ -447,6 +447,8 @@ impl AsDmabuf for VulkanImage {
|
|||
.memory(self.inner.memory);
|
||||
|
||||
let fd = unsafe { self.khr_external_memory_fd.get_memory_fd(&create_info) }?;
|
||||
// SAFETY: `vkGetMemoryFdKHR` creates a new file descriptor owned by the caller.
|
||||
let fd = unsafe { OwnedFd::from_raw_fd(fd) };
|
||||
let mut builder = Dmabuf::builder(
|
||||
self.size(),
|
||||
self.format().code,
|
||||
|
@ -469,8 +471,7 @@ impl AsDmabuf for VulkanImage {
|
|||
let subresource = vk::ImageSubresource::default().aspect_mask(aspect_mask);
|
||||
let layout = unsafe { device.get_image_subresource_layout(self.inner.image, subresource) };
|
||||
builder.add_plane(
|
||||
// SAFETY: `vkGetMemoryFdKHR` creates a new file descriptor owned by the caller.
|
||||
unsafe { OwnedFd::from_raw_fd(fd) },
|
||||
fd.try_clone().or(Err(ExportError::Failed))?,
|
||||
idx,
|
||||
layout.offset as u32,
|
||||
layout.row_pitch as u32,
|
||||
|
|
Loading…
Reference in a new issue