FFmpeg
vulkan.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVFILTER_VULKAN_H
20 #define AVFILTER_VULKAN_H
21 
22 #define VK_NO_PROTOTYPES
23 #define VK_ENABLE_BETA_EXTENSIONS
24 
25 #include "avfilter.h"
26 #include "libavutil/pixdesc.h"
27 #include "libavutil/bprint.h"
28 #include "libavutil/hwcontext.h"
31 
32 /* GLSL management macros */
33 #define INDENT(N) INDENT_##N
34 #define INDENT_0
35 #define INDENT_1 INDENT_0 " "
36 #define INDENT_2 INDENT_1 INDENT_1
37 #define INDENT_3 INDENT_2 INDENT_1
38 #define INDENT_4 INDENT_3 INDENT_1
39 #define INDENT_5 INDENT_4 INDENT_1
40 #define INDENT_6 INDENT_5 INDENT_1
41 #define C(N, S) INDENT(N) #S "\n"
42 #define GLSLC(N, S) av_bprintf(&shd->src, C(N, S))
43 #define GLSLA(...) av_bprintf(&shd->src, __VA_ARGS__)
44 #define GLSLF(N, S, ...) av_bprintf(&shd->src, C(N, S), __VA_ARGS__)
45 #define GLSLD(D) GLSLC(0, ); \
46  av_bprint_append_data(&shd->src, D, strlen(D)); \
47  GLSLC(0, )
48 
49 /* Helper, pretty much every Vulkan return value needs to be checked */
50 #define RET(x) \
51  do { \
52  if ((err = (x)) < 0) \
53  goto fail; \
54  } while (0)
55 
56 typedef struct FFSPIRVShader {
57  const char *name; /* Name for id/debugging purposes */
58  AVBPrint src;
59  int local_size[3]; /* Compute shader workgroup sizes */
60  VkPipelineShaderStageCreateInfo shader;
62 
63 typedef struct FFVkSampler {
64  VkSampler sampler[4];
65 } FFVkSampler;
66 
68  const char *name;
69  VkDescriptorType type;
70  const char *mem_layout; /* Storage images (rgba8, etc.) and buffers (std430, etc.) */
71  const char *mem_quali; /* readonly, writeonly, etc. */
72  const char *buf_content; /* For buffers */
73  uint32_t dimensions; /* Needed for e.g. sampler%iD */
74  uint32_t elems; /* 0 - scalar, 1 or more - vector */
75  VkShaderStageFlags stages;
76  FFVkSampler *sampler; /* Sampler to use for all elems */
77  void *updater; /* Pointer to VkDescriptor*Info */
79 
80 typedef struct FFVkBuffer {
81  VkBuffer buf;
82  VkDeviceMemory mem;
83  VkMemoryPropertyFlagBits flags;
84 } FFVkBuffer;
85 
86 typedef struct FFVkQueueFamilyCtx {
88  int nb_queues;
89  int cur_queue;
92 
93 typedef struct FFVulkanPipeline {
95 
96  VkPipelineBindPoint bind_point;
97 
98  /* Contexts */
99  VkPipelineLayout pipeline_layout;
100  VkPipeline pipeline;
101 
102  /* Shaders */
105 
106  /* Push consts */
107  VkPushConstantRange *push_consts;
109 
110  /* Descriptors */
111  VkDescriptorSetLayout *desc_layout;
112  VkDescriptorPool desc_pool;
113  VkDescriptorSet *desc_set;
114  void **desc_staging;
115  VkDescriptorSetLayoutBinding **desc_binding;
116  VkDescriptorUpdateTemplate *desc_template;
122 
123  /* Temporary, used to store data in between initialization stages */
124  VkDescriptorUpdateTemplateCreateInfo *desc_template_info;
125  VkDescriptorPoolSize *pool_size_desc;
127 
128 typedef struct FFVkQueueCtx {
129  VkFence fence;
130  VkQueue queue;
131 
132  /* Buffer dependencies */
136 
137  /* Frame dependencies */
141 } FFVkQueueCtx;
142 
143 typedef struct FFVkExecContext {
145 
146  VkCommandPool pool;
147  VkCommandBuffer *bufs;
149 
151  int *nb_deps;
153 
155 
156  VkSemaphore *sem_wait;
157  int sem_wait_alloc; /* Allocated sem_wait */
159 
160  uint64_t *sem_wait_val;
162 
163  VkPipelineStageFlagBits *sem_wait_dst;
164  int sem_wait_dst_alloc; /* Allocated sem_wait_dst */
165 
166  VkSemaphore *sem_sig;
167  int sem_sig_alloc; /* Allocated sem_sig */
169 
170  uint64_t *sem_sig_val;
172 
173  uint64_t **sem_sig_val_dst;
176 
177 typedef struct FFVulkanContext {
178  const AVClass *class;
181  VkPhysicalDeviceProperties props;
182  VkPhysicalDeviceMemoryProperties mprops;
183 
185  AVBufferRef *frames_ref; /* For in-place filtering */
188 
189  /* Properties */
194 
195  /* Samplers */
198 
199  /* Exec contexts */
202 
203  /* Pipelines (each can have 1 shader of each type) */
206 
207  void *scratch; /* Scratch memory used only in functions */
208  unsigned int scratch_size;
210 
211 /* Identity mapping - r = r, b = b, g = g, a = a */
212 extern const VkComponentMapping ff_comp_identity_map;
213 
214 /**
215  * General lavfi IO functions
216  */
222 
223 /**
224  * Converts Vulkan return values to strings
225  */
226 const char *ff_vk_ret2str(VkResult res);
227 
228 /**
229  * Returns 1 if the image is any sort of supported RGB
230  */
232 
233 /**
234  * Gets the glsl format string for a pixel format
235  */
236 const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt);
237 
238 /**
239  * Initialize a queue family with a specific number of queues.
240  * If nb_queues == 0, use however many queues the queue family has.
241  */
243  VkQueueFlagBits dev_family, int nb_queues);
244 
245 /**
246  * Rotate through the queues in a queue family.
247  */
249 
250 /**
251  * Create a Vulkan sampler, will be auto-freed in ff_vk_filter_uninit()
252  */
253 FFVkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords,
254  VkFilter filt);
255 
256 /**
257  * Create an imageview.
258  * Guaranteed to remain alive until the queue submission has finished executing,
259  * and will be destroyed after that.
260  */
262  VkImageView *v, VkImage img, VkFormat fmt,
263  const VkComponentMapping map);
264 
265 /**
266  * Define a push constant for a given stage into a pipeline.
267  * Must be called before the pipeline layout has been initialized.
268  */
270  int offset, int size, VkShaderStageFlagBits stage);
271 
272 /**
273  * Inits a pipeline. Everything in it will be auto-freed when calling
274  * ff_vk_filter_uninit().
275  */
277  FFVkQueueFamilyCtx *qf);
278 
279 /**
280  * Inits a shader for a specific pipeline. Will be auto-freed on uninit.
281  */
283  const char *name, VkShaderStageFlags stage);
284 
285 /**
286  * Writes the workgroup size for a shader.
287  */
289  int local_size[3]);
290 
291 /**
292  * Adds a descriptor set to the shader and registers them in the pipeline.
293  */
296  int num, int only_print_to_shader);
297 
298 /**
299  * Compiles the shader, entrypoint must be set to "main".
300  */
302  const char *entrypoint);
303 
304 /**
305  * Pretty print shader, mainly used by shader compilers.
306  */
307 void ff_vk_print_shader(AVFilterContext *avctx, FFSPIRVShader *shd, int prio);
308 
309 /**
310  * Initializes the pipeline layout after all shaders and descriptor sets have
311  * been finished.
312  */
314 
315 /**
316  * Initializes a compute pipeline. Will pick the first shader with the
317  * COMPUTE flag set.
318  */
320 
321 /**
322  * Updates a descriptor set via the updaters defined.
323  * Can be called immediately after pipeline creation, but must be called
324  * at least once before queue submission.
325  */
327  int set_id);
328 
329 /**
330  * Init an execution context for command recording and queue submission.
331  * WIll be auto-freed on uninit.
332  */
334  FFVkQueueFamilyCtx *qf);
335 
336 /**
337  * Begin recording to the command buffer. Previous execution must have been
338  * completed, which ff_vk_submit_exec_queue() will ensure.
339  */
341 
342 /**
343  * Add a command to bind the completed pipeline and its descriptor sets.
344  * Must be called after ff_vk_start_exec_recording() and before submission.
345  */
347  FFVulkanPipeline *pl);
348 
349 /**
350  * Updates push constants.
351  * Must be called after binding a pipeline if any push constants were defined.
352  */
354  VkShaderStageFlagBits stage, int offset,
355  size_t size, void *src);
356 
357 /**
358  * Gets the command buffer to use for this submission from the exe context.
359  */
360 VkCommandBuffer ff_vk_get_exec_buf(AVFilterContext *avctx, FFVkExecContext *e);
361 
362 /**
363  * Adds a generic AVBufferRef as a queue depenency.
364  */
366  AVBufferRef **deps, int nb_deps);
367 
368 /**
369  * Discards all queue dependencies
370  */
372 
373 /**
374  * Adds a frame as a queue dependency. This also manages semaphore signalling.
375  * Must be called before submission.
376  */
378  AVFrame *frame, VkPipelineStageFlagBits in_wait_dst_flag);
379 
380 /**
381  * Submits a command buffer to the queue for execution.
382  * Will block until execution has finished in order to simplify resource
383  * management.
384  */
386 
387 /**
388  * Create a VkBuffer with the specified parameters.
389  */
390 int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size,
391  VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags);
392 
393 /**
394  * Maps the buffer to userspace. Set invalidate to 1 if reading the contents
395  * is necessary.
396  */
397 int ff_vk_map_buffers(AVFilterContext *avctx, FFVkBuffer *buf, uint8_t *mem[],
398  int nb_buffers, int invalidate);
399 
400 /**
401  * Unmaps the buffer from userspace. Set flush to 1 to write and sync.
402  */
403 int ff_vk_unmap_buffers(AVFilterContext *avctx, FFVkBuffer *buf, int nb_buffers,
404  int flush);
405 
406 /**
407  * Frees a buffer.
408  */
409 void ff_vk_free_buf(AVFilterContext *avctx, FFVkBuffer *buf);
410 
411 #endif /* AVFILTER_VULKAN_H */
FFVkExecContext::queues
FFVkQueueCtx * queues
Definition: vulkan.h:148
ff_vk_start_exec_recording
int ff_vk_start_exec_recording(AVFilterContext *avctx, FFVkExecContext *e)
Begin recording to the command buffer.
Definition: vulkan.c:465
ff_vk_ret2str
const char * ff_vk_ret2str(VkResult res)
Converts Vulkan return values to strings.
Definition: vulkan.c:55
FFVulkanPipeline::bind_point
VkPipelineBindPoint bind_point
Definition: vulkan.h:96
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
name
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 default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
FFVkExecContext::sem_wait_dst_alloc
int sem_wait_dst_alloc
Definition: vulkan.h:164
FFVkExecContext::sem_wait
VkSemaphore * sem_wait
Definition: vulkan.h:156
FFVulkanContext::output_height
int output_height
Definition: vulkan.h:191
FFVulkanPipeline::shaders_num
int shaders_num
Definition: vulkan.h:104
FFVkExecContext::qf
FFVkQueueFamilyCtx * qf
Definition: vulkan.h:144
FFVulkanPipeline::pipeline_layout
VkPipelineLayout pipeline_layout
Definition: vulkan.h:99
FFVulkanContext::device_ref
AVBufferRef * device_ref
Definition: vulkan.h:184
FFVulkanContext::pipelines_num
int pipelines_num
Definition: vulkan.h:205
FFVkExecContext::sem_sig
VkSemaphore * sem_sig
Definition: vulkan.h:166
ff_vk_bind_pipeline_exec
void ff_vk_bind_pipeline_exec(AVFilterContext *avctx, FFVkExecContext *e, FFVulkanPipeline *pl)
Add a command to bind the completed pipeline and its descriptor sets.
Definition: vulkan.c:1441
ff_vk_filter_uninit
void ff_vk_filter_uninit(AVFilterContext *avctx)
Definition: vulkan.c:1557
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:310
pixdesc.h
FFVulkanDescriptorSetBinding::stages
VkShaderStageFlags stages
Definition: vulkan.h:75
FFVkQueueCtx::buf_deps_alloc_size
int buf_deps_alloc_size
Definition: vulkan.h:135
ff_vk_init_shader
FFSPIRVShader * ff_vk_init_shader(AVFilterContext *avctx, FFVulkanPipeline *pl, const char *name, VkShaderStageFlags stage)
Inits a shader for a specific pipeline.
Definition: vulkan.c:976
ff_vk_update_push_exec
void ff_vk_update_push_exec(AVFilterContext *avctx, FFVkExecContext *e, VkShaderStageFlagBits stage, int offset, size_t size, void *src)
Updates push constants.
Definition: vulkan.c:1279
FFVulkanPipeline::desc_pool
VkDescriptorPool desc_pool
Definition: vulkan.h:112
FFVulkanDescriptorSetBinding::buf_content
const char * buf_content
Definition: vulkan.h:72
FFVulkanPipeline::desc_staging
void ** desc_staging
Definition: vulkan.h:114
FFVkExecContext::bound_pl
FFVulkanPipeline * bound_pl
Definition: vulkan.h:154
ff_vk_create_buf
int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags)
Create a VkBuffer with the specified parameters.
Definition: vulkan.c:192
ff_vk_submit_exec_queue
int ff_vk_submit_exec_queue(AVFilterContext *avctx, FFVkExecContext *e)
Submits a command buffer to the queue for execution.
Definition: vulkan.c:593
FFVkSampler
Definition: vulkan.h:63
ff_vk_shader_rep_fmt
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt)
Gets the glsl format string for a pixel format.
Definition: vulkan.c:901
FFVkBuffer::buf
VkBuffer buf
Definition: vulkan.h:81
FFVkExecContext::deps
AVBufferRef *** deps
Definition: vulkan.h:150
ff_vk_free_buf
void ff_vk_free_buf(AVFilterContext *avctx, FFVkBuffer *buf)
Frees a buffer.
Definition: vulkan.c:351
ff_vk_add_push_constant
int ff_vk_add_push_constant(AVFilterContext *avctx, FFVulkanPipeline *pl, int offset, int size, VkShaderStageFlagBits stage)
Define a push constant for a given stage into a pipeline.
Definition: vulkan.c:365
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan.c:836
FFVkExecContext::sem_wait_dst
VkPipelineStageFlagBits * sem_wait_dst
Definition: vulkan.h:163
FFVulkanContext::samplers
FFVkSampler ** samplers
Definition: vulkan.h:196
FFVulkanPipeline::pipeline
VkPipeline pipeline
Definition: vulkan.h:100
FFSPIRVShader::name
const char * name
Definition: vulkan.h:57
FFVulkanContext::scratch
void * scratch
Definition: vulkan.h:207
FFVkExecContext::sem_sig_val_dst_alloc
int sem_sig_val_dst_alloc
Definition: vulkan.h:174
FFVulkanContext::frames_ref
AVBufferRef * frames_ref
Definition: vulkan.h:185
ff_vk_init_sampler
FFVkSampler * ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords, VkFilter filt)
Create a Vulkan sampler, will be auto-freed in ff_vk_filter_uninit()
Definition: vulkan.c:849
ff_vk_set_compute_shader_sizes
void ff_vk_set_compute_shader_sizes(AVFilterContext *avctx, FFSPIRVShader *shd, int local_size[3])
Writes the workgroup size for a shader.
Definition: vulkan.c:997
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:61
FFVulkanDescriptorSetBinding::type
VkDescriptorType type
Definition: vulkan.h:69
FFVulkanContext::samplers_num
int samplers_num
Definition: vulkan.h:197
FFVkQueueFamilyCtx::actual_queues
int actual_queues
Definition: vulkan.h:90
FFVkQueueCtx::queue
VkQueue queue
Definition: vulkan.h:130
FFVulkanDescriptorSetBinding::elems
uint32_t elems
Definition: vulkan.h:74
FFVulkanContext::output_width
int output_width
Definition: vulkan.h:190
FFVulkanContext::exec_ctx
FFVkExecContext ** exec_ctx
Definition: vulkan.h:200
FFVkQueueCtx::frame_deps
AVFrame ** frame_deps
Definition: vulkan.h:138
FFVkExecContext::sem_sig_alloc
int sem_sig_alloc
Definition: vulkan.h:167
FFVkExecContext::dep_alloc_size
int * dep_alloc_size
Definition: vulkan.h:152
FFVulkanPipeline::desc_template
VkDescriptorUpdateTemplate * desc_template
Definition: vulkan.h:116
ff_vk_create_imageview
int ff_vk_create_imageview(AVFilterContext *avctx, FFVkExecContext *e, VkImageView *v, VkImage img, VkFormat fmt, const VkComponentMapping map)
Create an imageview.
Definition: vulkan.c:922
FFVulkanContext::pipelines
FFVulkanPipeline ** pipelines
Definition: vulkan.h:204
ctx
AVFormatContext * ctx
Definition: movenc.c:48
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demuxing_decoding.c:41
FFVkExecContext::sem_sig_val
uint64_t * sem_sig_val
Definition: vulkan.h:170
FFVulkanDescriptorSetBinding::mem_layout
const char * mem_layout
Definition: vulkan.h:70
FFVulkanPipeline::desc_template_info
VkDescriptorUpdateTemplateCreateInfo * desc_template_info
Definition: vulkan.h:124
FFVkSampler::sampler
VkSampler sampler[4]
Definition: vulkan.h:64
ff_vk_add_descriptor_set
int ff_vk_add_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl, FFSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc, int num, int only_print_to_shader)
Adds a descriptor set to the shader and registers them in the pipeline.
Definition: vulkan.c:1094
AVVulkanDeviceContext
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vulkan.h:42
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
FFVkQueueCtx
Definition: vulkan.h:128
flush
static void flush(AVCodecContext *avctx)
Definition: aacdec_template.c:593
FFVkExecContext::sem_wait_alloc
int sem_wait_alloc
Definition: vulkan.h:157
FFVkExecContext::sem_sig_cnt
int sem_sig_cnt
Definition: vulkan.h:168
FFVulkanDescriptorSetBinding::dimensions
uint32_t dimensions
Definition: vulkan.h:73
src
#define src
Definition: vp8dsp.c:255
hwcontext_vulkan.h
ff_vk_discard_exec_deps
void ff_vk_discard_exec_deps(AVFilterContext *avctx, FFVkExecContext *e)
Discards all queue dependencies.
Definition: vulkan.c:449
FFVulkanDescriptorSetBinding::updater
void * updater
Definition: vulkan.h:77
FFVkExecContext::sem_sig_val_alloc
int sem_sig_val_alloc
Definition: vulkan.h:171
FFVulkanContext
Definition: vulkan.h:177
FFVulkanPipeline::desc_binding
VkDescriptorSetLayoutBinding ** desc_binding
Definition: vulkan.h:115
ff_vk_add_exec_dep
int ff_vk_add_exec_dep(AVFilterContext *avctx, FFVkExecContext *e, AVFrame *frame, VkPipelineStageFlagBits in_wait_dst_flag)
Adds a frame as a queue dependency.
Definition: vulkan.c:512
FFVulkanPipeline
Definition: vulkan.h:93
FFVulkanContext::device
AVHWDeviceContext * device
Definition: vulkan.h:186
ff_vk_qf_init
void ff_vk_qf_init(AVFilterContext *avctx, FFVkQueueFamilyCtx *qf, VkQueueFlagBits dev_family, int nb_queues)
Initialize a queue family with a specific number of queues.
Definition: vulkan.c:92
usage
const char * usage
Definition: floatimg_cmp.c:60
FFVkQueueCtx::fence
VkFence fence
Definition: vulkan.h:129
FFVulkanPipeline::desc_layout_num
int desc_layout_num
Definition: vulkan.h:118
FFVkExecContext::pool
VkCommandPool pool
Definition: vulkan.h:146
FFVulkanPipeline::total_descriptor_sets
int total_descriptor_sets
Definition: vulkan.h:120
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan.c:785
FFVulkanDescriptorSetBinding
Definition: vulkan.h:67
ff_vk_init_compute_pipeline
int ff_vk_init_compute_pipeline(AVFilterContext *avctx, FFVulkanPipeline *pl)
Initializes a compute pipeline.
Definition: vulkan.c:1405
ff_vk_unmap_buffers
int ff_vk_unmap_buffers(AVFilterContext *avctx, FFVkBuffer *buf, int nb_buffers, int flush)
Unmaps the buffer from userspace.
Definition: vulkan.c:308
size
int size
Definition: twinvq_data.h:10344
FFVulkanContext::props
VkPhysicalDeviceProperties props
Definition: vulkan.h:181
ff_vk_create_exec_ctx
int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx, FFVkQueueFamilyCtx *qf)
Init an execution context for command recording and queue submission.
Definition: vulkan.c:386
FFVkQueueFamilyCtx
Definition: vulkan.h:86
FFVulkanContext::output_format
enum AVPixelFormat output_format
Definition: vulkan.h:192
FFVulkanPipeline::shaders
FFSPIRVShader ** shaders
Definition: vulkan.h:103
FFVkBuffer::flags
VkMemoryPropertyFlagBits flags
Definition: vulkan.h:83
ff_vk_map_buffers
int ff_vk_map_buffers(AVFilterContext *avctx, FFVkBuffer *buf, uint8_t *mem[], int nb_buffers, int invalidate)
Maps the buffer to userspace.
Definition: vulkan.c:258
img
#define img
Definition: vf_colormatrix.c:116
offset
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 offset
Definition: writing_filters.txt:86
FFVkExecContext
Definition: vulkan.h:143
ff_vk_init_pipeline_layout
int ff_vk_init_pipeline_layout(AVFilterContext *avctx, FFVulkanPipeline *pl)
Initializes the pipeline layout after all shaders and descriptor sets have been finished.
Definition: vulkan.c:1290
FFVulkanDescriptorSetBinding::name
const char * name
Definition: vulkan.h:68
FFVulkanPipeline::desc_set
VkDescriptorSet * desc_set
Definition: vulkan.h:113
FFSPIRVShader::shader
VkPipelineShaderStageCreateInfo shader
Definition: vulkan.h:60
ff_vk_filter_config_output_inplace
int ff_vk_filter_config_output_inplace(AVFilterLink *outlink)
Definition: vulkan.c:755
FFVkExecContext::sem_wait_cnt
int sem_wait_cnt
Definition: vulkan.h:158
FFVkQueueCtx::nb_buf_deps
int nb_buf_deps
Definition: vulkan.h:134
ff_vk_create_pipeline
FFVulkanPipeline * ff_vk_create_pipeline(AVFilterContext *avctx, FFVkQueueFamilyCtx *qf)
Inits a pipeline.
Definition: vulkan.c:1395
bprint.h
FFVulkanPipeline::pool_size_desc
VkDescriptorPoolSize * pool_size_desc
Definition: vulkan.h:125
FFVulkanPipeline::push_consts
VkPushConstantRange * push_consts
Definition: vulkan.h:107
FFSPIRVShader::src
AVBPrint src
Definition: vulkan.h:58
FFVulkanPipeline::qf
FFVkQueueFamilyCtx * qf
Definition: vulkan.h:94
ff_vk_mt_is_np_rgb
int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
Returns 1 if the image is any sort of supported RGB.
Definition: vulkan.c:889
ff_vk_add_dep_exec_ctx
int ff_vk_add_dep_exec_ctx(AVFilterContext *avctx, FFVkExecContext *e, AVBufferRef **deps, int nb_deps)
Adds a generic AVBufferRef as a queue depenency.
Definition: vulkan.c:643
FFVkBuffer::mem
VkDeviceMemory mem
Definition: vulkan.h:82
ff_vk_compile_shader
int ff_vk_compile_shader(AVFilterContext *avctx, FFSPIRVShader *shd, const char *entrypoint)
Compiles the shader, entrypoint must be set to "main".
Definition: vulkan.c:1030
filt
static const int8_t filt[NUMTAPS *2]
Definition: af_earwax.c:39
FFVulkanContext::extensions
FFVulkanExtensions extensions
Definition: vulkan.h:180
FFVulkanContext::mprops
VkPhysicalDeviceMemoryProperties mprops
Definition: vulkan.h:182
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan.c:704
FFVulkanPipeline::desc_set_initialized
int * desc_set_initialized
Definition: vulkan.h:117
ff_vk_qf_rotate
void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf)
Rotate through the queues in a queue family.
Definition: vulkan.c:130
FFVulkanPipeline::push_consts_num
int push_consts_num
Definition: vulkan.h:108
pixfmt
enum AVPixelFormat pixfmt
Definition: kmsgrab.c:365
ff_comp_identity_map
const VkComponentMapping ff_comp_identity_map
Definition: vulkan.c:47
frame
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 frame
Definition: filter_design.txt:264
FFVulkanContext::vkfn
FFVulkanFunctions vkfn
Definition: vulkan.h:179
FFSPIRVShader::local_size
int local_size[3]
Definition: vulkan.h:59
ff_vk_print_shader
void ff_vk_print_shader(AVFilterContext *avctx, FFSPIRVShader *shd, int prio)
Pretty print shader, mainly used by shader compilers.
Definition: vulkan.c:1009
FFVulkanContext::input_format
enum AVPixelFormat input_format
Definition: vulkan.h:193
FFVkQueueCtx::frame_deps_alloc_size
int frame_deps_alloc_size
Definition: vulkan.h:140
FFVkQueueFamilyCtx::nb_queues
int nb_queues
Definition: vulkan.h:88
FFVkQueueFamilyCtx::cur_queue
int cur_queue
Definition: vulkan.h:89
vulkan_functions.h
ff_vk_update_descriptor_set
void ff_vk_update_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl, int set_id)
Updates a descriptor set via the updaters defined.
Definition: vulkan.c:1252
avfilter.h
FFVulkanDescriptorSetBinding::sampler
FFVkSampler * sampler
Definition: vulkan.h:76
AVFilterContext
An instance of a filter.
Definition: avfilter.h:386
desc
const char * desc
Definition: libsvtav1.c:79
FFVulkanContext::hwctx
AVVulkanDeviceContext * hwctx
Definition: vulkan.h:187
FFVulkanPipeline::descriptor_sets_num
int descriptor_sets_num
Definition: vulkan.h:119
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
FFVkExecContext::bufs
VkCommandBuffer * bufs
Definition: vulkan.h:147
FFVulkanExtensions
FFVulkanExtensions
Definition: vulkan_functions.h:23
map
const VDPAUPixFmtMap * map
Definition: hwcontext_vdpau.c:71
ff_vk_get_exec_buf
VkCommandBuffer ff_vk_get_exec_buf(AVFilterContext *avctx, FFVkExecContext *e)
Gets the command buffer to use for this submission from the exe context.
Definition: vulkan.c:507
FFSPIRVShader
Definition: vulkan.h:56
FFVkBuffer
Definition: vulkan.h:80
FFVkExecContext::sem_wait_val
uint64_t * sem_wait_val
Definition: vulkan.h:160
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
hwcontext.h
FFVulkanPipeline::pool_size_desc_num
int pool_size_desc_num
Definition: vulkan.h:121
FFVkQueueCtx::nb_frame_deps
int nb_frame_deps
Definition: vulkan.h:139
FFVkExecContext::nb_deps
int * nb_deps
Definition: vulkan.h:151
FFVkExecContext::sem_sig_val_dst
uint64_t ** sem_sig_val_dst
Definition: vulkan.h:173
FFVkExecContext::sem_wait_val_alloc
int sem_wait_val_alloc
Definition: vulkan.h:161
FFVkQueueCtx::buf_deps
AVBufferRef ** buf_deps
Definition: vulkan.h:133
FFVulkanPipeline::desc_layout
VkDescriptorSetLayout * desc_layout
Definition: vulkan.h:111
FFVulkanDescriptorSetBinding::mem_quali
const char * mem_quali
Definition: vulkan.h:71
FFVulkanFunctions
Definition: vulkan_functions.h:168
FFVulkanContext::scratch_size
unsigned int scratch_size
Definition: vulkan.h:208
FFVulkanContext::exec_ctx_num
int exec_ctx_num
Definition: vulkan.h:201
FFVkQueueFamilyCtx::queue_family
int queue_family
Definition: vulkan.h:87