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