FFmpeg
|
#include <dlfcn.h>
#include <unistd.h>
#include "thread.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 | VulkanDevicePriv |
struct | VulkanFramesPriv |
struct | AVVkFrameInternal |
struct | FFVkFormatEntry |
struct | VulkanOptExtension |
struct | VulkanDeviceSelection |
Macros | |
#define | VK_NO_PROTOTYPES |
#define | VK_ENABLE_BETA_EXTENSIONS |
#define | ASPECT_2PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT) |
#define | ASPECT_3PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT) |
#define | FN_MAP_TO(dst_t, dst_name, src_t, src_name) |
#define | MAP_TO(flag1, flag2) if (src & flag2) dst |= flag1; |
#define | MAP_TO(flag1, flag2) if (src & flag1) dst |= flag2; |
#define | ADD_VAL_TO_LIST(list, count, val) |
#define | RELEASE_PROPS(props, count) |
#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, PREP_MODE_DECODING_DST, PREP_MODE_DECODING_DPB } |
Functions | |
const VkFormat * | av_vkfmt_from_pixfmt (enum AVPixelFormat p) |
Returns the optimal per-plane Vulkan format for a given sw_format, one for each plane. More... | |
static const struct FFVkFormatEntry * | vk_find_format_entry (enum AVPixelFormat p) |
static int | vkfmt_from_pixfmt2 (AVHWDeviceContext *dev_ctx, enum AVPixelFormat p, VkImageTiling tiling, VkFormat fmts[AV_NUM_DATA_POINTERS], int *nb_images, VkImageAspectFlags *aspect, VkImageUsageFlags *supported_usage, int disable_multiplane, int need_storage) |
static int | load_libvulkan (AVHWDeviceContext *ctx) |
static VkBool32 VKAPI_CALL | 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 void | vulkan_device_free (AVHWDeviceContext *ctx) |
static void | vulkan_device_uninit (AVHWDeviceContext *ctx) |
static int | vulkan_device_create_internal (AVHWDeviceContext *ctx, VulkanDeviceSelection *dev_select, int disable_multiplane, AVDictionary *opts, int flags) |
static void | lock_queue (AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index) |
static void | unlock_queue (AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index) |
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 (AVHWFramesContext *hwfc, AVVkFrame *f) |
static void | vulkan_frame_free_cb (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, FFVkExecPool *ectx, AVVkFrame *frame, enum PrepMode pmode) |
static void | get_plane_wh (uint32_t *w, uint32_t *h, enum AVPixelFormat format, int frame_w, int frame_h, int plane) |
static int | create_frame (AVHWFramesContext *hwfc, AVVkFrame **frame, VkImageTiling tiling, VkImageUsageFlagBits usage, VkImageCreateFlags flags, int nb_layers, 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 | lock_frame (AVHWFramesContext *fc, AVVkFrame *vkf) |
static void | unlock_frame (AVHWFramesContext *fc, AVVkFrame *vkf) |
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 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 size_t | get_req_buffer_size (VulkanDevicePriv *p, int *stride, int height) |
static int | transfer_image_buf (AVHWFramesContext *hwfc, 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 | |
static const struct FFVkFormatEntry | vk_formats_list [] |
static const int | nb_vk_formats_list = FF_ARRAY_ELEMS(vk_formats_list) |
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 21 of file hwcontext_vulkan.c.
#define VK_ENABLE_BETA_EXTENSIONS |
Definition at line 22 of file hwcontext_vulkan.c.
#define ASPECT_2PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT) |
Definition at line 166 of file hwcontext_vulkan.c.
#define ASPECT_3PLANE (VK_IMAGE_ASPECT_PLANE_0_BIT | VK_IMAGE_ASPECT_PLANE_1_BIT | VK_IMAGE_ASPECT_PLANE_2_BIT) |
Definition at line 167 of file hwcontext_vulkan.c.
#define FN_MAP_TO | ( | dst_t, | |
dst_name, | |||
src_t, | |||
src_name | |||
) |
Definition at line 260 of file hwcontext_vulkan.c.
Definition at line 288 of file hwcontext_vulkan.c.
Definition at line 288 of file hwcontext_vulkan.c.
#define RELEASE_PROPS | ( | props, | |
count | |||
) |
#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 | |
PREP_MODE_DECODING_DST | |
PREP_MODE_DECODING_DPB |
Definition at line 1938 of file hwcontext_vulkan.c.
const VkFormat* av_vkfmt_from_pixfmt | ( | enum AVPixelFormat | p | ) |
Returns the optimal per-plane Vulkan format for a given sw_format, one for each plane.
Returns NULL on unsupported formats.
Definition at line 243 of file hwcontext_vulkan.c.
Referenced by try_export_flags(), and vulkan_transfer_data().
|
static |
Definition at line 251 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 293 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_get_constraints(), and vulkan_frames_init().
|
static |
Definition at line 380 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 452 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 496 of file hwcontext_vulkan.c.
Referenced by create_instance(), and vulkan_device_create_internal().
|
static |
Definition at line 625 of file hwcontext_vulkan.c.
Referenced by create_instance().
|
static |
Definition at line 735 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 862 of file hwcontext_vulkan.c.
Referenced by find_device().
|
static |
Definition at line 874 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
inlinestatic |
Definition at line 1031 of file hwcontext_vulkan.c.
Referenced by setup_queue_families().
|
static |
Definition at line 1054 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 1193 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create_internal().
|
static |
Definition at line 1216 of file hwcontext_vulkan.c.
|
static |
Definition at line 1229 of file hwcontext_vulkan.c.
Referenced by vulkan_device_create(), and vulkan_device_derive().
|
static |
Definition at line 1412 of file hwcontext_vulkan.c.
Referenced by init_vulkan(), and vulkan_device_init().
|
static |
Definition at line 1418 of file hwcontext_vulkan.c.
Referenced by init_vulkan(), and vulkan_device_init().
|
static |
Definition at line 1424 of file hwcontext_vulkan.c.
|
static |
Definition at line 1571 of file hwcontext_vulkan.c.
|
static |
Definition at line 1587 of file hwcontext_vulkan.c.
|
static |
Definition at line 1690 of file hwcontext_vulkan.c.
|
static |
Definition at line 1736 of file hwcontext_vulkan.c.
Referenced by alloc_bind_mem().
|
static |
Definition at line 1794 of file hwcontext_vulkan.c.
Referenced by vulkan_frame_free().
|
static |
Definition at line 1830 of file hwcontext_vulkan.c.
Referenced by create_frame(), vulkan_frame_free_cb(), vulkan_frames_init(), and vulkan_pool_alloc().
|
static |
Definition at line 1864 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
static |
Definition at line 1869 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
static |
Definition at line 1946 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
inlinestatic |
Definition at line 2028 of file hwcontext_vulkan.c.
Referenced by create_frame(), transfer_image_buf(), and vulkan_transfer_data().
|
static |
Definition at line 2045 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init(), and vulkan_pool_alloc().
|
static |
Definition at line 2154 of file hwcontext_vulkan.c.
Referenced by vulkan_pool_alloc().
|
static |
Definition at line 2216 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 2282 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 2287 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_init().
|
static |
Definition at line 2292 of file hwcontext_vulkan.c.
|
static |
Definition at line 2308 of file hwcontext_vulkan.c.
Referenced by vulkan_frames_derive_to().
|
static |
Definition at line 2435 of file hwcontext_vulkan.c.
|
static |
Definition at line 2449 of file hwcontext_vulkan.c.
|
static |
Definition at line 3113 of file hwcontext_vulkan.c.
|
static |
Definition at line 3300 of file hwcontext_vulkan.c.
|
static |
Definition at line 3326 of file hwcontext_vulkan.c.
Referenced by vulkan_transfer_data().
|
static |
Definition at line 3335 of file hwcontext_vulkan.c.
Referenced by vulkan_transfer_data().
|
static |
Definition at line 3427 of file hwcontext_vulkan.c.
Referenced by vulkan_transfer_data_from(), and vulkan_transfer_data_to().
|
static |
Definition at line 3570 of file hwcontext_vulkan.c.
|
static |
Definition at line 3687 of file hwcontext_vulkan.c.
|
static |
Definition at line 3712 of file hwcontext_vulkan.c.
AVVkFrame* av_vk_frame_alloc | ( | void | ) |
Allocates a single AVVkFrame and initializes everything as 0.
Definition at line 3718 of file hwcontext_vulkan.c.
Referenced by create_frame().
|
static |
Referenced by av_vkfmt_from_pixfmt(), vk_find_format_entry(), vkfmt_from_pixfmt2(), and vulkan_frames_get_constraints().
|
static |
Definition at line 241 of file hwcontext_vulkan.c.
Referenced by av_vkfmt_from_pixfmt(), vk_find_format_entry(), vkfmt_from_pixfmt2(), and vulkan_frames_get_constraints().
|
static |
Definition at line 419 of file hwcontext_vulkan.c.
Referenced by check_extensions().
|
static |
Definition at line 423 of file hwcontext_vulkan.c.
Referenced by check_extensions(), and vulkan_device_init().
const HWContextType ff_hwcontext_type_vulkan |
Definition at line 3741 of file hwcontext_vulkan.c.