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 AVUTIL_VULKAN_H
20 #define AVUTIL_VULKAN_H
21 
22 #define VK_NO_PROTOTYPES
23 
24 #include <stdatomic.h>
25 
26 #include "pixdesc.h"
27 #include "bprint.h"
28 #include "hwcontext.h"
29 #include "vulkan_functions.h"
30 #include "hwcontext_vulkan.h"
31 #include "avassert.h"
32 #include "intreadwrite.h"
33 
34 /* GLSL management macros */
35 #define INDENT(N) INDENT_##N
36 #define INDENT_0
37 #define INDENT_1 INDENT_0 " "
38 #define INDENT_2 INDENT_1 INDENT_1
39 #define INDENT_3 INDENT_2 INDENT_1
40 #define INDENT_4 INDENT_3 INDENT_1
41 #define INDENT_5 INDENT_4 INDENT_1
42 #define INDENT_6 INDENT_5 INDENT_1
43 #define C(N, S) INDENT(N) #S "\n"
44 
45 #define GLSLC(N, S) \
46  do { \
47  av_bprintf(&shd->src, C(N, S)); \
48  } while (0)
49 
50 #define GLSLA(...) \
51  do { \
52  av_bprintf(&shd->src, __VA_ARGS__); \
53  } while (0)
54 
55 #define GLSLF(N, S, ...) \
56  do { \
57  av_bprintf(&shd->src, C(N, S), __VA_ARGS__); \
58  } while (0)
59 
60 #define GLSLD(D) \
61  do { \
62  av_bprintf(&shd->src, "\n"); \
63  av_bprint_append_data(&shd->src, D, strlen(D)); \
64  av_bprintf(&shd->src, "\n"); \
65  } while (0)
66 
67 /* Helper, pretty much every Vulkan return value needs to be checked */
68 #define RET(x) \
69  do { \
70  if ((err = (x)) < 0) \
71  goto fail; \
72  } while (0)
73 
74 /* Convenience macros for specialization lists */
75 #define SPEC_LIST_MAX 256
76 #define SPEC_LIST_CREATE(name, max_length, max_size) \
77  av_assert1((max_length) < (SPEC_LIST_MAX - 3)); \
78  uint8_t name##_data[(max_size) + 3*sizeof(uint32_t)]; \
79  VkSpecializationMapEntry name##_entries[(max_length) + 3]; \
80  VkSpecializationInfo name##_info = { \
81  .pMapEntries = name##_entries, \
82  .pData = name##_data, \
83  }; \
84  VkSpecializationInfo *name = &name##_info;
85 
86 #define SPEC_LIST_ADD(name, idx, val_bits, val) \
87 do { \
88  unsigned int name##_cnt = name->mapEntryCount; \
89  size_t name##_off = name->dataSize; \
90  uint8_t *name##_dp = (uint8_t *)name->pData; \
91  void *name##_ep = (void *)&name->pMapEntries[name##_cnt]; \
92  AV_WN(val_bits, name##_dp + name##_off, (val)); \
93  VkSpecializationMapEntry name##_new_entry = { \
94  .constantID = (idx), \
95  .offset = name##_off, \
96  .size = val_bits >> 3, \
97  }; \
98  memcpy(name##_ep, &name##_new_entry, \
99  sizeof(VkSpecializationMapEntry)); \
100  name->dataSize = name##_off + (val_bits >> 3); \
101  name->mapEntryCount = name##_cnt + 1; \
102 } while (0)
103 
104 #define DUP_SAMPLER(x) { x, x, x, x }
105 
106 #define FF_VK_MAX_DESCRIPTOR_SETS 4
107 #define FF_VK_MAX_DESCRIPTOR_BINDINGS 16
108 #define FF_VK_MAX_DESCRIPTOR_TYPES 16
109 #define FF_VK_MAX_PUSH_CONSTS 4
110 #define FF_VK_MAX_SHADERS 16
111 
113  const char *name;
114  VkDescriptorType type;
115  const char *mem_layout; /* Storage images (rgba8, etc.) and buffers (std430, etc.) */
116  const char *mem_quali; /* readonly, writeonly, etc. */
117  const char *buf_content; /* For buffers */
118  uint32_t dimensions; /* Needed for e.g. sampler%iD */
119  uint32_t elems; /* 0 - scalar, 1 or more - vector */
120  VkShaderStageFlags stages;
121  uint32_t buf_elems; /* Appends [buf_elems] to the contents. Avoids manually printing to a string. */
122  VkSampler samplers[4]; /* Sampler to use for all elems */
124 
125 typedef struct FFVkBuffer {
126  VkBuffer buf;
127  VkDeviceMemory mem;
128  VkMemoryPropertyFlagBits flags;
129  size_t size;
130  VkDeviceAddress address;
131 
132  /* Only valid when allocated via ff_vk_get_pooled_buffer with HOST_VISIBLE or
133  * via ff_vk_host_map_buffer */
134  uint8_t *mapped_mem;
135 
136  /* Set by ff_vk_host_map_buffer. This is the offset at which the buffer data
137  * actually begins at.
138  * The address and mapped_mem fields will be offset by this amount. */
140 
141  /* If host mapping, reference to the backing host memory buffer */
143 } FFVkBuffer;
144 
145 typedef struct FFVkExecContext {
146  uint32_t idx;
147  const struct FFVkExecPool *parent;
149 
150  /* Queue for the execution context */
151  VkQueue queue;
152  int qf;
153  int qi;
154 
155  /* Command buffer for the context */
156  VkCommandBuffer buf;
157 
158  /* Fence for the command buffer */
159  VkFence fence;
160 
161  /* Opaque data, untouched, free to use by users */
162  void *opaque;
163 
164  void *query_data;
166 
167  /* Buffer dependencies */
170  unsigned int buf_deps_alloc_size;
171 
172  /* Frame dependencies */
174  unsigned int frame_deps_alloc_size;
176 
177  /* Software frame dependencies */
181 
182  VkSemaphoreSubmitInfo *sem_wait;
183  unsigned int sem_wait_alloc;
185 
186  VkSemaphoreSubmitInfo *sem_sig;
187  unsigned int sem_sig_alloc;
189 
190  uint64_t **sem_sig_val_dst;
191  unsigned int sem_sig_val_dst_alloc;
193 
194  uint8_t *frame_locked;
196 
197  VkAccessFlagBits *access_dst;
198  unsigned int access_dst_alloc;
199 
200  VkImageLayout *layout_dst;
201  unsigned int layout_dst_alloc;
202 
203  uint32_t *queue_family_dst;
205 
206  uint8_t *frame_update;
209 
210 typedef struct FFVulkanDescriptorSet {
211  /* Descriptor buffer */
212  VkDeviceSize layout_size;
213  VkDeviceSize aligned_size; /* descriptorBufferOffsetAlignment */
214  VkBufferUsageFlags usage;
215 
216  VkDescriptorSetLayoutBinding binding[FF_VK_MAX_DESCRIPTOR_BINDINGS];
218 
220 
221  /* Descriptor set is shared between all submissions */
222  int singular;
224 
225 typedef struct FFVulkanShader {
226  /* Name for id/debugging purposes */
227  const char *name;
228 
229  /* Whether shader is precompiled or not */
231  VkSpecializationInfo *specialization_info;
232 
233  /* Shader text */
234  AVBPrint src;
235 
236  /* Compute shader local group sizes */
237  uint32_t lg_size[3];
238 
239  /* Shader bind point/type */
240  VkPipelineStageFlags stage;
241  VkPipelineBindPoint bind_point;
242 
243  /* Creation info */
244  VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info;
245 
246  /* Base shader object */
247  VkShaderEXT object;
248  VkPipeline pipeline;
249 
250  /* Pipeline layout */
251  VkPipelineLayout pipeline_layout;
252 
253  /* Push consts */
254  VkPushConstantRange push_consts[FF_VK_MAX_PUSH_CONSTS];
256 
257  /* Descriptor sets */
260 
261  /* Descriptor buffer */
262  VkDescriptorSetLayout desc_layout[FF_VK_MAX_DESCRIPTOR_SETS];
264 
265  /* Descriptor pool */
266  int use_push;
270 
272  /* Descriptor buffer */
274  uint8_t *desc_mem;
276 
277 typedef struct FFVulkanShaderData {
278  /* Shader to which this data belongs to */
281 
282  /* Descriptor buffer */
284  VkDescriptorBufferBindingInfoEXT desc_bind[FF_VK_MAX_DESCRIPTOR_SETS];
285 
286  /* Descriptor pools */
287  VkDescriptorSet *desc_sets;
288  VkDescriptorPool desc_pool;
290 
291 typedef struct FFVkExecPool {
294 
295  VkCommandPool *cmd_buf_pools;
296  VkCommandBuffer *cmd_bufs;
298 
299  VkQueryPool query_pool;
300  void *query_data;
306  size_t qd_size;
307 
308  /* Registered shaders' data */
311 } FFVkExecPool;
312 
313 typedef struct FFVulkanContext {
314  const AVClass *class;
315  void *log_parent;
316 
319  VkPhysicalDeviceProperties2 props;
320  VkPhysicalDeviceVulkan11Properties props_11;
321  VkPhysicalDeviceDriverProperties driver_props;
322  VkPhysicalDeviceMemoryProperties mprops;
323  VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops;
324  VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props;
325  VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props;
326  VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props;
327  VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props;
328  VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props;
329 #ifdef VK_EXT_shader_long_vector
330  VkPhysicalDeviceShaderLongVectorPropertiesEXT long_vector_props;
331 #endif
332  VkQueueFamilyQueryResultStatusPropertiesKHR *query_props;
333  VkQueueFamilyVideoPropertiesKHR *video_props;
334  VkQueueFamilyProperties2 *qf_props;
336  VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_props;
337  VkImageLayout *host_image_copy_layouts;
338 
339  VkCooperativeMatrixPropertiesKHR *coop_mat_props;
341 
342  VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_feats;
343  VkPhysicalDeviceVulkan12Features feats_12;
344  VkPhysicalDeviceFeatures2 feats;
345 
346  VkMemoryPropertyFlagBits host_cached_flag;
347 
351 
356 
357  uint32_t qfs[64];
358  int nb_qfs;
359 
360  /* Properties */
366 
367 static inline int ff_vk_count_images(AVVkFrame *f)
368 {
369  int cnt = 0;
370  while (cnt < FF_ARRAY_ELEMS(f->img) && f->img[cnt])
371  cnt++;
372 
373  return cnt;
374 }
375 
376 static inline const void *ff_vk_find_struct(const void *chain, VkStructureType stype)
377 {
378  const VkBaseInStructure *in = chain;
379  while (in) {
380  if (in->sType == stype)
381  return in;
382 
383  in = in->pNext;
384  }
385 
386  return NULL;
387 }
388 
389 static inline void ff_vk_link_struct(void *chain, const void *in)
390 {
391  VkBaseOutStructure *out = chain;
392  while (out->pNext)
393  out = out->pNext;
394 
395  out->pNext = (void *)in;
396 }
397 
398 #define FF_VK_STRUCT_EXT(CTX, BASE, STRUCT_P, EXT_FLAG, TYPE) \
399  do { \
400  if ((EXT_FLAG == FF_VK_EXT_NO_FLAG) || \
401  ((CTX)->extensions & EXT_FLAG)) { \
402  (STRUCT_P)->sType = TYPE; \
403  ff_vk_link_struct(BASE, STRUCT_P); \
404  } \
405  } while (0)
406 
407 /* Identity mapping - r = r, b = b, g = g, a = a */
408 extern const VkComponentMapping ff_comp_identity_map;
409 
410 /**
411  * Initializes the AVClass, in case this context is not used
412  * as the main user's context.
413  * May use either a frames context reference, or a device context reference.
414  */
415 int ff_vk_init(FFVulkanContext *s, void *log_parent,
416  AVBufferRef *device_ref, AVBufferRef *frames_ref);
417 
418 /**
419  * Converts Vulkan return values to strings
420  */
421 const char *ff_vk_ret2str(VkResult res);
422 
423 /**
424  * Map between usage and features.
425  */
426 VkImageUsageFlags ff_vk_map_feats_to_usage(VkFormatFeatureFlagBits2 feats);
427 VkFormatFeatureFlagBits2 ff_vk_map_usage_to_feats(VkImageUsageFlags usage);
428 
429 /**
430  * Returns 1 if pixfmt is a usable RGB format.
431  */
433 
434 /**
435  * Since storage images may not be swizzled, we have to do this in the
436  * shader itself. This fills in a lookup table to do it.
437  */
438 void ff_vk_set_perm(enum AVPixelFormat pix_fmt, int lut[4], int inv);
439 
440 /**
441  * Get the aspect flag for a plane from an image.
442  */
443 VkImageAspectFlags ff_vk_aspect_flag(AVFrame *f, int p);
444 
445 /**
446  * Returns the format to use for images in shaders.
447  */
449  /* Native format with no conversion. May require casting. */
451  /* Float conversion of the native format. */
453  /* Signed integer version of the native format */
455  /* Unsigned integer version of the native format */
457 };
459  enum FFVkShaderRepFormat rep_fmt);
460 
461 /**
462  * Loads props/mprops/driver_props
463  */
465 
466 /**
467  * Chooses an appropriate QF.
468  */
470  VkQueueFlagBits dev_family,
471  VkVideoCodecOperationFlagBitsKHR vid_ops);
472 
473 /**
474  * Allocates/frees an execution pool.
475  * If used in a multi-threaded context, there must be at least as many contexts
476  * as there are threads.
477  * ff_vk_exec_pool_init_desc() MUST be called if ff_vk_exec_descriptor_set_add()
478  * has been called.
479  */
481  FFVkExecPool *pool, int nb_contexts,
482  int nb_queries, VkQueryType query_type, int query_64bit,
483  const void *query_create_pnext);
485 
486 /**
487  * Retrieve an execution pool. Threadsafe.
488  */
490 
491 /**
492  * Performs nb_queries queries and returns their results and statuses.
493  * 64_BIT and WITH_STATUS flags are ignored as 64_BIT must be specified via
494  * query_64bit in ff_vk_exec_pool_init() and WITH_STATUS is always enabled.
495  */
497  void **data, VkQueryResultFlagBits flags);
498 
499 /**
500  * Start/submit/wait an execution.
501  * ff_vk_exec_start() always waits on a submission, so using ff_vk_exec_wait()
502  * is not necessary (unless using it is just better).
503  */
507 
508 /**
509  * Execution dependency management.
510  * Can attach buffers to executions that will only be unref'd once the
511  * buffer has finished executing.
512  * Adding a frame dep will *lock the frame*, until either the dependencies
513  * are discarded, the execution is submitted, or a failure happens.
514  * update_frame will update the frame's properties before it is unlocked,
515  * only if submission was successful.
516  */
518  AVBufferRef **deps, int nb_deps, int ref);
520  VkSemaphore sem, uint64_t val,
521  VkPipelineStageFlagBits2 stage);
523  VkSemaphore *sem, int nb,
524  VkPipelineStageFlagBits2 stage,
525  int wait); /* Ownership transferred if !wait */
527  VkPipelineStageFlagBits2 wait_stage,
528  VkPipelineStageFlagBits2 signal_stage);
530  AVFrame *f);
532  VkImageMemoryBarrier2 *bar, uint32_t *nb_img_bar);
534  VkSemaphore *dst, uint64_t *dst_val,
535  AVFrame *f);
537 
538 /**
539  * Create a single imageview for a given plane.
540  */
542  VkImageView *img_view, VkImageAspectFlags *aspect,
543  AVFrame *f, int plane, enum FFVkShaderRepFormat rep_fmt);
544 
545 /**
546  * Create an imageview and add it as a dependency to an execution.
547  */
549  VkImageView views[AV_NUM_DATA_POINTERS],
550  AVFrame *f, enum FFVkShaderRepFormat rep_fmt);
551 
552 #define ff_vk_buf_barrier(dst, vkb, s_stage, s_access, s_access2, \
553  d_stage, d_access, d_access2, offs, bsz) \
554  do { \
555  dst = (VkBufferMemoryBarrier2) { \
556  .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2, \
557  .srcStageMask = VK_PIPELINE_STAGE_2_ ##s_stage, \
558  .srcAccessMask = VK_ACCESS_2_ ##s_access | \
559  VK_ACCESS_2_ ##s_access2, \
560  .dstStageMask = VK_PIPELINE_STAGE_2_ ##d_stage, \
561  .dstAccessMask = VK_ACCESS_2_ ##d_access | \
562  VK_ACCESS_2_ ##d_access2, \
563  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, \
564  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, \
565  .buffer = vkb->buf, \
566  .offset = offs, \
567  .size = bsz \
568  }; \
569  } while(0)
570 
572  AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar,
573  VkPipelineStageFlags2 src_stage,
574  VkPipelineStageFlags2 dst_stage,
575  VkAccessFlagBits2 new_access,
576  VkImageLayout new_layout,
577  uint32_t new_qf);
578 
579 /**
580  * Memory/buffer/image allocation helpers.
581  */
582 int ff_vk_alloc_mem(FFVulkanContext *s, VkMemoryRequirements *req,
583  VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
584  VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem);
586  void *pNext, void *alloc_pNext,
587  VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags);
588 
589 /**
590  * Flush or invalidate a single buffer, with a given size and offset.
591  */
593  VkDeviceSize offset, VkDeviceSize mem_size,
594  int flush);
595 
596 /**
597  * Buffer management code.
598  */
599 int ff_vk_map_buffers(FFVulkanContext *s, FFVkBuffer **buf, uint8_t *mem[],
600  int nb_buffers, int invalidate);
601 int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers,
602  int flush);
603 
604 static inline int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem,
605  int invalidate)
606 {
607  return ff_vk_map_buffers(s, (FFVkBuffer *[]){ buf }, mem,
608  1, invalidate);
609 }
610 
611 static inline int ff_vk_unmap_buffer(FFVulkanContext *s, FFVkBuffer *buf, int flush)
612 {
613  return ff_vk_unmap_buffers(s, (FFVkBuffer *[]){ buf }, 1, flush);
614 }
615 
617 
618 /** Initialize a pool and create AVBufferRefs containing FFVkBuffer.
619  * Threadsafe to use. Buffers are automatically mapped on creation if
620  * VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT is set in mem_props. Users should
621  * synchronize access themselvesd. Mainly meant for device-local buffers. */
623  AVBufferRef **buf, VkBufferUsageFlags usage,
624  void *create_pNext, size_t size,
625  VkMemoryPropertyFlagBits mem_props);
626 
627 /** Maps a system RAM buffer into a Vulkan buffer.
628  * References the source buffer.
629  */
631  uint8_t *src_data, const AVBufferRef *src_buf,
632  VkBufferUsageFlags usage);
633 
634 /**
635  * Create a sampler.
636  */
637 int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler,
638  int unnorm_coords, VkFilter filt);
639 
640 /**
641  * Initialize a shader object, with a specific set of extensions, type+bind,
642  * local group size, and subgroup requirements.
643  */
644 int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name,
645  VkPipelineStageFlags stage,
646  const char *extensions[], int nb_extensions,
647  int lg_x, int lg_y, int lg_z,
648  uint32_t required_subgroup_size);
649 
650 /**
651  * Initialize a shader object.
652  * If spec is non-null, it must have been created with SPEC_LIST_CREATE().
653  * The IDs for the workgroup size must be 253, 254, 255.
654  */
656  VkPipelineStageFlags stage, VkSpecializationInfo *spec,
657  uint32_t wg_size[3], uint32_t required_subgroup_size);
658 
659 /**
660  * Output the shader code as logging data, with a specific
661  * priority.
662  */
663 void ff_vk_shader_print(void *ctx, FFVulkanShader *shd, int prio);
664 
665 /**
666  * Link a shader into an executable.
667  */
669  const char *spirv, size_t spirv_len,
670  const char *entrypoint);
671 
672 /**
673  * Add/update push constants for execution.
674  */
676  VkShaderStageFlagBits stage);
677 
678 /**
679  * Add descriptor to a shader. Must be called before shader init.
680  */
682  const FFVulkanDescriptorSetBinding *desc, int nb,
683  int singular, int print_to_shader_only);
684 
685 /**
686  * Register a shader with an exec pool.
687  * Pool may be NULL if all descriptor sets are read-only.
688  */
690  FFVulkanShader *shd);
691 
692 /**
693  * Bind a shader.
694  */
696  FFVulkanShader *shd);
697 
698 /**
699  * Update push constant in a shader.
700  * Must be called before binding the shader.
701  */
703  FFVulkanShader *shd,
704  VkShaderStageFlagBits stage,
705  int offset, size_t size, void *src);
706 
707 /**
708  * Update a descriptor in a buffer with a buffer.
709  * Must be called before binding the shader.
710  */
712  FFVulkanShader *shd,
713  int set, int bind, int elem,
714  FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len,
715  VkFormat fmt);
716 
717 /**
718  * Sets an image descriptor for specified shader and binding.
719  */
721  FFVulkanShader *shd, int set, int bind, int offs,
722  VkImageView view, VkImageLayout layout,
723  VkSampler sampler);
724 
725 /**
726  * Update a descriptor in a buffer with an image array..
727  * Must be called before binding the shader.
728  */
730  FFVulkanShader *shd, AVFrame *f,
731  VkImageView *views, int set, int binding,
732  VkImageLayout layout, VkSampler sampler);
733 
734 /**
735  * Free a shader.
736  */
738 
739 /**
740  * Frees main context.
741  */
743 
744 #endif /* AVUTIL_VULKAN_H */
FFVulkanShader::bind_point
VkPipelineBindPoint bind_point
Definition: vulkan.h:241
flags
const SwsFlags flags[]
Definition: swscale.c:61
ff_vk_ret2str
const char * ff_vk_ret2str(VkResult res)
Converts Vulkan return values to strings.
Definition: vulkan.c:40
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: vulkan.c:723
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: vulkan.c:1133
ff_vk_unmap_buffers
int ff_vk_unmap_buffers(FFVulkanContext *s, FFVkBuffer **buf, int nb_buffers, int flush)
Definition: vulkan.c:1211
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
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
ff_vk_exec_discard_deps
void ff_vk_exec_discard_deps(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:601
ff_vk_map_usage_to_feats
VkFormatFeatureFlagBits2 ff_vk_map_usage_to_feats(VkImageUsageFlags usage)
FFVulkanContext::hwfc
AVVulkanFramesContext * hwfc
Definition: vulkan.h:355
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
Definition: vulkan.c:3010
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)
Definition: vulkan.c:789
FFVulkanContext::output_height
int output_height
Definition: vulkan.h:362
FFVulkanContext::props_11
VkPhysicalDeviceVulkan11Properties props_11
Definition: vulkan.h:320
FFVkExecContext::frame_deps_alloc_size
unsigned int frame_deps_alloc_size
Definition: vulkan.h:174
out
FILE * out
Definition: movenc.c:55
FFVulkanExtensions
uint64_t FFVulkanExtensions
Definition: vulkan_functions.h:29
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
ff_vk_load_props
int ff_vk_load_props(FFVulkanContext *s)
Loads props/mprops/driver_props.
Definition: vulkan.c:147
ff_vk_exec_pool_init
int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *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.
Definition: vulkan.c:366
ff_vk_exec_add_dep_sw_frame
int ff_vk_exec_add_dep_sw_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f)
Definition: vulkan.c:656
FFVulkanContext::device_ref
AVBufferRef * device_ref
Definition: vulkan.h:348
FFVkExecPool::contexts
FFVkExecContext * contexts
Definition: vulkan.h:292
FFVkExecPool::idx
atomic_uint_least64_t idx
Definition: vulkan.h:293
FFVulkanDescriptorSetData
Definition: vulkan.h:271
FFVulkanShader::nb_desc_pool_size
int nb_desc_pool_size
Definition: vulkan.h:268
FFVulkanShaderData
Definition: vulkan.h:277
FFVkExecContext::qf
int qf
Definition: vulkan.h:152
FFVulkanDescriptorSet::aligned_size
VkDeviceSize aligned_size
Definition: vulkan.h:213
FFVulkanShaderData::shd
FFVulkanShader * shd
Definition: vulkan.h:279
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.
Definition: vulkan.c:3022
FFVulkanShader::desc_pool_size
VkDescriptorPoolSize desc_pool_size[FF_VK_MAX_DESCRIPTOR_TYPES]
Definition: vulkan.h:267
FFVkBuffer::host_ref
AVBufferRef * host_ref
Definition: vulkan.h:142
FFVulkanShaderData::desc_set_buf
FFVulkanDescriptorSetData desc_set_buf[FF_VK_MAX_DESCRIPTOR_SETS]
Definition: vulkan.h:283
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
pixdesc.h
FFVulkanDescriptorSetBinding::stages
VkShaderStageFlags stages
Definition: vulkan.h:120
ff_vk_map_buffer
static int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem, int invalidate)
Definition: vulkan.h:604
FFVulkanShader::subgroup_info
VkPipelineShaderStageRequiredSubgroupSizeCreateInfo subgroup_info
Definition: vulkan.h:244
ff_vk_find_struct
static const void * ff_vk_find_struct(const void *chain, VkStructureType stype)
Definition: vulkan.h:376
FFVulkanShader::pipeline
VkPipeline pipeline
Definition: vulkan.h:248
FFVkExecContext::sem_sig_alloc
unsigned int sem_sig_alloc
Definition: vulkan.h:187
FF_VK_MAX_SHADERS
#define FF_VK_MAX_SHADERS
Definition: vulkan.h:110
FFVulkanShader::src
AVBPrint src
Definition: vulkan.h:234
FFVulkanShader::use_push
int use_push
Definition: vulkan.h:266
ff_vk_exec_add_dep_wait_sem
int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
Definition: vulkan.c:706
data
const char data[16]
Definition: mxf.c:149
FFVkBuffer::address
VkDeviceAddress address
Definition: vulkan.h:130
FFVkExecContext::sem_wait
VkSemaphoreSubmitInfo * sem_wait
Definition: vulkan.h:182
FF_VK_REP_NATIVE
@ FF_VK_REP_NATIVE
Definition: vulkan.h:450
FF_VK_REP_INT
@ FF_VK_REP_INT
Definition: vulkan.h:454
FFVulkanDescriptorSetBinding::buf_content
const char * buf_content
Definition: vulkan.h:117
ff_vk_shader_print
void ff_vk_shader_print(void *ctx, FFVulkanShader *shd, int prio)
Output the shader code as logging data, with a specific priority.
Definition: vulkan.c:2184
FFVkExecPool::query_pool
VkQueryPool query_pool
Definition: vulkan.h:299
FFVkExecPool::nb_reg_shd
int nb_reg_shd
Definition: vulkan.h:310
FFVulkanDescriptorSetData::desc_mem
uint8_t * desc_mem
Definition: vulkan.h:274
FFVkExecContext::nb_sw_frame_deps
int nb_sw_frame_deps
Definition: vulkan.h:180
FFVulkanShaderData::desc_sets
VkDescriptorSet * desc_sets
Definition: vulkan.h:287
FFVulkanContext::tot_nb_qfs
int tot_nb_qfs
Definition: vulkan.h:335
FFVkShaderRepFormat
FFVkShaderRepFormat
Returns the format to use for images in shaders.
Definition: vulkan.h:448
FFVkBuffer::buf
VkBuffer buf
Definition: vulkan.h:126
ff_vk_shader_free
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition: vulkan.c:2984
FFVkExecContext::frame_update_alloc_size
unsigned int frame_update_alloc_size
Definition: vulkan.h:207
ff_vk_shader_register_exec
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
Definition: vulkan.c:2637
ff_vk_shader_rep_fmt
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pix_fmt, enum FFVkShaderRepFormat rep_fmt)
Definition: vulkan.c:1624
ff_vk_flush_buffer
int ff_vk_flush_buffer(FFVulkanContext *s, FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize mem_size, int flush)
Flush or invalidate a single buffer, with a given size and offset.
Definition: vulkan.c:1180
FFVulkanDescriptorSet::nb_bindings
int nb_bindings
Definition: vulkan.h:219
FFVulkanContext::feats
VkPhysicalDeviceFeatures2 feats
Definition: vulkan.h:344
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: vulkan.c:888
FFVulkanDescriptorSet::layout_size
VkDeviceSize layout_size
Definition: vulkan.h:212
AVVulkanFramesContext
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
Definition: hwcontext_vulkan.h:212
FFVkExecPool::query_64bit
int query_64bit
Definition: vulkan.h:303
FFVulkanContext::subgroup_props
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props
Definition: vulkan.h:325
val
static double val(void *priv, double ch)
Definition: aeval.c:77
FFVulkanContext::frames_ref
AVBufferRef * frames_ref
Definition: vulkan.h:353
FFVulkanContext::atomic_float_feats
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_feats
Definition: vulkan.h:342
ff_vk_shader_link
int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, const char *spirv, size_t spirv_len, const char *entrypoint)
Link a shader into an executable.
Definition: vulkan.c:2393
FFVkExecPool::query_statuses
int query_statuses
Definition: vulkan.h:302
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:63
FFVulkanDescriptorSetBinding::type
VkDescriptorType type
Definition: vulkan.h:114
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.
Definition: vulkan.c:529
FFVulkanShader::specialization_info
VkSpecializationInfo * specialization_info
Definition: vulkan.h:231
avassert.h
FFVulkanDescriptorSetData::buf
FFVkBuffer buf
Definition: vulkan.h:273
FFVulkanShaderData::desc_bind
VkDescriptorBufferBindingInfoEXT desc_bind[FF_VK_MAX_DESCRIPTOR_SETS]
Definition: vulkan.h:284
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
FFVulkanDescriptorSetBinding::samplers
VkSampler samplers[4]
Definition: vulkan.h:122
FFVkExecContext::frame_deps
AVFrame ** frame_deps
Definition: vulkan.h:173
ff_vk_link_struct
static void ff_vk_link_struct(void *chain, const void *in)
Definition: vulkan.h:389
set
static void set(uint8_t *a[], int ch, int index, int ch_count, enum AVSampleFormat f, double v)
Definition: swresample.c:57
ff_vk_host_map_buffer
int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **dst, uint8_t *src_data, const AVBufferRef *src_buf, VkBufferUsageFlags usage)
Maps a system RAM buffer into a Vulkan buffer.
Definition: vulkan.c:1400
FFVkExecContext::queue_family_dst
uint32_t * queue_family_dst
Definition: vulkan.h:203
FFVulkanDescriptorSetBinding::elems
uint32_t elems
Definition: vulkan.h:119
ff_vk_shader_add_descriptor_set
int ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, const FFVulkanDescriptorSetBinding *desc, int nb, int singular, int print_to_shader_only)
Add descriptor to a shader.
Definition: vulkan.c:2525
FFVulkanContext::output_width
int output_width
Definition: vulkan.h:361
ff_vk_shader_update_desc_buffer
int ff_vk_shader_update_desc_buffer(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int elem, FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len, VkFormat fmt)
Update a descriptor in a buffer with a buffer.
Definition: vulkan.c:2871
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
FFVulkanContext::log_parent
void * log_parent
Definition: vulkan.h:315
FFVulkanContext::driver_props
VkPhysicalDeviceDriverProperties driver_props
Definition: vulkan.h:321
pix_fmt
static enum AVPixelFormat pix_fmt
Definition: demux_decode.c:41
FFVkExecContext::fence
VkFence fence
Definition: vulkan.h:159
FFVulkanShader::desc_set
FFVulkanDescriptorSet desc_set[FF_VK_MAX_DESCRIPTOR_SETS]
Definition: vulkan.h:258
ff_vk_free_buf
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
Definition: vulkan.c:1253
FFVulkanContext::host_cached_flag
VkMemoryPropertyFlagBits host_cached_flag
Definition: vulkan.h:346
FF_VK_REP_FLOAT
@ FF_VK_REP_FLOAT
Definition: vulkan.h:452
FFVkExecContext::nb_buf_deps
int nb_buf_deps
Definition: vulkan.h:169
FFVulkanShader::stage
VkPipelineStageFlags stage
Definition: vulkan.h:240
ctx
AVFormatContext * ctx
Definition: movenc.c:49
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)
Definition: vulkan.c:1031
FF_VK_MAX_DESCRIPTOR_BINDINGS
#define FF_VK_MAX_DESCRIPTOR_BINDINGS
Definition: vulkan.h:107
FFVulkanDescriptorSetBinding::mem_layout
const char * mem_layout
Definition: vulkan.h:115
FFVkExecContext::frame_update
uint8_t * frame_update
Definition: vulkan.h:206
FFVkExecContext::query_idx
int query_idx
Definition: vulkan.h:165
FFVkExecPool::query_status_stride
int query_status_stride
Definition: vulkan.h:304
FFVkExecContext::parent
const struct FFVkExecPool * parent
Definition: vulkan.h:147
ff_vk_shader_update_push_const
void ff_vk_shader_update_push_const(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, VkShaderStageFlagBits stage, int offset, size_t size, void *src)
Update push constant in a shader.
Definition: vulkan.c:2937
AVVulkanDeviceContext
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vulkan.h:59
FFVulkanDescriptorSet::binding_offset
VkDeviceSize binding_offset[FF_VK_MAX_DESCRIPTOR_BINDINGS]
Definition: vulkan.h:217
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
FFVkExecContext::sw_frame_deps_alloc_size
unsigned int sw_frame_deps_alloc_size
Definition: vulkan.h:179
FFVkExecContext::sem_sig_val_dst_alloc
unsigned int sem_sig_val_dst_alloc
Definition: vulkan.h:191
NULL
#define NULL
Definition: coverity.c:32
FFVulkanDescriptorSetBinding::buf_elems
uint32_t buf_elems
Definition: vulkan.h:121
ff_vk_create_imageviews
int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e, VkImageView views[AV_NUM_DATA_POINTERS], AVFrame *f, enum FFVkShaderRepFormat rep_fmt)
Create an imageview and add it as a dependency to an execution.
Definition: vulkan.c:1965
ff_vk_frame_barrier
void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e, AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar, VkPipelineStageFlags2 src_stage, VkPipelineStageFlags2 dst_stage, VkAccessFlagBits2 new_access, VkImageLayout new_layout, uint32_t new_qf)
Definition: vulkan.c:2048
FFVkExecContext::access_dst_alloc
unsigned int access_dst_alloc
Definition: vulkan.h:198
FFVulkanDescriptorSet::singular
int singular
Definition: vulkan.h:222
FFVkExecContext::sem_sig_cnt
int sem_sig_cnt
Definition: vulkan.h:188
FFVulkanShader::bound_buffer_indices
uint32_t bound_buffer_indices[FF_VK_MAX_DESCRIPTOR_SETS]
Definition: vulkan.h:263
FFVulkanDescriptorSetBinding::dimensions
uint32_t dimensions
Definition: vulkan.h:118
FFVulkanContext::coop_matrix_props
VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props
Definition: vulkan.h:326
FFVulkanContext::qf_props
VkQueueFamilyProperties2 * qf_props
Definition: vulkan.h:334
hwcontext_vulkan.h
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:552
FFVkExecContext::qi
int qi
Definition: vulkan.h:153
FFVkExecContext::had_submission
int had_submission
Definition: vulkan.h:148
FFVkBuffer::size
size_t size
Definition: vulkan.h:129
FFVkExecPool::nb_queries
int nb_queries
Definition: vulkan.h:305
FFVkBuffer::mapped_mem
uint8_t * mapped_mem
Definition: vulkan.h:134
FFVulkanContext
Definition: vulkan.h:313
FFVulkanShader::nb_descriptor_sets
int nb_descriptor_sets
Definition: vulkan.h:259
ff_vk_init_sampler
int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler, int unnorm_coords, VkFilter filt)
Create a sampler.
Definition: vulkan.c:1509
FFVkExecContext::query_data
void * query_data
Definition: vulkan.h:164
ff_vk_shader_add_push_const
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition: vulkan.c:1498
ff_vk_exec_wait
void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:562
FFVulkanContext::device
AVHWDeviceContext * device
Definition: vulkan.h:349
usage
const char * usage
Definition: floatimg_cmp.c:62
f
f
Definition: af_crystalizer.c:122
FFVkExecContext::layout_dst
VkImageLayout * layout_dst
Definition: vulkan.h:200
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.
Definition: vulkan.c:1295
FFVkExecContext::queue_family_dst_alloc
unsigned int queue_family_dst_alloc
Definition: vulkan.h:204
FFVulkanDescriptorSetBinding
Definition: vulkan.h:112
ff_vk_exec_start
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
Definition: vulkan.c:569
FFVulkanShaderData::nb_descriptor_sets
int nb_descriptor_sets
Definition: vulkan.h:280
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
AVVkFrame
Definition: hwcontext_vulkan.h:302
FFVulkanContext::host_image_props
VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_props
Definition: vulkan.h:336
size
int size
Definition: twinvq_data.h:10344
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:428
FFVkExecContext::nb_frame_deps
int nb_frame_deps
Definition: vulkan.h:175
FFVulkanShader
Definition: vulkan.h:225
ff_vk_create_imageview
int ff_vk_create_imageview(FFVulkanContext *s, VkImageView *img_view, VkImageAspectFlags *aspect, AVFrame *f, int plane, enum FFVkShaderRepFormat rep_fmt)
Create a single imageview for a given plane.
Definition: vulkan.c:1914
FFVulkanShader::pipeline_layout
VkPipelineLayout pipeline_layout
Definition: vulkan.h:251
FFVkExecContext::sem_sig_val_dst_cnt
int sem_sig_val_dst_cnt
Definition: vulkan.h:192
FFVulkanContext::output_format
enum AVPixelFormat output_format
Definition: vulkan.h:363
FFVulkanShader::desc_layout
VkDescriptorSetLayout desc_layout[FF_VK_MAX_DESCRIPTOR_SETS]
Definition: vulkan.h:262
FFVkBuffer::flags
VkMemoryPropertyFlagBits flags
Definition: vulkan.h:128
ff_vk_aspect_flag
VkImageAspectFlags ff_vk_aspect_flag(AVFrame *f, int p)
Get the aspect flag for a plane from an image.
Definition: vulkan.c:1541
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:145
FFVulkanDescriptorSetBinding::name
const char * name
Definition: vulkan.h:113
FFVulkanDescriptorSet::binding
VkDescriptorSetLayoutBinding binding[FF_VK_MAX_DESCRIPTOR_BINDINGS]
Definition: vulkan.h:216
ff_vk_shader_load
int ff_vk_shader_load(FFVulkanShader *shd, VkPipelineStageFlags stage, VkSpecializationInfo *spec, uint32_t wg_size[3], uint32_t required_subgroup_size)
Initialize a shader object.
Definition: vulkan.c:2091
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.
Definition: vulkan.c:629
ff_vk_exec_bind_shader
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd)
Bind a shader.
Definition: vulkan.c:2947
FFVulkanContext::input_frames_ref
AVBufferRef * input_frames_ref
Definition: vulkan.h:352
FFVkExecContext::sem_wait_cnt
int sem_wait_cnt
Definition: vulkan.h:184
layout
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 layout
Definition: filter_design.txt:18
FFVkExecContext::queue
VkQueue queue
Definition: vulkan.h:151
FFVulkanContext::qfs
uint32_t qfs[64]
Definition: vulkan.h:357
ff_vk_shader_update_img
int ff_vk_shader_update_img(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int offs, VkImageView view, VkImageLayout layout, VkSampler sampler)
Sets an image descriptor for specified shader and binding.
Definition: vulkan.c:2793
ff_vk_exec_submit
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:914
bprint.h
FFVkExecPool::cmd_buf_pools
VkCommandPool * cmd_buf_pools
Definition: vulkan.h:295
FF_VK_REP_UINT
@ FF_VK_REP_UINT
Definition: vulkan.h:456
FFVulkanShaderData::desc_pool
VkDescriptorPool desc_pool
Definition: vulkan.h:288
VkFormat
enum VkFormat VkFormat
Definition: hwcontext_stub.c:25
FFVulkanShader::push_consts_num
int push_consts_num
Definition: vulkan.h:255
FFVkExecContext::layout_dst_alloc
unsigned int layout_dst_alloc
Definition: vulkan.h:201
ff_vk_exec_get
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
Definition: vulkan.c:557
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: vulkan.c:1558
ff_vk_unmap_buffer
static int ff_vk_unmap_buffer(FFVulkanContext *s, FFVkBuffer *buf, int flush)
Definition: vulkan.h:611
FFVkBuffer::mem
VkDeviceMemory mem
Definition: vulkan.h:127
ff_vk_shader_init
int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, VkPipelineStageFlags stage, const char *extensions[], int nb_extensions, int lg_x, int lg_y, int lg_z, uint32_t required_subgroup_size)
Initialize a shader object, with a specific set of extensions, type+bind, local group size,...
Definition: vulkan.c:2120
ff_vk_qf_find
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
Definition: vulkan.c:288
FFVulkanContext::hprops
VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops
Definition: vulkan.h:323
FFVulkanContext::props
VkPhysicalDeviceProperties2 props
Definition: vulkan.h:319
FFVkExecContext::frame_locked_alloc_size
unsigned int frame_locked_alloc_size
Definition: vulkan.h:195
len
int len
Definition: vorbis_enc_data.h:426
filt
static const int8_t filt[NUMTAPS *2]
Definition: af_earwax.c:40
FFVulkanContext::extensions
FFVulkanExtensions extensions
Definition: vulkan.h:318
FFVulkanContext::nb_qfs
int nb_qfs
Definition: vulkan.h:358
FFVulkanContext::mprops
VkPhysicalDeviceMemoryProperties mprops
Definition: vulkan.h:322
FFVkExecContext::sem_wait_alloc
unsigned int sem_wait_alloc
Definition: vulkan.h:183
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:118
ff_vk_shader_update_img_array
void ff_vk_shader_update_img_array(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, AVFrame *f, VkImageView *views, int set, int binding, VkImageLayout layout, VkSampler sampler)
Update a descriptor in a buffer with an image array.
Definition: vulkan.c:2858
FFVulkanContext::desc_buf_props
VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props
Definition: vulkan.h:324
ff_comp_identity_map
const VkComponentMapping ff_comp_identity_map
Definition: vulkan.c:32
FFVulkanShader::name
const char * name
Definition: vulkan.h:227
FFVulkanContext::vkfn
FFVulkanFunctions vkfn
Definition: vulkan.h:317
FF_VK_MAX_DESCRIPTOR_TYPES
#define FF_VK_MAX_DESCRIPTOR_TYPES
Definition: vulkan.h:108
FFVkExecContext::opaque
void * opaque
Definition: vulkan.h:162
FFVkExecPool
Definition: vulkan.h:291
FFVkExecContext::frame_locked
uint8_t * frame_locked
Definition: vulkan.h:194
FFVkExecPool::query_data
void * query_data
Definition: vulkan.h:300
FFVkExecContext::sem_sig
VkSemaphoreSubmitInfo * sem_sig
Definition: vulkan.h:186
FFVkExecContext::buf
VkCommandBuffer buf
Definition: vulkan.h:156
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: vulkan.c:980
FFVulkanContext::input_format
enum AVPixelFormat input_format
Definition: vulkan.h:364
FFVulkanContext::coop_mat_props_nb
uint32_t coop_mat_props_nb
Definition: vulkan.h:340
vulkan_functions.h
FFVulkanShader::precompiled
int precompiled
Definition: vulkan.h:230
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: vulkan.c:869
FFVulkanContext::video_props
VkQueueFamilyVideoPropertiesKHR * video_props
Definition: vulkan.h:333
FFVulkanShader::object
VkShaderEXT object
Definition: vulkan.h:247
ref
static int ref[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:117
FFVulkanShader::lg_size
uint32_t lg_size[3]
Definition: vulkan.h:237
ff_vk_map_feats_to_usage
VkImageUsageFlags ff_vk_map_feats_to_usage(VkFormatFeatureFlagBits2 feats)
Map between usage and features.
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
FFVulkanDescriptorSet::usage
VkBufferUsageFlags usage
Definition: vulkan.h:214
ff_vk_exec_pool_free
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
Definition: vulkan.c:301
desc
const char * desc
Definition: libsvtav1.c:78
FFVulkanContext::hwctx
AVVulkanDeviceContext * hwctx
Definition: vulkan.h:350
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
FFVulkanShader::push_consts
VkPushConstantRange push_consts[FF_VK_MAX_PUSH_CONSTS]
Definition: vulkan.h:254
FFVkExecPool::cmd_bufs
VkCommandBuffer * cmd_bufs
Definition: vulkan.h:296
FFVulkanContext::push_desc_props
VkPhysicalDevicePushDescriptorPropertiesKHR push_desc_props
Definition: vulkan.h:327
FFVulkanContext::feats_12
VkPhysicalDeviceVulkan12Features feats_12
Definition: vulkan.h:343
FFVkExecContext::sw_frame_deps
AVFrame ** sw_frame_deps
Definition: vulkan.h:178
ff_vk_count_images
static int ff_vk_count_images(AVVkFrame *f)
Definition: vulkan.h:367
FFVkBuffer::virtual_offset
size_t virtual_offset
Definition: vulkan.h:139
FFVkExecContext::buf_deps_alloc_size
unsigned int buf_deps_alloc_size
Definition: vulkan.h:170
FFVkExecContext::buf_deps
AVBufferRef ** buf_deps
Definition: vulkan.h:168
FFVkBuffer
Definition: vulkan.h:125
hwcontext.h
AVVulkanDeviceQueueFamily
Definition: hwcontext_vulkan.h:33
FFVkExecPool::qd_size
size_t qd_size
Definition: vulkan.h:306
FFVulkanContext::frames
AVHWFramesContext * frames
Definition: vulkan.h:354
FFVulkanDescriptorSet
Definition: vulkan.h:210
FFVulkanContext::optical_flow_props
VkPhysicalDeviceOpticalFlowPropertiesNV optical_flow_props
Definition: vulkan.h:328
ff_vk_set_perm
void ff_vk_set_perm(enum AVPixelFormat pix_fmt, int lut[4], int inv)
Since storage images may not be swizzled, we have to do this in the shader itself.
Definition: vulkan.c:1580
FFVkExecPool::query_results
int query_results
Definition: vulkan.h:301
FFVkExecContext::sem_sig_val_dst
uint64_t ** sem_sig_val_dst
Definition: vulkan.h:190
FFVkExecPool::reg_shd
FFVulkanShaderData reg_shd[FF_VK_MAX_SHADERS]
Definition: vulkan.h:309
FFVulkanContext::query_props
VkQueueFamilyQueryResultStatusPropertiesKHR * query_props
Definition: vulkan.h:332
FFVulkanContext::host_image_copy_layouts
VkImageLayout * host_image_copy_layouts
Definition: vulkan.h:337
FFVulkanDescriptorSetBinding::mem_quali
const char * mem_quali
Definition: vulkan.h:116
FFVulkanFunctions
Definition: vulkan_functions.h:282
FFVkExecPool::pool_size
int pool_size
Definition: vulkan.h:297
FFVulkanContext::coop_mat_props
VkCooperativeMatrixPropertiesKHR * coop_mat_props
Definition: vulkan.h:339
FFVkExecContext::idx
uint32_t idx
Definition: vulkan.h:146
src
#define src
Definition: vp8dsp.c:248
atomic_uint_least64_t
intptr_t atomic_uint_least64_t
Definition: stdatomic.h:69
FF_VK_MAX_PUSH_CONSTS
#define FF_VK_MAX_PUSH_CONSTS
Definition: vulkan.h:109
FFVkExecContext::access_dst
VkAccessFlagBits * access_dst
Definition: vulkan.h:197
FF_VK_MAX_DESCRIPTOR_SETS
#define FF_VK_MAX_DESCRIPTOR_SETS
Definition: vulkan.h:106