FFmpeg
Data Structures | Macros | Functions | Variables
vulkan.c File Reference
#include "avassert.h"
#include "mem.h"
#include "vulkan.h"
#include "libavutil/vulkan_loader.h"

Go to the source code of this file.

Data Structures

struct  TempSyncCtx
 
struct  ImageViewCtx
 
struct  descriptor_props
 

Macros

#define CASE(VAL)   case VAL: return #VAL
 
#define ARR_REALLOC(str, arr, alloc_s, cnt)
 

Functions

const char * ff_vk_ret2str (VkResult res)
 Converts Vulkan return values to strings. More...
 
static void load_enabled_qfs (FFVulkanContext *s)
 
int ff_vk_load_props (FFVulkanContext *s)
 Loads props/mprops/driver_props. More...
 
static int vk_qf_get_index (FFVulkanContext *s, VkQueueFlagBits dev_family, int *nb)
 
int ff_vk_qf_init (FFVulkanContext *s, FFVkQueueFamilyCtx *qf, VkQueueFlagBits dev_family)
 Chooses a QF and loads it into a context. More...
 
void ff_vk_exec_pool_free (FFVulkanContext *s, FFVkExecPool *pool)
 
int ff_vk_exec_pool_init (FFVulkanContext *s, FFVkQueueFamilyCtx *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext)
 Allocates/frees an execution pool. More...
 
VkResult ff_vk_exec_get_query (FFVulkanContext *s, FFVkExecContext *e, void **data, VkQueryResultFlagBits flags)
 Performs nb_queries queries and returns their results and statuses. More...
 
FFVkExecContextff_vk_exec_get (FFVkExecPool *pool)
 Retrieve an execution pool. More...
 
void ff_vk_exec_wait (FFVulkanContext *s, FFVkExecContext *e)
 
int ff_vk_exec_start (FFVulkanContext *s, FFVkExecContext *e)
 Start/submit/wait an execution. More...
 
void ff_vk_exec_discard_deps (FFVulkanContext *s, FFVkExecContext *e)
 
int ff_vk_exec_add_dep_buf (FFVulkanContext *s, FFVkExecContext *e, AVBufferRef **deps, int nb_deps, int ref)
 Execution dependency management. More...
 
static void destroy_tmp_semaphores (void *opaque, uint8_t *data)
 
int ff_vk_exec_add_dep_bool_sem (FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *sem, int nb, VkPipelineStageFlagBits2 stage, int wait)
 
int ff_vk_exec_add_dep_frame (FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
 
void ff_vk_exec_update_frame (FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkImageMemoryBarrier2 *bar, uint32_t *nb_img_bar)
 
int ff_vk_exec_mirror_sem_value (FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *dst, uint64_t *dst_val, AVFrame *f)
 
int ff_vk_exec_submit (FFVulkanContext *s, FFVkExecContext *e)
 
int ff_vk_alloc_mem (FFVulkanContext *s, VkMemoryRequirements *req, VkMemoryPropertyFlagBits req_flags, void *alloc_extension, VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
 Memory/buffer/image allocation helpers. More...
 
int ff_vk_create_buf (FFVulkanContext *s, FFVkBuffer *buf, size_t size, void *pNext, void *alloc_pNext, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags)
 
static void destroy_avvkbuf (void *opaque, uint8_t *data)
 
int ff_vk_create_avbuf (FFVulkanContext *s, AVBufferRef **ref, size_t size, void *pNext, void *alloc_pNext, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags)
 
int ff_vk_map_buffers (FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[], int nb_buffers, int invalidate)
 Buffer management code. More...
 
int ff_vk_unmap_buffers (FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers, int flush)
 
void ff_vk_free_buf (FFVulkanContext *s, FFVkBuffer *buf)
 
static void free_data_buf (void *opaque, uint8_t *data)
 
static AVBufferRefalloc_data_buf (void *opaque, size_t size)
 
int ff_vk_get_pooled_buffer (FFVulkanContext *ctx, AVBufferPool **buf_pool, AVBufferRef **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size, VkMemoryPropertyFlagBits mem_props)
 Initialize a pool and create AVBufferRefs containing FFVkBuffer. More...
 
int ff_vk_add_push_constant (FFVulkanPipeline *pl, int offset, int size, VkShaderStageFlagBits stage)
 Add/update push constants for execution. More...
 
int ff_vk_init_sampler (FFVulkanContext *s, VkSampler *sampler, int unnorm_coords, VkFilter filt)
 Create a sampler. More...
 
int ff_vk_mt_is_np_rgb (enum AVPixelFormat pix_fmt)
 Returns 1 if pixfmt is a usable RGB format. More...
 
const char * ff_vk_shader_rep_fmt (enum AVPixelFormat pixfmt)
 Returns the format to use for images in shaders. More...
 
static void destroy_imageviews (void *opaque, uint8_t *data)
 
int ff_vk_create_imageviews (FFVulkanContext *s, FFVkExecContext *e, VkImageView views[AV_NUM_DATA_POINTERS], AVFrame *f)
 Create an imageview and add it as a dependency to an execution. More...
 
void ff_vk_frame_barrier (FFVulkanContext *s, FFVkExecContext *e, AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, VkAccessFlagBits new_access, VkImageLayout new_layout, uint32_t new_qf)
 
int ff_vk_shader_init (FFVulkanPipeline *pl, FFVkSPIRVShader *shd, const char *name, VkShaderStageFlags stage, uint32_t required_subgroup_size)
 Shader management. More...
 
void ff_vk_shader_set_compute_sizes (FFVkSPIRVShader *shd, int x, int y, int z)
 
void ff_vk_shader_print (void *ctx, FFVkSPIRVShader *shd, int prio)
 
void ff_vk_shader_free (FFVulkanContext *s, FFVkSPIRVShader *shd)
 
int ff_vk_shader_create (FFVulkanContext *s, FFVkSPIRVShader *shd, uint8_t *spirv, size_t spirv_size, const char *entrypoint)
 
int ff_vk_pipeline_descriptor_set_add (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc, int nb, int singular, int print_to_shader_only)
 Add descriptor to a pipeline. More...
 
int ff_vk_exec_pipeline_register (FFVulkanContext *s, FFVkExecPool *pool, FFVulkanPipeline *pl)
 Register a pipeline with an exec pool. More...
 
static void update_set_descriptor (FFVulkanContext *s, FFVkExecContext *e, FFVulkanDescriptorSet *set, int bind_idx, int array_idx, VkDescriptorGetInfoEXT *desc_get_info, size_t desc_size)
 
static void update_set_pool_write (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkExecContext *e, FFVulkanDescriptorSet *desc_set, int set, VkWriteDescriptorSet *write_info)
 
static int vk_set_descriptor_image (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkExecContext *e, int set, int bind, int offs, VkImageView view, VkImageLayout layout, VkSampler sampler)
 
int ff_vk_set_descriptor_buffer (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkExecContext *e, int set, int bind, int elem, FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len, VkFormat fmt)
 
void ff_vk_update_descriptor_img_array (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkExecContext *e, AVFrame *f, VkImageView *views, int set, int binding, VkImageLayout layout, VkSampler sampler)
 
void ff_vk_update_push_exec (FFVulkanContext *s, FFVkExecContext *e, FFVulkanPipeline *pl, VkShaderStageFlagBits stage, int offset, size_t size, void *src)
 
static int init_descriptors (FFVulkanContext *s, FFVulkanPipeline *pl)
 
static int init_pipeline_layout (FFVulkanContext *s, FFVulkanPipeline *pl)
 
int ff_vk_init_compute_pipeline (FFVulkanContext *s, FFVulkanPipeline *pl, FFVkSPIRVShader *shd)
 
void ff_vk_exec_bind_pipeline (FFVulkanContext *s, FFVkExecContext *e, FFVulkanPipeline *pl)
 
void ff_vk_pipeline_free (FFVulkanContext *s, FFVulkanPipeline *pl)
 
void ff_vk_uninit (FFVulkanContext *s)
 Frees main context. More...
 
int ff_vk_init (FFVulkanContext *s, void *log_parent, AVBufferRef *device_ref, AVBufferRef *frames_ref)
 Initializes the AVClass, in case this context is not used as the main user's context. More...
 

Variables

const VkComponentMapping ff_comp_identity_map
 
static const struct descriptor_props descriptor_props []
 

Macro Definition Documentation

◆ CASE

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

◆ ARR_REALLOC

#define ARR_REALLOC (   str,
  arr,
  alloc_s,
  cnt 
)
Value:
do { \
arr = av_fast_realloc(str->arr, alloc_s, (cnt + 1)*sizeof(*arr)); \
if (!arr) { \
ff_vk_exec_discard_deps(s, e); \
return AVERROR(ENOMEM); \
} \
str->arr = arr; \
} while (0)

Definition at line 565 of file vulkan.c.

Function Documentation

◆ ff_vk_ret2str()

const char* ff_vk_ret2str ( VkResult  res)

◆ load_enabled_qfs()

static void load_enabled_qfs ( FFVulkanContext s)
static

Definition at line 87 of file vulkan.c.

Referenced by ff_vk_load_props(), and ff_vk_qf_init().

◆ ff_vk_load_props()

int ff_vk_load_props ( FFVulkanContext s)

Loads props/mprops/driver_props.

Definition at line 106 of file vulkan.c.

Referenced by ff_vk_filter_init_context(), ff_vk_init(), ff_vulkan_encode_init(), and vulkan_device_init().

◆ vk_qf_get_index()

static int vk_qf_get_index ( FFVulkanContext s,
VkQueueFlagBits  dev_family,
int *  nb 
)
static

Definition at line 216 of file vulkan.c.

Referenced by ff_vk_qf_init().

◆ ff_vk_qf_init()

int ff_vk_qf_init ( FFVulkanContext s,
FFVkQueueFamilyCtx qf,
VkQueueFlagBits  dev_family 
)

Chooses a QF and loads it into a context.

Definition at line 228 of file vulkan.c.

Referenced by init_filter(), init_vulkan(), and vulkan_device_init().

◆ ff_vk_exec_pool_free()

void ff_vk_exec_pool_free ( FFVulkanContext s,
FFVkExecPool pool 
)

◆ ff_vk_exec_pool_init()

int ff_vk_exec_pool_init ( FFVulkanContext s,
FFVkQueueFamilyCtx qf,
FFVkExecPool pool,
int  nb_contexts,
int  nb_queries,
VkQueryType  query_type,
int  query_64bit,
const void *  query_create_pnext 
)

Allocates/frees an execution pool.

ff_vk_exec_pool_init_desc() MUST be called if ff_vk_exec_descriptor_set_add() has been called.

Definition at line 278 of file vulkan.c.

Referenced by ff_vk_decode_init(), ff_vk_update_thread_context(), ff_vulkan_encode_init(), init_filter(), init_vulkan(), and vulkan_frames_init().

◆ ff_vk_exec_get_query()

VkResult ff_vk_exec_get_query ( FFVulkanContext s,
FFVkExecContext e,
void **  data,
VkQueryResultFlagBits  flags 
)

Performs nb_queries queries and returns their results and statuses.

64_BIT and WITH_STATUS flags are ignored as 64_BIT must be specified via query_64bit in ff_vk_exec_pool_init() and WITH_STATUS is always enabled.

Definition at line 435 of file vulkan.c.

Referenced by ff_vk_decode_frame(), and vulkan_encode_output().

◆ ff_vk_exec_get()

FFVkExecContext* ff_vk_exec_get ( FFVkExecPool pool)

◆ ff_vk_exec_wait()

void ff_vk_exec_wait ( FFVulkanContext s,
FFVkExecContext e 
)

Definition at line 470 of file vulkan.c.

Referenced by vulkan_encode_wait(), and vulkan_transfer_frame().

◆ ff_vk_exec_start()

int ff_vk_exec_start ( FFVulkanContext s,
FFVkExecContext e 
)

Start/submit/wait an execution.

ff_vk_exec_start() always waits on a submission, so using ff_vk_exec_wait() is not necessary (unless using it is just better).

Definition at line 479 of file vulkan.c.

Referenced by ff_vk_decode_flush(), ff_vk_decode_frame(), ff_vk_filter_process_2pass(), ff_vk_filter_process_Nin(), ff_vk_filter_process_simple(), prepare_frame(), vulkan_encode_issue(), and vulkan_transfer_frame().

◆ ff_vk_exec_discard_deps()

void ff_vk_exec_discard_deps ( FFVulkanContext s,
FFVkExecContext e 
)

◆ ff_vk_exec_add_dep_buf()

int ff_vk_exec_add_dep_buf ( FFVulkanContext s,
FFVkExecContext e,
AVBufferRef **  deps,
int  nb_deps,
int  ref 
)

Execution dependency management.

Can attach buffers to executions that will only be unref'd once the buffer has finished executing. Adding a frame dep will lock the frame, until either the dependencies are discarded, the execution is submitted, or a failure happens. update_frame will update the frame's properties before it is unlocked, only if submission was successful.

Definition at line 541 of file vulkan.c.

Referenced by ff_vk_create_imageviews(), ff_vk_decode_frame(), ff_vk_exec_add_dep_bool_sem(), vulkan_encode_issue(), and vulkan_transfer_frame().

◆ destroy_tmp_semaphores()

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

Definition at line 580 of file vulkan.c.

Referenced by ff_vk_exec_add_dep_bool_sem().

◆ ff_vk_exec_add_dep_bool_sem()

int ff_vk_exec_add_dep_bool_sem ( FFVulkanContext s,
FFVkExecContext e,
VkSemaphore *  sem,
int  nb,
VkPipelineStageFlagBits2  stage,
int  wait 
)

Definition at line 592 of file vulkan.c.

◆ ff_vk_exec_add_dep_frame()

int ff_vk_exec_add_dep_frame ( FFVulkanContext s,
FFVkExecContext e,
AVFrame f,
VkPipelineStageFlagBits2  wait_stage,
VkPipelineStageFlagBits2  signal_stage 
)

◆ ff_vk_exec_update_frame()

void ff_vk_exec_update_frame ( FFVulkanContext s,
FFVkExecContext e,
AVFrame f,
VkImageMemoryBarrier2 *  bar,
uint32_t *  nb_img_bar 
)

Definition at line 733 of file vulkan.c.

Referenced by ff_vk_decode_frame(), ff_vk_frame_barrier(), and vulkan_encode_issue().

◆ ff_vk_exec_mirror_sem_value()

int ff_vk_exec_mirror_sem_value ( FFVulkanContext s,
FFVkExecContext e,
VkSemaphore *  dst,
uint64_t *  dst_val,
AVFrame f 
)

Definition at line 752 of file vulkan.c.

Referenced by ff_vk_decode_frame().

◆ ff_vk_exec_submit()

int ff_vk_exec_submit ( FFVulkanContext s,
FFVkExecContext e 
)

◆ ff_vk_alloc_mem()

int ff_vk_alloc_mem ( FFVulkanContext s,
VkMemoryRequirements *  req,
VkMemoryPropertyFlagBits  req_flags,
void *  alloc_extension,
VkMemoryPropertyFlagBits *  mem_flags,
VkDeviceMemory *  mem 
)

Memory/buffer/image allocation helpers.

Definition at line 844 of file vulkan.c.

Referenced by create_mapped_buffer(), ff_vk_create_buf(), and ff_vk_video_common_init().

◆ ff_vk_create_buf()

int ff_vk_create_buf ( FFVulkanContext s,
FFVkBuffer buf,
size_t  size,
void *  pNext,
void *  alloc_pNext,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlagBits  flags 
)

◆ destroy_avvkbuf()

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

Definition at line 986 of file vulkan.c.

Referenced by ff_vk_create_avbuf().

◆ ff_vk_create_avbuf()

int ff_vk_create_avbuf ( FFVulkanContext s,
AVBufferRef **  ref,
size_t  size,
void *  pNext,
void *  alloc_pNext,
VkBufferUsageFlags  usage,
VkMemoryPropertyFlagBits  flags 
)

Definition at line 994 of file vulkan.c.

◆ ff_vk_map_buffers()

int ff_vk_map_buffers ( FFVulkanContext s,
FFVkBuffer **  buf,
uint8_t *  mem[],
int  nb_buffers,
int  invalidate 
)

Buffer management code.

Definition at line 1021 of file vulkan.c.

Referenced by ff_vk_map_buffer().

◆ ff_vk_unmap_buffers()

int ff_vk_unmap_buffers ( FFVulkanContext s,
FFVkBuffer **  buf,
int  nb_buffers,
int  flush 
)

Definition at line 1068 of file vulkan.c.

Referenced by ff_vk_unmap_buffer().

◆ ff_vk_free_buf()

void ff_vk_free_buf ( FFVulkanContext s,
FFVkBuffer buf 
)

◆ free_data_buf()

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

Definition at line 1121 of file vulkan.c.

Referenced by alloc_data_buf().

◆ alloc_data_buf()

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

Definition at line 1129 of file vulkan.c.

Referenced by ff_vk_get_pooled_buffer().

◆ ff_vk_get_pooled_buffer()

int ff_vk_get_pooled_buffer ( FFVulkanContext ctx,
AVBufferPool **  buf_pool,
AVBufferRef **  buf,
VkBufferUsageFlags  usage,
void *  create_pNext,
size_t  size,
VkMemoryPropertyFlagBits  mem_props 
)

Initialize a pool and create AVBufferRefs containing FFVkBuffer.

Threadsafe to use. Buffers are automatically mapped on creation if VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT is set in mem_props. Users should synchronize access themselvesd. Mainly meant for device-local buffers.

Definition at line 1142 of file vulkan.c.

Referenced by ff_vk_decode_add_slice(), get_plane_buf(), and vulkan_encode_issue().

◆ ff_vk_add_push_constant()

int ff_vk_add_push_constant ( FFVulkanPipeline pl,
int  offset,
int  size,
VkShaderStageFlagBits  stage 
)

Add/update push constants for execution.

Definition at line 1194 of file vulkan.c.

Referenced by init_filter(), and init_vulkan().

◆ ff_vk_init_sampler()

int ff_vk_init_sampler ( FFVulkanContext s,
VkSampler *  sampler,
int  unnorm_coords,
VkFilter  filt 
)

Create a sampler.

Definition at line 1214 of file vulkan.c.

Referenced by init_filter(), and init_vulkan().

◆ ff_vk_mt_is_np_rgb()

int ff_vk_mt_is_np_rgb ( enum AVPixelFormat  pix_fmt)

Returns 1 if pixfmt is a usable RGB format.

Definition at line 1246 of file vulkan.c.

Referenced by scale_vulkan_config_output().

◆ ff_vk_shader_rep_fmt()

const char* ff_vk_shader_rep_fmt ( enum AVPixelFormat  pixfmt)

Returns the format to use for images in shaders.

Definition at line 1259 of file vulkan.c.

Referenced by init_filter(), and init_vulkan().

◆ destroy_imageviews()

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

Definition at line 1271 of file vulkan.c.

Referenced by ff_vk_create_imageviews().

◆ ff_vk_create_imageviews()

int ff_vk_create_imageviews ( FFVulkanContext s,
FFVkExecContext e,
VkImageView  views[AV_NUM_DATA_POINTERS],
AVFrame f 
)

Create an imageview and add it as a dependency to an execution.

Definition at line 1283 of file vulkan.c.

Referenced by ff_vk_filter_process_2pass(), ff_vk_filter_process_Nin(), and ff_vk_filter_process_simple().

◆ ff_vk_frame_barrier()

void ff_vk_frame_barrier ( FFVulkanContext s,
FFVkExecContext e,
AVFrame pic,
VkImageMemoryBarrier2 *  bar,
int *  nb_bar,
VkPipelineStageFlags  src_stage,
VkPipelineStageFlags  dst_stage,
VkAccessFlagBits  new_access,
VkImageLayout  new_layout,
uint32_t  new_qf 
)

◆ ff_vk_shader_init()

int ff_vk_shader_init ( FFVulkanPipeline pl,
FFVkSPIRVShader shd,
const char *  name,
VkShaderStageFlags  stage,
uint32_t  required_subgroup_size 
)

Shader management.

Definition at line 1400 of file vulkan.c.

Referenced by init_filter(), and init_vulkan().

◆ ff_vk_shader_set_compute_sizes()

void ff_vk_shader_set_compute_sizes ( FFVkSPIRVShader shd,
int  x,
int  y,
int  z 
)

Definition at line 1426 of file vulkan.c.

Referenced by init_filter(), and init_vulkan().

◆ ff_vk_shader_print()

void ff_vk_shader_print ( void *  ctx,
FFVkSPIRVShader shd,
int  prio 
)

Definition at line 1437 of file vulkan.c.

Referenced by glslc_shader_compile(), and shdc_shader_compile().

◆ ff_vk_shader_free()

void ff_vk_shader_free ( FFVulkanContext s,
FFVkSPIRVShader shd 
)

◆ ff_vk_shader_create()

int ff_vk_shader_create ( FFVulkanContext s,
FFVkSPIRVShader shd,
uint8_t *  spirv,
size_t  spirv_size,
const char *  entrypoint 
)

Definition at line 1468 of file vulkan.c.

Referenced by init_filter(), init_gblur_pipeline(), and init_vulkan().

◆ ff_vk_pipeline_descriptor_set_add()

int ff_vk_pipeline_descriptor_set_add ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkSPIRVShader shd,
FFVulkanDescriptorSetBinding desc,
int  nb,
int  singular,
int  print_to_shader_only 
)

Add descriptor to a pipeline.

Must be called before pipeline init.

Definition at line 1518 of file vulkan.c.

Referenced by init_filter(), init_gblur_pipeline(), and init_vulkan().

◆ ff_vk_exec_pipeline_register()

int ff_vk_exec_pipeline_register ( FFVulkanContext s,
FFVkExecPool pool,
FFVulkanPipeline pl 
)

Register a pipeline with an exec pool.

Pool may be NULL if all descriptor sets are read-only.

Definition at line 1630 of file vulkan.c.

Referenced by init_filter(), init_gblur_pipeline(), and init_vulkan().

◆ update_set_descriptor()

static void update_set_descriptor ( FFVulkanContext s,
FFVkExecContext e,
FFVulkanDescriptorSet set,
int  bind_idx,
int  array_idx,
VkDescriptorGetInfoEXT *  desc_get_info,
size_t  desc_size 
)
inlinestatic

Definition at line 1736 of file vulkan.c.

Referenced by ff_vk_set_descriptor_buffer(), and vk_set_descriptor_image().

◆ update_set_pool_write()

static void update_set_pool_write ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkExecContext e,
FFVulkanDescriptorSet desc_set,
int  set,
VkWriteDescriptorSet *  write_info 
)
inlinestatic

Definition at line 1752 of file vulkan.c.

Referenced by ff_vk_set_descriptor_buffer(), and vk_set_descriptor_image().

◆ vk_set_descriptor_image()

static int vk_set_descriptor_image ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkExecContext e,
int  set,
int  bind,
int  offs,
VkImageView  view,
VkImageLayout  layout,
VkSampler  sampler 
)
static

Definition at line 1778 of file vulkan.c.

Referenced by ff_vk_update_descriptor_img_array().

◆ ff_vk_set_descriptor_buffer()

int ff_vk_set_descriptor_buffer ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkExecContext e,
int  set,
int  bind,
int  elem,
FFVkBuffer buf,
VkDeviceSize  offset,
VkDeviceSize  len,
VkFormat  fmt 
)

Definition at line 1843 of file vulkan.c.

Referenced by init_gblur_pipeline().

◆ ff_vk_update_descriptor_img_array()

void ff_vk_update_descriptor_img_array ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkExecContext e,
AVFrame f,
VkImageView *  views,
int  set,
int  binding,
VkImageLayout  layout,
VkSampler  sampler 
)

◆ ff_vk_update_push_exec()

void ff_vk_update_push_exec ( FFVulkanContext s,
FFVkExecContext e,
FFVulkanPipeline pl,
VkShaderStageFlagBits  stage,
int  offset,
size_t  size,
void *  src 
)

◆ init_descriptors()

static int init_descriptors ( FFVulkanContext s,
FFVulkanPipeline pl 
)
static

Definition at line 1931 of file vulkan.c.

Referenced by ff_vk_init_compute_pipeline().

◆ init_pipeline_layout()

static int init_pipeline_layout ( FFVulkanContext s,
FFVulkanPipeline pl 
)
static

Definition at line 1995 of file vulkan.c.

Referenced by ff_vk_init_compute_pipeline().

◆ ff_vk_init_compute_pipeline()

int ff_vk_init_compute_pipeline ( FFVulkanContext s,
FFVulkanPipeline pl,
FFVkSPIRVShader shd 
)

Definition at line 2021 of file vulkan.c.

Referenced by init_filter(), init_gblur_pipeline(), and init_vulkan().

◆ ff_vk_exec_bind_pipeline()

void ff_vk_exec_bind_pipeline ( FFVulkanContext s,
FFVkExecContext e,
FFVulkanPipeline pl 
)

◆ ff_vk_pipeline_free()

void ff_vk_pipeline_free ( FFVulkanContext s,
FFVulkanPipeline pl 
)

◆ ff_vk_uninit()

void ff_vk_uninit ( FFVulkanContext s)

◆ ff_vk_init()

int ff_vk_init ( FFVulkanContext s,
void *  log_parent,
AVBufferRef device_ref,
AVBufferRef frames_ref 
)

Initializes the AVClass, in case this context is not used as the main user's context.

May use either a frames context reference, or a device context reference.

Definition at line 2141 of file vulkan.c.

Referenced by ff_vk_decode_init().

Variable Documentation

◆ ff_comp_identity_map

const VkComponentMapping ff_comp_identity_map
Initial value:
= {
.r = VK_COMPONENT_SWIZZLE_IDENTITY,
.g = VK_COMPONENT_SWIZZLE_IDENTITY,
.b = VK_COMPONENT_SWIZZLE_IDENTITY,
.a = VK_COMPONENT_SWIZZLE_IDENTITY,
}

Definition at line 27 of file vulkan.c.

Referenced by ff_vk_create_imageviews(), and ff_vk_video_common_init().

◆ descriptor_props

const struct descriptor_props descriptor_props[]
static
Initial value:
= {
[VK_DESCRIPTOR_TYPE_SAMPLER] = { sizeof(VkDescriptorImageInfo), "sampler", 1, 0, 0, 0, },
[VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE] = { sizeof(VkDescriptorImageInfo), "texture", 1, 0, 1, 0, },
[VK_DESCRIPTOR_TYPE_STORAGE_IMAGE] = { sizeof(VkDescriptorImageInfo), "image", 1, 1, 1, 0, },
[VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT] = { sizeof(VkDescriptorImageInfo), "subpassInput", 1, 0, 0, 0, },
[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER] = { sizeof(VkDescriptorImageInfo), "sampler", 1, 0, 1, 0, },
[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER] = { sizeof(VkDescriptorBufferInfo), NULL, 1, 0, 0, 1, },
[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER] = { sizeof(VkDescriptorBufferInfo), "buffer", 0, 1, 0, 1, },
[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC] = { sizeof(VkDescriptorBufferInfo), NULL, 1, 0, 0, 1, },
[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC] = { sizeof(VkDescriptorBufferInfo), "buffer", 0, 1, 0, 1, },
[VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER] = { sizeof(VkBufferView), "samplerBuffer", 1, 0, 0, 0, },
[VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER] = { sizeof(VkBufferView), "imageBuffer", 1, 0, 0, 0, },
}
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_fast_realloc
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
Definition: mem.c:497
s
#define s(width, name)
Definition: cbs_vp9.c:198
NULL
#define NULL
Definition: coverity.c:32