FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
hwcontext_vulkan.c File Reference
#include "config.h"
#include "pixdesc.h"
#include "avstring.h"
#include "imgutils.h"
#include "hwcontext.h"
#include "hwcontext_internal.h"
#include "hwcontext_vulkan.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 GET_QUEUE_COUNT(hwctx, graph, comp, tx)
 
#define VK_LOAD_PFN(inst, name)
 
#define DEFAULT_USAGE_FLAGS
 
#define ADD_VAL_TO_LIST(list, count, val)
 
#define CASE(VAL)   case VAL: return #VAL
 
#define SEARCH_FLAGS(expr, out)
 
#define ADD_QUEUE(fidx, graph, comp, tx)
 
#define COPY_FEATURE(DST, NAME)   (DST).features.NAME = dev_features.NAME;
 
#define CHECK_QUEUE(type, n)
 

Enumerations

enum  VulkanExtensions {
  EXT_EXTERNAL_DMABUF_MEMORY = 1ULL << 0, EXT_DRM_MODIFIER_FLAGS = 1ULL << 1, EXT_EXTERNAL_FD_MEMORY = 1ULL << 2, EXT_EXTERNAL_FD_SEM = 1ULL << 3,
  EXT_NO_FLAG = 1ULL << 63
}
 
enum  PrepMode { PREP_MODE_WRITE, PREP_MODE_RO_SHADER, PREP_MODE_EXTERNAL_EXPORT }
 

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 int pixfmt_is_supported (AVVulkanDeviceContext *hwctx, enum AVPixelFormat p, int linear)
 
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 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 search_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, 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, void *alloc_extension, VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
 
static void vulkan_free_internal (AVVkFrameInternal *internal)
 
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 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, int 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 int create_buf (AVHWDeviceContext *ctx, AVBufferRef **buf, int height, int *stride, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags, 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, const int *buf_stride, int w, int h, enum AVPixelFormat pix_fmt, int to_buf)
 
static int vulkan_transfer_data_from_mem (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
static int vulkan_transfer_data_to (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
static int vulkan_transfer_data_to_mem (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
static int vulkan_transfer_data_from (AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
 
AVVkFrameav_vk_frame_alloc (void)
 Allocates a single AVVkFrame and initializes everything as 0. More...
 

Variables

struct {
   enum AVPixelFormat   pixfmt
 
   const VkFormat   vkfmts [3]
 
vk_pixfmt_map []
 
static const VulkanOptExtension optional_instance_exts []
 
static const VulkanOptExtension optional_device_exts []
 
const HWContextType ff_hwcontext_type_vulkan
 

Macro Definition Documentation

#define GET_QUEUE_COUNT (   hwctx,
  graph,
  comp,
  tx 
)
Value:
( \
graph ? hwctx->nb_graphics_queues : \
comp ? (hwctx->nb_comp_queues ? \
hwctx->nb_comp_queues : hwctx->nb_graphics_queues) : \
tx ? (hwctx->nb_tx_queues ? hwctx->nb_tx_queues : \
(hwctx->nb_comp_queues ? \
hwctx->nb_comp_queues : hwctx->nb_graphics_queues)) : \
0 \
)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:83

Definition at line 106 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init().

#define VK_LOAD_PFN (   inst,
  name 
)
Value:
PFN_##name pfn_##name = (PFN_##name) \
vkGetInstanceProcAddr(inst, #name)
const char * name
Definition: opengl_enc.c:102

Definition at line 116 of file hwcontext_vulkan.c.

Referenced by create_instance(), vulkan_device_free(), vulkan_map_frame_to_mem(), and vulkan_map_to().

#define DEFAULT_USAGE_FLAGS
Value:
(VK_IMAGE_USAGE_SAMPLED_BIT | \
VK_IMAGE_USAGE_STORAGE_BIT | \
VK_IMAGE_USAGE_TRANSFER_SRC_BIT | \
VK_IMAGE_USAGE_TRANSFER_DST_BIT)

Definition at line 119 of file hwcontext_vulkan.c.

Referenced by pixfmt_is_supported(), and vulkan_frames_init().

#define ADD_VAL_TO_LIST (   list,
  count,
  val 
)
Value:
do { \
if (!list) { \
err = AVERROR(ENOMEM); \
goto fail; \
} \
if (!list[count - 1]) { \
err = AVERROR(ENOMEM); \
goto fail; \
} \
} while(0)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:200
GLsizei count
Definition: opengl_enc.c:108
#define fail()
Definition: checkasm.h:123
if(ret)
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:255
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
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
static double val(void *priv, double ch)
Definition: aeval.c:76

Definition at line 124 of file hwcontext_vulkan.c.

Referenced by check_extensions().

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

Referenced by vk_ret2str().

#define SEARCH_FLAGS (   expr,
  out 
)
Value:
for (int i = 0; i < num; i++) { \
const VkQueueFlagBits flags = qs[i].queueFlags; \
if (expr) { \
out = i; \
break; \
} \
}
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
if(ret)
#define flags(name, subs,...)
Definition: cbs_av1.c:564
FILE * out
Definition: movenc.c:54

Referenced by search_queue_families().

#define ADD_QUEUE (   fidx,
  graph,
  comp,
  tx 
)
Value:
av_log(ctx, AV_LOG_VERBOSE, "Using queue family %i (total queues: %i) for %s%s%s\n", \
fidx, qs[fidx].queueCount, graph ? "graphics " : "", \
comp ? "compute " : "", tx ? "transfers " : ""); \
av_log(ctx, AV_LOG_VERBOSE, " QF %i flags: %s%s%s%s\n", fidx, \
((qs[fidx].queueFlags) & VK_QUEUE_GRAPHICS_BIT) ? "(graphics) " : "", \
((qs[fidx].queueFlags) & VK_QUEUE_COMPUTE_BIT) ? "(compute) " : "", \
((qs[fidx].queueFlags) & VK_QUEUE_TRANSFER_BIT) ? "(transfers) " : "", \
((qs[fidx].queueFlags) & VK_QUEUE_SPARSE_BINDING_BIT) ? "(sparse) " : ""); \
pc[cd->queueCreateInfoCount].queueFamilyIndex = fidx; \
pc[cd->queueCreateInfoCount].queueCount = qs[fidx].queueCount; \
weights = av_malloc(qs[fidx].queueCount * sizeof(float)); \
pc[cd->queueCreateInfoCount].pQueuePriorities = weights; \
if (!weights) \
goto fail; \
for (int i = 0; i < qs[fidx].queueCount; i++) \
weights[i] = 1.0f; \
cd->queueCreateInfoCount++;
#define av_malloc(s)
#define f(width, name)
Definition: cbs_vp9.c:255
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:192
#define av_log(a,...)
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
#define fail()
Definition: checkasm.h:123
AVFormatContext * ctx
Definition: movenc.c:48
if(ret)
static void comp(unsigned char *dst, ptrdiff_t dst_stride, unsigned char *src, ptrdiff_t src_stride, int add)
Definition: eamad.c:83
for(j=16;j >0;--j)

Referenced by search_queue_families().

#define COPY_FEATURE (   DST,
  NAME 
)    (DST).features.NAME = dev_features.NAME;
#define CHECK_QUEUE (   type,
 
)
Value:
if (n >= queue_num) { \
av_log(ctx, AV_LOG_ERROR, "Invalid %s queue index %i (device has %i queues)!\n", \
type, n, queue_num); \
return AVERROR(EINVAL); \
}
GLint GLenum type
Definition: opengl_enc.c:104
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AVFormatContext * ctx
Definition: movenc.c:48
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a it should return
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

Referenced by vulkan_device_init().

Enumeration Type Documentation

Enumerator
EXT_EXTERNAL_DMABUF_MEMORY 
EXT_DRM_MODIFIER_FLAGS 
EXT_EXTERNAL_FD_MEMORY 
EXT_EXTERNAL_FD_SEM 
EXT_NO_FLAG 

Definition at line 206 of file hwcontext_vulkan.c.

enum PrepMode
Enumerator
PREP_MODE_WRITE 
PREP_MODE_RO_SHADER 
PREP_MODE_EXTERNAL_EXPORT 

Definition at line 1414 of file hwcontext_vulkan.c.

Function Documentation

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

Referenced by create_frame(), pixfmt_is_supported(), process_frames(), try_export_flags(), and vulkan_map_to().

static int pixfmt_is_supported ( AVVulkanDeviceContext hwctx,
enum AVPixelFormat  p,
int  linear 
)
static

Definition at line 182 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_get_constraints().

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

Definition at line 272 of file hwcontext_vulkan.c.

Referenced by create_instance().

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

Definition at line 295 of file hwcontext_vulkan.c.

Referenced by create_instance(), and vulkan_device_create_internal().

static int create_instance ( AVHWDeviceContext ctx,
AVDictionary opts 
)
static

Definition at line 426 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

static const char* vk_dev_type ( enum VkPhysicalDeviceType  type)
static

Definition at line 506 of file hwcontext_vulkan.c.

Referenced by find_device().

static int find_device ( AVHWDeviceContext ctx,
VulkanDeviceSelection select 
)
static

Definition at line 518 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

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

Definition at line 639 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

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

Definition at line 733 of file hwcontext_vulkan.c.

Referenced by ff_vk_create_exec_ctx(), and vulkan_frames_init().

static void free_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 788 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init(), and vulkan_frames_uninit().

static VkCommandBuffer get_buf_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 820 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

static void unref_exec_ctx_deps ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 825 of file hwcontext_vulkan.c.

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

static int wait_start_exec_ctx ( AVHWFramesContext hwfc,
VulkanExecCtx cmd 
)
static

Definition at line 834 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

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

Definition at line 875 of file hwcontext_vulkan.c.

Referenced by transfer_image_buf().

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

Definition at line 905 of file hwcontext_vulkan.c.

Referenced by prepare_frame(), and transfer_image_buf().

static void vulkan_device_free ( AVHWDeviceContext ctx)
static

Definition at line 942 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create_internal().

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

Definition at line 966 of file hwcontext_vulkan.c.

Referenced by vulkan_device_create(), and vulkan_device_derive().

static int vulkan_device_init ( AVHWDeviceContext ctx)
static

Definition at line 1049 of file hwcontext_vulkan.c.

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

Definition at line 1113 of file hwcontext_vulkan.c.

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

Definition at line 1129 of file hwcontext_vulkan.c.

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

Definition at line 1200 of file hwcontext_vulkan.c.

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

Definition at line 1247 of file hwcontext_vulkan.c.

Referenced by alloc_bind_mem(), create_buf(), and vulkan_map_frame_to_mem().

static void vulkan_free_internal ( AVVkFrameInternal internal)
static
static void vulkan_frame_free ( void opaque,
uint8_t data 
)
static
static int alloc_bind_mem ( AVHWFramesContext hwfc,
AVVkFrame f,
void alloc_pnext,
size_t  alloc_pnext_stride 
)
static

Definition at line 1351 of file hwcontext_vulkan.c.

Referenced by vulkan_pool_alloc().

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

Definition at line 1420 of file hwcontext_vulkan.c.

Referenced by vulkan_map_frame_to_mem(), vulkan_map_to(), and vulkan_pool_alloc().

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

Definition at line 1493 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init(), and vulkan_pool_alloc().

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

Definition at line 1585 of file hwcontext_vulkan.c.

Referenced by vulkan_pool_alloc().

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

Definition at line 1622 of file hwcontext_vulkan.c.

Referenced by vulkan_frames_init().

static void vulkan_frames_uninit ( AVHWFramesContext hwfc)
static

Definition at line 1678 of file hwcontext_vulkan.c.

static int vulkan_frames_init ( AVHWFramesContext hwfc)
static

Definition at line 1687 of file hwcontext_vulkan.c.

static int vulkan_get_buffer ( AVHWFramesContext hwfc,
AVFrame frame 
)
static

Definition at line 1750 of file hwcontext_vulkan.c.

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

Definition at line 1764 of file hwcontext_vulkan.c.

static void vulkan_unmap_frame ( AVHWFramesContext hwfc,
HWMapDescriptor hwmap 
)
static

Definition at line 1784 of file hwcontext_vulkan.c.

Referenced by 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 1816 of file hwcontext_vulkan.c.

Referenced by vulkan_map_from().

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

Definition at line 2435 of file hwcontext_vulkan.c.

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

Definition at line 2608 of file hwcontext_vulkan.c.

static void free_buf ( void opaque,
uint8_t data 
)
static

Definition at line 2635 of file hwcontext_vulkan.c.

Referenced by create_buf().

static int create_buf ( AVHWDeviceContext ctx,
AVBufferRef **  buf,
int  height,
int stride,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlagBits  flags,
void create_pnext,
void alloc_pnext 
)
static

Definition at line 2649 of file hwcontext_vulkan.c.

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

Definition at line 2704 of file hwcontext_vulkan.c.

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

Definition at line 2749 of file hwcontext_vulkan.c.

static int transfer_image_buf ( AVHWFramesContext hwfc,
const AVFrame f,
AVBufferRef **  bufs,
const int buf_stride,
int  w,
int  h,
enum AVPixelFormat  pix_fmt,
int  to_buf 
)
static

Definition at line 2789 of file hwcontext_vulkan.c.

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

Definition at line 2909 of file hwcontext_vulkan.c.

Referenced by vulkan_transfer_data_to().

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

Definition at line 2979 of file hwcontext_vulkan.c.

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

Definition at line 3069 of file hwcontext_vulkan.c.

Referenced by vulkan_transfer_data_from().

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

Definition at line 3134 of file hwcontext_vulkan.c.

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

Referenced by create_frame(), and vulkan_map_frame_to_mem().

Variable Documentation

enum AVPixelFormat pixfmt

Definition at line 139 of file hwcontext_vulkan.c.

Referenced by av_vkfmt_from_pixfmt().

const VkFormat vkfmts[3]

Definition at line 140 of file hwcontext_vulkan.c.

const { ... } vk_pixfmt_map[]

Referenced by av_vkfmt_from_pixfmt().

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

Definition at line 220 of file hwcontext_vulkan.c.

Referenced by check_extensions().

const VulkanOptExtension optional_device_exts[]
static
Initial value:
= {
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, EXT_EXTERNAL_FD_MEMORY, },
{ VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME, EXT_EXTERNAL_DMABUF_MEMORY, },
{ VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME, EXT_DRM_MODIFIER_FLAGS, },
{ VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME, EXT_EXTERNAL_FD_SEM, },
}

Definition at line 224 of file hwcontext_vulkan.c.

Referenced by check_extensions().

const HWContextType ff_hwcontext_type_vulkan
Initial value:
= {
.name = "Vulkan",
.device_hwctx_size = sizeof(AVVulkanDeviceContext),
.device_priv_size = sizeof(VulkanDevicePriv),
.frames_hwctx_size = sizeof(AVVulkanFramesContext),
.frames_priv_size = sizeof(VulkanFramesPriv),
.device_init = &vulkan_device_init,
.device_create = &vulkan_device_create,
.device_derive = &vulkan_device_derive,
.frames_get_constraints = &vulkan_frames_get_constraints,
.frames_init = vulkan_frames_init,
.frames_get_buffer = vulkan_get_buffer,
.frames_uninit = vulkan_frames_uninit,
.transfer_get_formats = vulkan_transfer_get_formats,
.transfer_data_to = vulkan_transfer_data_to,
.transfer_data_from = vulkan_transfer_data_from,
.map_to = vulkan_map_to,
.map_from = vulkan_map_from,
.pix_fmts = (const enum AVPixelFormat []) {
},
}
static int vulkan_map_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags)
static int vulkan_get_buffer(AVHWFramesContext *hwfc, AVFrame *frame)
static int vulkan_transfer_data_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
static int vulkan_frames_get_constraints(AVHWDeviceContext *ctx, const void *hwconfig, AVHWFramesConstraints *constraints)
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
static int vulkan_device_create(AVHWDeviceContext *ctx, const char *device, AVDictionary *opts, int flags)
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
static void vulkan_frames_uninit(AVHWFramesContext *hwfc)
static int vulkan_device_derive(AVHWDeviceContext *ctx, AVHWDeviceContext *src_ctx, AVDictionary *opts, int flags)
Vulkan hardware images.
Definition: pixfmt.h:356
static int vulkan_frames_init(AVHWFramesContext *hwfc)
static int vulkan_map_from(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src, int flags)
static int vulkan_transfer_get_formats(AVHWFramesContext *hwfc, enum AVHWFrameTransferDirection dir, enum AVPixelFormat **formats)
static int vulkan_device_init(AVHWDeviceContext *ctx)
static int vulkan_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src)
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64

Definition at line 3159 of file hwcontext_vulkan.c.