vulkan: split spa_vulkan_use_buffers into separate allocation and import functions

This commit add helpers to create and to import a DmaBuf via the
external_dmabuf_info struct.
The import path is based on the image creation of wlroots and the create path is
inspired by the wlroots vulkan allocator MR.
This commit is contained in:
columbarius 2023-08-10 04:03:08 +02:00 committed by Wim Taymans
parent 2068972bb3
commit 35b080ec61
3 changed files with 301 additions and 106 deletions

View file

@ -2,6 +2,8 @@
/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#pragma once
#include <vulkan/vulkan.h>
#include <spa/buffer/buffer.h>
@ -34,6 +36,17 @@
return _res; \
}
struct external_dmabuf_info {
VkFormat format;
uint64_t modifier;
struct spa_rectangle size;
VkImageUsageFlags usage;
struct spa_buffer *spa_buf;
};
int vulkan_create_dmabuf(struct vulkan_base *s, struct external_dmabuf_info *info, struct vulkan_buffer *vk_buf);
int vulkan_import_dmabuf(struct vulkan_base *s, struct external_dmabuf_info *info, struct vulkan_buffer *vk_buf);
int vulkan_commandPool_create(struct vulkan_base *s, VkCommandPool *commandPool);
int vulkan_commandBuffer_create(struct vulkan_base *s, VkCommandPool commandPool, VkCommandBuffer *commandBuffer);