FFmpeg
|
#include <dlfcn.h>
#include <unistd.h>
#include "config.h"
#include "pixdesc.h"
#include "avstring.h"
#include "imgutils.h"
#include "hwcontext.h"
#include "avassert.h"
#include "hwcontext_internal.h"
#include "hwcontext_vulkan.h"
#include "vulkan.h"
#include "vulkan_loader.h"
Go to the source code of this file.
Data Structures | |
struct | VulkanQueueCtx |
struct | VulkanExecCtx |
struct | VulkanDevicePriv |
struct | VulkanFramesPriv |
struct | AVVkFrameInternal |
struct | VulkanOptExtension |
struct | VulkanDeviceSelection |
struct | VulkanMapping |
struct | ImageBuffer |
Macros | |
#define | VK_NO_PROTOTYPES |
#define | VK_ENABLE_BETA_EXTENSIONS |
#define | ADD_VAL_TO_LIST(list, count, val) |
#define | RELEASE_PROPS(props, count) |
#define | CASE(VAL) case VAL: return #VAL |
#define | SETUP_QUEUE(qf_idx) |
#define | COPY_FEATURE(DST, NAME) (DST).features.NAME = dev_features.features.NAME; |
#define | CHECK_QUEUE(type, required, fidx, ctx_qf, qc) |
Enumerations | |
enum | PrepMode { PREP_MODE_WRITE, PREP_MODE_EXTERNAL_EXPORT, PREP_MODE_EXTERNAL_IMPORT } |
Functions | |
const VkFormat * | av_vkfmt_from_pixfmt (enum AVPixelFormat p) |
Returns the format of each image up to the number of planes for a given sw_format. More... | |
static const void * | vk_find_struct (const void *chain, VkStructureType stype) |
static void | vk_link_struct (void *chain, void *in) |
static int | pixfmt_is_supported (AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, int linear) |
static int | load_libvulkan (AVHWDeviceContext *ctx) |
static const char * | vk_ret2str (VkResult res) |
static VkBool32 | vk_dbg_callback (VkDebugUtilsMessageSeverityFlagBitsEXT severity, VkDebugUtilsMessageTypeFlagsEXT messageType, const VkDebugUtilsMessengerCallbackDataEXT *data, void *priv) |
static int | check_extensions (AVHWDeviceContext *ctx, int dev, AVDictionary *opts, const char *const **dst, uint32_t *num, int debug) |
static int | check_validation_layers (AVHWDeviceContext *ctx, AVDictionary *opts, const char *const **dst, uint32_t *num, int *debug_mode) |
static int | create_instance (AVHWDeviceContext *ctx, AVDictionary *opts) |
static const char * | vk_dev_type (enum VkPhysicalDeviceType type) |
static int | find_device (AVHWDeviceContext *ctx, VulkanDeviceSelection *select) |
static int | pick_queue_family (VkQueueFamilyProperties *qf, uint32_t num_qf, VkQueueFlagBits flags) |
static int | setup_queue_families (AVHWDeviceContext *ctx, VkDeviceCreateInfo *cd) |
static int | create_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd, int queue_family_index, int num_queues) |
static void | free_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd) |
static VkCommandBuffer | get_buf_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd) |
static void | unref_exec_ctx_deps (AVHWFramesContext *hwfc, VulkanExecCtx *cmd) |
static int | wait_start_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd) |
static int | add_buf_dep_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd, AVBufferRef *const *deps, int nb_deps) |
static int | submit_exec_ctx (AVHWFramesContext *hwfc, VulkanExecCtx *cmd, VkSubmitInfo *s_info, AVVkFrame *f, int synchronous) |
static void | vulkan_device_free (AVHWDeviceContext *ctx) |
static int | vulkan_device_create_internal (AVHWDeviceContext *ctx, VulkanDeviceSelection *dev_select, AVDictionary *opts, int flags) |
static int | vulkan_device_init (AVHWDeviceContext *ctx) |
static int | vulkan_device_create (AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags) |
static int | vulkan_device_derive (AVHWDeviceContext *ctx, AVHWDeviceContext *src_ctx, AVDictionary *opts, int flags) |
static int | vulkan_frames_get_constraints (AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints) |
static int | alloc_mem (AVHWDeviceContext *ctx, VkMemoryRequirements *req, VkMemoryPropertyFlagBits req_flags, const void *alloc_extension, VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem) |
static void | vulkan_free_internal (AVVkFrame *f) |
static void | vulkan_frame_free (void *opaque, uint8_t *data) |
static int | alloc_bind_mem (AVHWFramesContext *hwfc, AVVkFrame *f, void *alloc_pnext, size_t alloc_pnext_stride) |
static int | prepare_frame (AVHWFramesContext *hwfc, VulkanExecCtx *ectx, AVVkFrame *frame, enum PrepMode pmode) |
static void | get_plane_wh (int *w, int *h, enum AVPixelFormat format, int frame_w, int frame_h, int plane) |
static int | create_frame (AVHWFramesContext *hwfc, AVVkFrame **frame, VkImageTiling tiling, VkImageUsageFlagBits usage, void *create_pnext) |
static void | try_export_flags (AVHWFramesContext *hwfc, VkExternalMemoryHandleTypeFlags *comp_handle_types, VkExternalMemoryHandleTypeFlagBits *iexp, VkExternalMemoryHandleTypeFlagBits exp) |
static AVBufferRef * | vulkan_pool_alloc (void *opaque, size_t size) |
static void | vulkan_frames_uninit (AVHWFramesContext *hwfc) |
static int | vulkan_frames_init (AVHWFramesContext *hwfc) |
static int | vulkan_get_buffer (AVHWFramesContext *hwfc, AVFrame *frame) |
static int | vulkan_transfer_get_formats (AVHWFramesContext *hwfc, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats) |
static void | vulkan_unmap_frame (AVHWFramesContext *hwfc, HWMapDescriptor *hwmap) |
static int | vulkan_map_frame_to_mem (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) |
static int | vulkan_map_to (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) |
static int | vulkan_map_from (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags) |
static void | free_buf (void *opaque, uint8_t *data) |
static size_t | get_req_buffer_size (VulkanDevicePriv *p, int *stride, int height) |
static int | create_buf (AVHWDeviceContext *ctx, AVBufferRef **buf, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags, size_t size, uint32_t req_memory_bits, int host_mapped, void *create_pnext, void *alloc_pnext) |
static int | map_buffers (AVHWDeviceContext *ctx, AVBufferRef **bufs, uint8_t *mem[], int nb_buffers, int invalidate) |
static int | unmap_buffers (AVHWDeviceContext *ctx, AVBufferRef **bufs, int nb_buffers, int flush) |
static int | transfer_image_buf (AVHWFramesContext *hwfc, const AVFrame *f, AVBufferRef **bufs, size_t *buf_offsets, const int *buf_stride, int w, int h, enum AVPixelFormat pix_fmt, int to_buf) |
static int | vulkan_transfer_data (AVHWFramesContext *hwfc, const AVFrame *vkf, const AVFrame *swf, int from) |
static int | vulkan_transfer_data_to (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) |
static int | vulkan_transfer_data_from (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) |
static int | vulkan_frames_derive_to (AVHWFramesContext *dst_fc, AVHWFramesContext *src_fc, int flags) |
AVVkFrame * | av_vk_frame_alloc (void) |
Allocates a single AVVkFrame and initializes everything as 0. More... | |
Variables | |
struct { | |
enum AVPixelFormat pixfmt | |
const VkFormat vkfmts [4] | |
} | vk_pixfmt_map [] |
static const VulkanOptExtension | optional_instance_exts [] |
static const VulkanOptExtension | optional_device_exts [] |
const HWContextType | ff_hwcontext_type_vulkan |
#define VK_NO_PROTOTYPES |
Definition at line 19 of file hwcontext_vulkan.c.
#define VK_ENABLE_BETA_EXTENSIONS |
Definition at line 20 of file hwcontext_vulkan.c.
#define RELEASE_PROPS | ( | props, | |
count | |||
) |
#define CASE | ( | VAL | ) | case VAL: return #VAL |
#define SETUP_QUEUE | ( | qf_idx | ) |
#define CHECK_QUEUE | ( | type, | |
required, | |||
fidx, | |||
ctx_qf, | |||
qc | |||
) |
enum PrepMode |
Enumerator | |
---|---|
PREP_MODE_WRITE | |
PREP_MODE_EXTERNAL_EXPORT | |
PREP_MODE_EXTERNAL_IMPORT |
Definition at line 1907 of file hwcontext_vulkan.c.
const VkFormat* av_vkfmt_from_pixfmt | ( | enum AVPixelFormat | p | ) |
Returns the format of each image up to the number of planes for a given sw_format.
Returns NULL on unsupported formats.
Definition at line 238 of file hwcontext_vulkan.c.
Referenced by create_frame(), pixfmt_is_supported(), try_export_flags(), and vulkan_frames_init().
|
static |
Definition at line 246 of file hwcontext_vulkan.c.
Referenced by try_export_flags(), and vulkan_frames_init().
|
static |
Definition at line 259 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 271 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_get_constraints().
|
static |
Definition at line 298 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 368 of file hwcontext_vulkan.c.
Referenced by alloc_bind_mem(), alloc_mem(), create_buf(), create_exec_ctx(), create_frame(), create_instance(), find_device(), map_buffers(), submit_exec_ctx(), unmap_buffers(), vulkan_device_create_internal(), vulkan_map_frame_to_mem(), vulkan_unmap_frame(), and wait_start_exec_ctx().
|
static |
Definition at line 408 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 431 of file hwcontext_vulkan.c.
Referenced by create_instance(), and vulkan_device_create_internal().
|
static |
Definition at line 560 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 670 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 766 of file hwcontext_vulkan.c.
Referenced by find_device().
|
static |
Definition at line 778 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
inlinestatic |
Definition at line 907 of file hwcontext_vulkan.c.
Referenced by setup_queue_families().
|
static |
Definition at line 930 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 1064 of file hwcontext_vulkan.c.
Referenced by ff_vk_create_exec_ctx(), and vulkan_frames_init().
|
static |
Definition at line 1122 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_uninit().
|
static |
Definition at line 1159 of file hwcontext_vulkan.c.
Referenced by prepare_frame(), and transfer_image_buf().
|
static |
Definition at line 1164 of file hwcontext_vulkan.c.
Referenced by add_buf_dep_exec_ctx(), submit_exec_ctx(), and wait_start_exec_ctx().
|
static |
Definition at line 1173 of file hwcontext_vulkan.c.
Referenced by prepare_frame(), and transfer_image_buf().
|
static |
Definition at line 1216 of file hwcontext_vulkan.c.
Referenced by transfer_image_buf().
|
static |
Definition at line 1246 of file hwcontext_vulkan.c.
Referenced by prepare_frame(), and transfer_image_buf().
|
static |
Definition at line 1291 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 1314 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create(), and vulkan_device_derive().
|
static |
Definition at line 1433 of file hwcontext_vulkan.c.
|
static |
Definition at line 1534 of file hwcontext_vulkan.c.
|
static |
Definition at line 1550 of file hwcontext_vulkan.c.
|
static |
Definition at line 1621 of file hwcontext_vulkan.c.
|
static |
Definition at line 1667 of file hwcontext_vulkan.c.
Referenced by alloc_bind_mem(), and create_buf().
|
static |
Definition at line 1725 of file hwcontext_vulkan.c.
Referenced by vulkan_frame_free().
|
static |
Definition at line 1763 of file hwcontext_vulkan.c.
Referenced by create_frame(), vulkan_frames_init(), and vulkan_pool_alloc().
|
static |
Definition at line 1787 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
static |
Definition at line 1913 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
inlinestatic |
Definition at line 2008 of file hwcontext_vulkan.c.
Referenced by create_frame(), and transfer_image_buf().
|
static |
Definition at line 2025 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init(), and vulkan_pool_alloc().
|
static |
Definition at line 2131 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
static |
Definition at line 2193 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 2256 of file hwcontext_vulkan.c.
|
static |
Definition at line 2271 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_derive_to().
|
static |
Definition at line 2421 of file hwcontext_vulkan.c.
|
static |
Definition at line 2435 of file hwcontext_vulkan.c.
|
static |
Definition at line 2455 of file hwcontext_vulkan.c.
Referenced by vulkan_map_frame_to_mem().
|
static |
Definition at line 2489 of file hwcontext_vulkan.c.
Referenced by vulkan_map_from().
|
static |
Definition at line 3252 of file hwcontext_vulkan.c.
|
static |
Definition at line 3439 of file hwcontext_vulkan.c.
|
static |
Definition at line 3471 of file hwcontext_vulkan.c.
Referenced by create_buf().
|
static |
Definition at line 3487 of file hwcontext_vulkan.c.
|
static |
Definition at line 3496 of file hwcontext_vulkan.c.
|
static |
Definition at line 3587 of file hwcontext_vulkan.c.
|
static |
Definition at line 3645 of file hwcontext_vulkan.c.
|
static |
Definition at line 3692 of file hwcontext_vulkan.c.
|
static |
Definition at line 3822 of file hwcontext_vulkan.c.
Referenced by vulkan_transfer_data_from(), and vulkan_transfer_data_to().
|
static |
Definition at line 3979 of file hwcontext_vulkan.c.
|
static |
Definition at line 4097 of file hwcontext_vulkan.c.
|
static |
Definition at line 4122 of file hwcontext_vulkan.c.
AVVkFrame* av_vk_frame_alloc | ( | void | ) |
Allocates a single AVVkFrame and initializes everything as 0.
Definition at line 4128 of file hwcontext_vulkan.c.
Referenced by create_frame().
enum AVPixelFormat pixfmt |
Definition at line 166 of file hwcontext_vulkan.c.
Referenced by av_vkfmt_from_pixfmt().
const VkFormat vkfmts[4] |
Definition at line 167 of file hwcontext_vulkan.c.
const { ... } vk_pixfmt_map[] |
Referenced by av_vkfmt_from_pixfmt().
|
static |
Definition at line 337 of file hwcontext_vulkan.c.
Referenced by check_extensions().
|
static |
Definition at line 341 of file hwcontext_vulkan.c.
Referenced by check_extensions(), and vulkan_device_init().
const HWContextType ff_hwcontext_type_vulkan |
Definition at line 4133 of file hwcontext_vulkan.c.