FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
hwcontext_vulkan.c File Reference
#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 VkFormatav_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 AVBufferRefvulkan_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)
 
AVVkFrameav_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
 

Macro Definition Documentation

◆ VK_NO_PROTOTYPES

#define VK_NO_PROTOTYPES

Definition at line 19 of file hwcontext_vulkan.c.

◆ VK_ENABLE_BETA_EXTENSIONS

#define VK_ENABLE_BETA_EXTENSIONS

Definition at line 20 of file hwcontext_vulkan.c.

◆ ADD_VAL_TO_LIST

#define ADD_VAL_TO_LIST (   list,
  count,
  val 
)
Value:
do { \
list = av_realloc_array(list, sizeof(*list), ++count); \
if (!list) { \
err = AVERROR(ENOMEM); \
goto fail; \
} \
list[count - 1] = av_strdup(val); \
if (!list[count - 1]) { \
err = AVERROR(ENOMEM); \
goto fail; \
} \
} while(0)

Definition at line 144 of file hwcontext_vulkan.c.

◆ RELEASE_PROPS

#define RELEASE_PROPS (   props,
  count 
)
Value:
if (props) { \
for (int i = 0; i < count; i++) \
av_free((void *)((props)[i])); \
av_free((void *)props); \
}

Definition at line 158 of file hwcontext_vulkan.c.

◆ CASE

#define CASE (   VAL)    case VAL: return #VAL

◆ SETUP_QUEUE

#define SETUP_QUEUE (   qf_idx)

◆ COPY_FEATURE

#define COPY_FEATURE (   DST,
  NAME 
)    (DST).features.NAME = dev_features.features.NAME;

◆ CHECK_QUEUE

#define CHECK_QUEUE (   type,
  required,
  fidx,
  ctx_qf,
  qc 
)
Value:
do { \
if (ctx_qf < 0 && required) { \
av_log(ctx, AV_LOG_ERROR, "%s queue family is required, but marked as missing" \
" in the context!\n", type); \
return AVERROR(EINVAL); \
} else if (fidx < 0 || ctx_qf < 0) { \
break; \
} else if (ctx_qf >= queue_num) { \
av_log(ctx, AV_LOG_ERROR, "Invalid %s family index %i (device has %i families)!\n", \
type, ctx_qf, queue_num); \
return AVERROR(EINVAL); \
} \
av_log(ctx, AV_LOG_VERBOSE, "Using queue family %i (queues: %i)" \
" for%s%s%s%s%s\n", \
ctx_qf, qc, \
ctx_qf == graph_index ? " graphics" : "", \
ctx_qf == comp_index ? " compute" : "", \
ctx_qf == tx_index ? " transfers" : "", \
ctx_qf == enc_index ? " encode" : "", \
ctx_qf == dec_index ? " decode" : ""); \
graph_index = (ctx_qf == graph_index) ? -1 : graph_index; \
comp_index = (ctx_qf == comp_index) ? -1 : comp_index; \
tx_index = (ctx_qf == tx_index) ? -1 : tx_index; \
enc_index = (ctx_qf == enc_index) ? -1 : enc_index; \
dec_index = (ctx_qf == dec_index) ? -1 : dec_index; \
p->qfs[p->num_qfs++] = ctx_qf; \
} while (0)

Enumeration Type Documentation

◆ PrepMode

enum PrepMode
Enumerator
PREP_MODE_WRITE 
PREP_MODE_EXTERNAL_EXPORT 
PREP_MODE_EXTERNAL_IMPORT 

Definition at line 1903 of file hwcontext_vulkan.c.

Function Documentation

◆ av_vkfmt_from_pixfmt()

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 242 of file hwcontext_vulkan.c.

Referenced by create_frame(), pixfmt_is_supported(), try_export_flags(), and vulkan_frames_init().

◆ vk_find_struct()

static const void* vk_find_struct ( const void *  chain,
VkStructureType  stype 
)
static

Definition at line 250 of file hwcontext_vulkan.c.

Referenced by try_export_flags(), and vulkan_frames_init().

◆ vk_link_struct()

static void vk_link_struct ( void *  chain,
void *  in 
)
static

Definition at line 263 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init().

◆ pixfmt_is_supported()

static int pixfmt_is_supported ( AVHWDeviceContext dev_ctx,
enum AVPixelFormat  p,
int  linear 
)
static

Definition at line 275 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_get_constraints().

◆ load_libvulkan()

static int load_libvulkan ( AVHWDeviceContext ctx)
static

Definition at line 302 of file hwcontext_vulkan.c.

Referenced by create_instance().

◆ vk_ret2str()

static const char* vk_ret2str ( VkResult  res)
static

◆ vk_dbg_callback()

static VkBool32 vk_dbg_callback ( VkDebugUtilsMessageSeverityFlagBitsEXT  severity,
VkDebugUtilsMessageTypeFlagsEXT  messageType,
const VkDebugUtilsMessengerCallbackDataEXT *  data,
void *  priv 
)
static

Definition at line 404 of file hwcontext_vulkan.c.

Referenced by create_instance().

◆ check_extensions()

static int check_extensions ( AVHWDeviceContext ctx,
int  dev,
AVDictionary opts,
const char *const **  dst,
uint32_t *  num,
int  debug 
)
static

Definition at line 427 of file hwcontext_vulkan.c.

Referenced by create_instance(), and vulkan_device_create_internal().

◆ check_validation_layers()

static int check_validation_layers ( AVHWDeviceContext ctx,
AVDictionary opts,
const char *const **  dst,
uint32_t *  num,
int debug_mode 
)
static

Definition at line 556 of file hwcontext_vulkan.c.

Referenced by create_instance().

◆ create_instance()

static int create_instance ( AVHWDeviceContext ctx,
AVDictionary opts 
)
static

Definition at line 666 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

◆ vk_dev_type()

static const char* vk_dev_type ( enum VkPhysicalDeviceType  type)
static

Definition at line 762 of file hwcontext_vulkan.c.

Referenced by find_device().

◆ find_device()

static int find_device ( AVHWDeviceContext ctx,
VulkanDeviceSelection select 
)
static

Definition at line 774 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

◆ pick_queue_family()

static int pick_queue_family ( VkQueueFamilyProperties *  qf,
uint32_t  num_qf,
VkQueueFlagBits  flags 
)
inlinestatic

Definition at line 903 of file hwcontext_vulkan.c.

Referenced by setup_queue_families().

◆ setup_queue_families()

static int setup_queue_families ( AVHWDeviceContext ctx,
VkDeviceCreateInfo *  cd 
)
static

Definition at line 926 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

◆ create_exec_ctx()

static int create_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd,
int  queue_family_index,
int  num_queues 
)
static

Definition at line 1060 of file hwcontext_vulkan.c.

Referenced by ff_vk_create_exec_ctx(), and vulkan_frames_init().

◆ free_exec_ctx()

static void free_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 1118 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_uninit().

◆ get_buf_exec_ctx()

static VkCommandBuffer get_buf_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 1155 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

◆ unref_exec_ctx_deps()

static void unref_exec_ctx_deps ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 1160 of file hwcontext_vulkan.c.

Referenced by add_buf_dep_exec_ctx(), submit_exec_ctx(), and wait_start_exec_ctx().

◆ wait_start_exec_ctx()

static int wait_start_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 1169 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

◆ add_buf_dep_exec_ctx()

static int add_buf_dep_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd,
AVBufferRef *const *  deps,
int  nb_deps 
)
static

Definition at line 1212 of file hwcontext_vulkan.c.

Referenced by transfer_image_buf().

◆ submit_exec_ctx()

static int submit_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd,
VkSubmitInfo *  s_info,
AVVkFrame f,
int  synchronous 
)
static

Definition at line 1242 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

◆ vulkan_device_free()

static void vulkan_device_free ( AVHWDeviceContext ctx)
static

Definition at line 1287 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

◆ vulkan_device_create_internal()

static int vulkan_device_create_internal ( AVHWDeviceContext ctx,
VulkanDeviceSelection dev_select,
AVDictionary opts,
int  flags 
)
static

Definition at line 1310 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create(), and vulkan_device_derive().

◆ vulkan_device_init()

static int vulkan_device_init ( AVHWDeviceContext ctx)
static

Definition at line 1429 of file hwcontext_vulkan.c.

◆ vulkan_device_create()

static int vulkan_device_create ( AVHWDeviceContext ctx,
const char *  device,
AVDictionary opts,
int  flags 
)
static

Definition at line 1530 of file hwcontext_vulkan.c.

◆ vulkan_device_derive()

static int vulkan_device_derive ( AVHWDeviceContext ctx,
AVHWDeviceContext src_ctx,
AVDictionary opts,
int  flags 
)
static

Definition at line 1546 of file hwcontext_vulkan.c.

◆ vulkan_frames_get_constraints()

static int vulkan_frames_get_constraints ( AVHWDeviceContext ctx,
const void *  hwconfig,
AVHWFramesConstraints constraints 
)
static

Definition at line 1617 of file hwcontext_vulkan.c.

◆ alloc_mem()

static int alloc_mem ( AVHWDeviceContext ctx,
VkMemoryRequirements *  req,
VkMemoryPropertyFlagBits  req_flags,
const void *  alloc_extension,
VkMemoryPropertyFlagBits *  mem_flags,
VkDeviceMemory *  mem 
)
static

Definition at line 1663 of file hwcontext_vulkan.c.

Referenced by alloc_bind_mem(), and create_buf().

◆ vulkan_free_internal()

static void vulkan_free_internal ( AVVkFrame f)
static

Definition at line 1721 of file hwcontext_vulkan.c.

Referenced by vulkan_frame_free().

◆ vulkan_frame_free()

static void vulkan_frame_free ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 1759 of file hwcontext_vulkan.c.

Referenced by create_frame(), vulkan_frames_init(), and vulkan_pool_alloc().

◆ alloc_bind_mem()

static int alloc_bind_mem ( AVHWFramesContext hwfc,
AVVkFrame f,
void *  alloc_pnext,
size_t  alloc_pnext_stride 
)
static

Definition at line 1783 of file hwcontext_vulkan.c.

Referenced by vulkan_pool_alloc().

◆ prepare_frame()

static int prepare_frame ( AVHWFramesContext hwfc,
VulkanExecCtx ectx,
AVVkFrame frame,
enum PrepMode  pmode 
)
static

Definition at line 1909 of file hwcontext_vulkan.c.

Referenced by vulkan_pool_alloc().

◆ get_plane_wh()

static void get_plane_wh ( int w,
int h,
enum AVPixelFormat  format,
int  frame_w,
int  frame_h,
int  plane 
)
inlinestatic

Definition at line 2004 of file hwcontext_vulkan.c.

Referenced by create_frame(), and transfer_image_buf().

◆ create_frame()

static int create_frame ( AVHWFramesContext hwfc,
AVVkFrame **  frame,
VkImageTiling  tiling,
VkImageUsageFlagBits  usage,
void *  create_pnext 
)
static

Definition at line 2021 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init(), and vulkan_pool_alloc().

◆ try_export_flags()

static void try_export_flags ( AVHWFramesContext hwfc,
VkExternalMemoryHandleTypeFlags *  comp_handle_types,
VkExternalMemoryHandleTypeFlagBits *  iexp,
VkExternalMemoryHandleTypeFlagBits  exp 
)
static

Definition at line 2127 of file hwcontext_vulkan.c.

Referenced by vulkan_pool_alloc().

◆ vulkan_pool_alloc()

static AVBufferRef* vulkan_pool_alloc ( void *  opaque,
size_t  size 
)
static

Definition at line 2189 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init().

◆ vulkan_frames_uninit()

static void vulkan_frames_uninit ( AVHWFramesContext hwfc)
static

Definition at line 2252 of file hwcontext_vulkan.c.

◆ vulkan_frames_init()

static int vulkan_frames_init ( AVHWFramesContext hwfc)
static

Definition at line 2267 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_derive_to().

◆ vulkan_get_buffer()

static int vulkan_get_buffer ( AVHWFramesContext hwfc,
AVFrame frame 
)
static

Definition at line 2417 of file hwcontext_vulkan.c.

◆ vulkan_transfer_get_formats()

static int vulkan_transfer_get_formats ( AVHWFramesContext hwfc,
enum AVHWFrameTransferDirection  dir,
enum AVPixelFormat **  formats 
)
static

Definition at line 2431 of file hwcontext_vulkan.c.

◆ vulkan_unmap_frame()

static void vulkan_unmap_frame ( AVHWFramesContext hwfc,
HWMapDescriptor hwmap 
)
static

Definition at line 2451 of file hwcontext_vulkan.c.

Referenced by vulkan_map_frame_to_mem().

◆ vulkan_map_frame_to_mem()

static int vulkan_map_frame_to_mem ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src,
int  flags 
)
static

Definition at line 2485 of file hwcontext_vulkan.c.

Referenced by vulkan_map_from().

◆ vulkan_map_to()

static int vulkan_map_to ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src,
int  flags 
)
static

Definition at line 3257 of file hwcontext_vulkan.c.

◆ vulkan_map_from()

static int vulkan_map_from ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src,
int  flags 
)
static

Definition at line 3444 of file hwcontext_vulkan.c.

◆ free_buf()

static void free_buf ( void *  opaque,
uint8_t *  data 
)
static

Definition at line 3476 of file hwcontext_vulkan.c.

Referenced by create_buf().

◆ get_req_buffer_size()

static size_t get_req_buffer_size ( VulkanDevicePriv p,
int stride,
int  height 
)
static

Definition at line 3492 of file hwcontext_vulkan.c.

◆ create_buf()

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

Definition at line 3501 of file hwcontext_vulkan.c.

◆ map_buffers()

static int map_buffers ( AVHWDeviceContext ctx,
AVBufferRef **  bufs,
uint8_t *  mem[],
int  nb_buffers,
int  invalidate 
)
static

Definition at line 3592 of file hwcontext_vulkan.c.

◆ unmap_buffers()

static int unmap_buffers ( AVHWDeviceContext ctx,
AVBufferRef **  bufs,
int  nb_buffers,
int  flush 
)
static

Definition at line 3650 of file hwcontext_vulkan.c.

◆ transfer_image_buf()

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

Definition at line 3697 of file hwcontext_vulkan.c.

◆ vulkan_transfer_data()

static int vulkan_transfer_data ( AVHWFramesContext hwfc,
const AVFrame vkf,
const AVFrame swf,
int  from 
)
static

Definition at line 3827 of file hwcontext_vulkan.c.

Referenced by vulkan_transfer_data_from(), and vulkan_transfer_data_to().

◆ vulkan_transfer_data_to()

static int vulkan_transfer_data_to ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 3984 of file hwcontext_vulkan.c.

◆ vulkan_transfer_data_from()

static int vulkan_transfer_data_from ( AVHWFramesContext hwfc,
AVFrame dst,
const AVFrame src 
)
static

Definition at line 4102 of file hwcontext_vulkan.c.

◆ vulkan_frames_derive_to()

static int vulkan_frames_derive_to ( AVHWFramesContext dst_fc,
AVHWFramesContext src_fc,
int  flags 
)
static

Definition at line 4127 of file hwcontext_vulkan.c.

◆ av_vk_frame_alloc()

AVVkFrame* av_vk_frame_alloc ( void  )

Allocates a single AVVkFrame and initializes everything as 0.

Note
Must be freed via av_free()

Definition at line 4133 of file hwcontext_vulkan.c.

Referenced by create_frame().

Variable Documentation

◆ pixfmt

enum AVPixelFormat pixfmt

Definition at line 166 of file hwcontext_vulkan.c.

Referenced by av_vkfmt_from_pixfmt().

◆ vkfmts

const VkFormat vkfmts[4]

Definition at line 167 of file hwcontext_vulkan.c.

◆ vk_pixfmt_map

const { ... } vk_pixfmt_map[]

Referenced by av_vkfmt_from_pixfmt().

◆ optional_instance_exts

const VulkanOptExtension optional_instance_exts[]
static
Initial value:
= {
}

Definition at line 341 of file hwcontext_vulkan.c.

Referenced by check_extensions().

◆ optional_device_exts

const VulkanOptExtension optional_device_exts[]
static
Initial value:
= {
{ VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
{ VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
{ VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME, FF_VK_EXT_NO_FLAG },
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY },
{ VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_DMABUF_MEMORY },
{ VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, FF_VK_EXT_DRM_MODIFIER_FLAGS },
{ VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_SEM },
{ VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_HOST_MEMORY },
}

Definition at line 345 of file hwcontext_vulkan.c.

Referenced by check_extensions(), and vulkan_device_init().

◆ ff_hwcontext_type_vulkan

const HWContextType ff_hwcontext_type_vulkan

Definition at line 4138 of file hwcontext_vulkan.c.

FF_VK_EXT_NO_FLAG
@ FF_VK_EXT_NO_FLAG
Definition: vulkan_functions.h:41
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
fail
#define fail()
Definition: checkasm.h:134
val
static double val(void *priv, double ch)
Definition: aeval.c:77
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:215
FF_VK_EXT_EXTERNAL_HOST_MEMORY
@ FF_VK_EXT_EXTERNAL_HOST_MEMORY
Definition: vulkan_functions.h:34
ctx
AVFormatContext * ctx
Definition: movenc.c:48
list
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
Definition: filter_design.txt:25
FF_VK_EXT_DRM_MODIFIER_FLAGS
@ FF_VK_EXT_DRM_MODIFIER_FLAGS
Definition: vulkan_functions.h:31
FF_VK_EXT_EXTERNAL_DMABUF_MEMORY
@ FF_VK_EXT_EXTERNAL_DMABUF_MEMORY
Definition: vulkan_functions.h:30
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
FF_VK_EXT_EXTERNAL_FD_MEMORY
@ FF_VK_EXT_EXTERNAL_FD_MEMORY
Definition: vulkan_functions.h:32
av_strdup
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:270
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
FF_VK_EXT_EXTERNAL_FD_SEM
@ FF_VK_EXT_EXTERNAL_FD_SEM
Definition: vulkan_functions.h:33
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27