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