1
0
Fork 0
forked from wry/wry

vulkan: import wl_shm buffers as udmabuf

This commit is contained in:
Julian Orth 2025-09-30 18:52:57 +02:00
parent 47e15c6083
commit a3d3a62af3
14 changed files with 545 additions and 99 deletions

View file

@ -6,6 +6,7 @@ mod command;
mod descriptor;
mod descriptor_buffer;
mod device;
mod dmabuf_buffer;
mod eotfs;
mod fence;
mod format;
@ -27,9 +28,9 @@ use {
cpu_worker::{CpuWorker, jobs::read_write::ReadWriteJobError},
format::Format,
gfx_api::{
AsyncShmGfxTexture, GfxBlendBuffer, GfxContext, GfxError, GfxFormat, GfxImage,
GfxInternalFramebuffer, GfxStagingBuffer, GfxTexture, ResetStatus, STAGING_DOWNLOAD,
STAGING_UPLOAD, ShmGfxTexture, StagingBufferUsecase,
AsyncShmGfxTexture, GfxBlendBuffer, GfxBuffer, GfxContext, GfxError, GfxFormat,
GfxImage, GfxInternalFramebuffer, GfxStagingBuffer, GfxTexture, ResetStatus,
STAGING_DOWNLOAD, STAGING_UPLOAD, ShmGfxTexture, StagingBufferUsecase,
},
gfx_apis::vulkan::{
image::VulkanImageMemory, instance::VulkanInstance, renderer::VulkanRenderer,
@ -57,7 +58,7 @@ use {
sync::Arc,
},
thiserror::Error,
uapi::c::dev_t,
uapi::{OwnedFd, c::dev_t},
};
#[derive(Debug, Error)]
@ -394,6 +395,20 @@ impl GfxContext for Context {
fn supports_color_management(&self) -> bool {
self.0.device.descriptor_buffer.is_some()
}
fn create_dmabuf_buffer(
&self,
dmabuf: &Rc<OwnedFd>,
offset: usize,
size: usize,
) -> Result<Rc<dyn GfxBuffer>, GfxError> {
self.0.check_defunct()?;
let buffer = self
.0
.device
.create_dmabuf_buffer(dmabuf, offset as u64, size as u64)?;
Ok(buffer)
}
}
impl Drop for Context {