1
0
Fork 0
forked from wry/wry

all: simplify handling of Errno values

This commit is contained in:
Julian Orth 2026-04-02 18:34:12 +02:00
parent 9c605df692
commit 34914eccb0
58 changed files with 443 additions and 464 deletions

View file

@ -10,7 +10,7 @@ use {
device::VulkanDevice, format::VulkanFormat, renderer::image_barrier,
staging::VulkanStagingBuffer,
},
utils::errorfmt::ErrorFmt,
utils::{errorfmt::ErrorFmt, oserror::OsErrorExt2},
video::{
Modifier,
dmabuf::{DmaBuf, DmaBufIds, DmaBufPlane, PlaneVec},
@ -379,7 +379,7 @@ impl VulkanBoAllocator {
.find_memory_type(MemoryPropertyFlags::empty(), memory_type_bits)
.ok_or(VulkanError::MemoryType)?;
let fd = uapi::fcntl_dupfd_cloexec(dma_buf_plane.fd.raw(), 0)
.map_err(|e| VulkanError::Dupfd(e.into()))?;
.map_os_err(VulkanError::Dupfd)?;
let mut memory_dedicated_allocate_info =
MemoryDedicatedAllocateInfo::default().image(image);
let mut import_memory_fd_info = ImportMemoryFdInfoKHR::default()

View file

@ -8,7 +8,7 @@ use {
format::{VulkanBlendBufferLimits, VulkanFormat},
instance::VulkanInstance,
},
utils::bitflags::BitflagsExt,
utils::{bitflags::BitflagsExt, oserror::OsErrorExt2},
video::{
dmabuf::DmaBufIds,
drm::{Drm, syncobj::SyncobjCtx},
@ -484,8 +484,8 @@ impl VulkanInstance {
GBM_BO_USE_RENDERING,
)
.map_err(VulkanError::AllocGbm)?;
let fl = uapi::fcntl_getfl(bo.dmabuf().planes[0].fd.raw())
.map_err(|e| VulkanError::GetFl(e.into()))?;
let fl =
uapi::fcntl_getfl(bo.dmabuf().planes[0].fd.raw()).map_os_err(VulkanError::GetFl)?;
if fl.not_contains(O_RDWR) {
return Err(VulkanError::SoftwareRendererNotUsable);
}

View file

@ -3,6 +3,7 @@ use {
format::Format,
gfx_api::GfxBuffer,
gfx_apis::vulkan::{VulkanError, device::VulkanDevice},
utils::oserror::OsErrorExt2,
},
ash::{
Device,
@ -70,8 +71,7 @@ impl VulkanDevice {
let Some(memory_type) = memory_type else {
return Err(VulkanError::MemoryType);
};
let fd =
uapi::fcntl_dupfd_cloexec(dmabuf.raw(), 0).map_err(|e| VulkanError::Dupfd(e.into()))?;
let fd = uapi::fcntl_dupfd_cloexec(dmabuf.raw(), 0).map_os_err(VulkanError::Dupfd)?;
let memory = {
let mut dedicated = MemoryDedicatedAllocateInfo::default().buffer(buffer);
let mut import_info = ImportMemoryFdInfoKHR::default()

View file

@ -15,6 +15,7 @@ use {
},
rect::Region,
theme::Color,
utils::oserror::OsErrorExt2,
video::dmabuf::{DmaBuf, PlaneVec},
},
ash::vk::{
@ -403,7 +404,7 @@ impl VulkanDmaBufImageTemplate {
.find_memory_type(MemoryPropertyFlags::empty(), memory_type_bits)
.ok_or(VulkanError::MemoryType)?;
let fd = uapi::fcntl_dupfd_cloexec(dma_buf_plane.fd.raw(), 0)
.map_err(|e| VulkanError::Dupfd(e.into()))?;
.map_os_err(VulkanError::Dupfd)?;
let mut memory_dedicated_allocate_info =
MemoryDedicatedAllocateInfo::default().image(image);
let mut import_memory_fd_info = ImportMemoryFdInfoKHR::default()

View file

@ -37,7 +37,7 @@ use {
theme::Color,
utils::{
copyhashmap::CopyHashMap, errorfmt::ErrorFmt, numcell::NumCell, ordered_float::F32,
stack::Stack,
oserror::OsErrorExt2, stack::Stack,
},
video::dmabuf::{DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, dma_buf_export_sync_file},
vulkan_core::{
@ -1689,7 +1689,7 @@ impl VulkanRenderer {
AcquireSync::FdSync(sync) => {
if let Some(sync_file) = sync.get_sync_file() {
let fd = uapi::fcntl_dupfd_cloexec(sync_file.raw(), 0)
.map_err(|e| VulkanError::Dupfd(e.into()))?;
.map_os_err(VulkanError::Dupfd)?;
import_sync_file(fd)?;
}
}