History

lavfi/vulkan: refactor, fix and fully implement multiple queues

Lynne committed 5 years ago

Commit f705e9e1 parent 246f8416 files · +336 −216Browse files

Showing the changes to libavfilter (6 of 6 files). Show all

Unified · Split

6 files
  1. libavfilter/vf_avgblur_vulkan.c +14 −13
  2. libavfilter/vf_chromaber_vulkan.c +14 −11
  3. libavfilter/vf_overlay_vulkan.c +17 −13
  4. libavfilter/vf_scale_vulkan.c +15 −12
  5. libavfilter/vulkan.c +210 −130
  6. libavfilter/vulkan.h +66 −37
libavfilter/vf_avgblur_vulkan.c+14−13
@@ -24,12 +24,13 @@ · 23 unmodified lines
2424 #define CGS 32
2525
2626 typedef struct AvgBlurVulkanContext {
27− VulkanFilterContext vkctx;
27+ FFVulkanContext vkctx;
2828
2929 int initialized;
30+ FFVkQueueFamilyCtx qf;
3031 FFVkExecContext *exec;
31− VulkanPipeline *pl_hor;
32− VulkanPipeline *pl_ver;
32+ FFVulkanPipeline *pl_hor;
33+ FFVulkanPipeline *pl_ver;
3334
3435 /* Shader updators, must be in the main filter struct */
3536 VkDescriptorImageInfo input_images[3];
@@ -73,16 +74,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 37 unmodified lines
7374 FFSPIRVShader *shd;
7475 AvgBlurVulkanContext *s = ctx->priv;
7576 const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
76− VkSampler *sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_LINEAR);
7777
78− VulkanDescriptorSetBinding desc_i[2] = {
78+ FFVulkanDescriptorSetBinding desc_i[2] = {
7979 {
8080 .name = "input_img",
8181 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
8282 .dimensions = 2,
8383 .elems = planes,
8484 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
85− .samplers = DUP_SAMPLER_ARRAY4(*sampler),
8685 },
8786 {
8887 .name = "output_img",
@@ -95,17 +94,17 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 6 unmodified lines
9594 },
9695 };
9796
98− if (!sampler)
99− return AVERROR_EXTERNAL;
97+ ff_vk_qf_init(ctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
10098
101− s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
102− s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
99+ desc_i[0].sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_LINEAR);
100+ if (!desc_i[0].sampler)
101+ return AVERROR_EXTERNAL;
103102
104103 { /* Create shader for the horizontal pass */
105104 desc_i[0].updater = s->input_images;
106105 desc_i[1].updater = s->tmp_images;
107106
108− s->pl_hor = ff_vk_create_pipeline(ctx);
107+ s->pl_hor = ff_vk_create_pipeline(ctx, &s->qf);
109108 if (!s->pl_hor)
110109 return AVERROR(ENOMEM);
111110
@@ -148,7 +147,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 36 unmodified lines
148147 desc_i[0].updater = s->tmp_images;
149148 desc_i[1].updater = s->output_images;
150149
151− s->pl_ver = ff_vk_create_pipeline(ctx);
150+ s->pl_ver = ff_vk_create_pipeline(ctx, &s->qf);
152151 if (!s->pl_ver)
153152 return AVERROR(ENOMEM);
154153
@@ -188,7 +187,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 33 unmodified lines
188187 }
189188
190189 /* Execution context */
191− RET(ff_vk_create_exec_ctx(ctx, &s->exec));
190+ RET(ff_vk_create_exec_ctx(ctx, &s->exec, &s->qf));
192191
193192 s->initialized = 1;
194193
@@ -311,6 +310,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f · 116 unmodified lines
311310 if (err)
312311 return err;
313312
313+ ff_vk_qf_rotate(&s->qf);
314+
314315 return err;
315316
316317 fail:
libavfilter/vf_chromaber_vulkan.c+14−11
@@ -24,11 +24,12 @@ · 23 unmodified lines
2424 #define CGROUPS (int [3]){ 32, 32, 1 }
2525
2626 typedef struct ChromaticAberrationVulkanContext {
27− VulkanFilterContext vkctx;
27+ FFVulkanContext vkctx;
2828
2929 int initialized;
30+ FFVkQueueFamilyCtx qf;
3031 FFVkExecContext *exec;
31− VulkanPipeline *pl;
32+ FFVulkanPipeline *pl;
3233
3334 /* Shader updators, must be in the main filter struct */
3435 VkDescriptorImageInfo input_images[3];
@@ -67,17 +68,18 @@ static const char distort_chroma_kernel[] = { · 32 unmodified lines
6768 static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
6869 {
6970 int err;
71+ FFVkSampler *sampler;
7072 ChromaticAberrationVulkanContext *s = ctx->priv;
73+ const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
74+
75+ ff_vk_qf_init(ctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
7176
7277 /* Create a sampler */
73− VkSampler *sampler = ff_vk_init_sampler(ctx, 0, VK_FILTER_LINEAR);
78+ sampler = ff_vk_init_sampler(ctx, 0, VK_FILTER_LINEAR);
7479 if (!sampler)
7580 return AVERROR_EXTERNAL;
7681
77− s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
78− s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
79−
80− s->pl = ff_vk_create_pipeline(ctx);
82+ s->pl = ff_vk_create_pipeline(ctx, &s->qf);
8183 if (!s->pl)
8284 return AVERROR(ENOMEM);
8385
@@ -86,8 +88,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 2 unmodified lines
8688 s->opts.dist[1] = (s->opts.dist[1] / 100.0f) + 1.0f;
8789
8890 { /* Create the shader */
89− const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
90− VulkanDescriptorSetBinding desc_i[2] = {
91+ FFVulkanDescriptorSetBinding desc_i[2] = {
9192 {
9293 .name = "input_img",
9394 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
@@ -95,7 +96,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 1 unmodified line
9596 .elems = planes,
9697 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
9798 .updater = s->input_images,
98− .samplers = DUP_SAMPLER_ARRAY4(*sampler),
99+ .sampler = sampler,
99100 },
100101 {
101102 .name = "output_img",
@@ -158,7 +159,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 56 unmodified lines
158159 RET(ff_vk_init_compute_pipeline(ctx, s->pl));
159160
160161 /* Execution context */
161− RET(ff_vk_create_exec_ctx(ctx, &s->exec));
162+ RET(ff_vk_create_exec_ctx(ctx, &s->exec, &s->qf));
162163
163164 s->initialized = 1;
164165
@@ -256,6 +257,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f) · 91 unmodified lines
256257 if (err)
257258 return err;
258259
260+ ff_vk_qf_rotate(&s->qf);
261+
259262 return err;
260263
261264 fail:
libavfilter/vf_overlay_vulkan.c+17−13
@@ -25,11 +25,12 @@ · 24 unmodified lines
2525 #define CGROUPS (int [3]){ 32, 32, 1 }
2626
2727 typedef struct OverlayVulkanContext {
28− VulkanFilterContext vkctx;
28+ FFVulkanContext vkctx;
2929
3030 int initialized;
31− VulkanPipeline *pl;
31+ FFVkQueueFamilyCtx qf;
3232 FFVkExecContext *exec;
33+ FFVulkanPipeline *pl;
3334 FFFrameSync fs;
3435 FFVkBuffer params_buf;
3536
@@ -79,23 +80,24 @@ static const char overlay_alpha[] = { · 43 unmodified lines
7980 static av_cold int init_filter(AVFilterContext *ctx)
8081 {
8182 int err;
83+ FFVkSampler *sampler;
8284 OverlayVulkanContext *s = ctx->priv;
83− VkSampler *sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_NEAREST);
85+ const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
86+
87+ ff_vk_qf_init(ctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
88+
89+ sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_NEAREST);
8490 if (!sampler)
8591 return AVERROR_EXTERNAL;
8692
87− s->pl = ff_vk_create_pipeline(ctx);
93+ s->pl = ff_vk_create_pipeline(ctx, &s->qf);
8894 if (!s->pl)
8995 return AVERROR(ENOMEM);
9096
91− s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
92− s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
93−
9497 { /* Create the shader */
95− const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
9698 const int ialpha = av_pix_fmt_desc_get(s->vkctx.input_format)->flags & AV_PIX_FMT_FLAG_ALPHA;
9799
98− VulkanDescriptorSetBinding desc_i[3] = {
100+ FFVulkanDescriptorSetBinding desc_i[3] = {
99101 {
100102 .name = "main_img",
101103 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
@@ -103,7 +105,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 1 unmodified line
103105 .elems = planes,
104106 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
105107 .updater = s->main_images,
106− .samplers = DUP_SAMPLER_ARRAY4(*sampler),
108+ .sampler = sampler,
107109 },
108110 {
109111 .name = "overlay_img",
@@ -112,7 +114,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 2 unmodified lines
112114 .elems = planes,
113115 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
114116 .updater = s->overlay_images,
115− .samplers = DUP_SAMPLER_ARRAY4(*sampler),
117+ .sampler = sampler,
116118 },
117119 {
118120 .name = "output_img",
@@ -126,7 +128,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 7 unmodified lines
126128 },
127129 };
128130
129− VulkanDescriptorSetBinding desc_b = {
131+ FFVulkanDescriptorSetBinding desc_b = {
130132 .name = "params",
131133 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
132134 .mem_quali = "readonly",
@@ -215,7 +217,7 @@ static av_cold int init_filter(AVFilterContext *ctx) · 82 unmodified lines
215217 }
216218
217219 /* Execution context */
218− RET(ff_vk_create_exec_ctx(ctx, &s->exec));
220+ RET(ff_vk_create_exec_ctx(ctx, &s->exec, &s->qf));
219221
220222 s->initialized = 1;
221223
@@ -339,6 +341,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, · 117 unmodified lines
339341 if (err)
340342 return err;
341343
344+ ff_vk_qf_rotate(&s->qf);
345+
342346 return err;
343347
344348 fail:
libavfilter/vf_scale_vulkan.c+15−12
@@ -33,11 +33,12 @@ enum ScalerFunc { · 32 unmodified lines
3333 };
3434
3535 typedef struct ScaleVulkanContext {
36− VulkanFilterContext vkctx;
36+ FFVulkanContext vkctx;
3737
3838 int initialized;
39+ FFVkQueueFamilyCtx qf;
3940 FFVkExecContext *exec;
40− VulkanPipeline *pl;
41+ FFVulkanPipeline *pl;
4142 FFVkBuffer params_buf;
4243
4344 /* Shader updators, must be in the main filter struct */
@@ -107,7 +108,7 @@ static const char write_444[] = { · 63 unmodified lines
107108 static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
108109 {
109110 int err;
110− VkSampler *sampler;
111+ FFVkSampler *sampler;
111112 VkFilter sampler_mode;
112113 ScaleVulkanContext *s = ctx->priv;
113114
@@ -115,9 +116,9 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 1 unmodified line
115116 int crop_y = in->crop_top;
116117 int crop_w = in->width - (in->crop_left + in->crop_right);
117118 int crop_h = in->height - (in->crop_top + in->crop_bottom);
119+ int in_planes = av_pix_fmt_count_planes(s->vkctx.input_format);
118120
119− s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
120− s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
121+ ff_vk_qf_init(ctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
121122
122123 switch (s->scaler) {
123124 case F_NEAREST:
@@ -133,20 +134,20 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 9 unmodified lines
133134 if (!sampler)
134135 return AVERROR_EXTERNAL;
135136
136− s->pl = ff_vk_create_pipeline(ctx);
137+ s->pl = ff_vk_create_pipeline(ctx, &s->qf);
137138 if (!s->pl)
138139 return AVERROR(ENOMEM);
139140
140141 { /* Create the shader */
141− VulkanDescriptorSetBinding desc_i[2] = {
142+ FFVulkanDescriptorSetBinding desc_i[2] = {
142143 {
143144 .name = "input_img",
144145 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
145146 .dimensions = 2,
146− .elems = av_pix_fmt_count_planes(s->vkctx.input_format),
147+ .elems = in_planes,
147148 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
148149 .updater = s->input_images,
149− .samplers = DUP_SAMPLER_ARRAY4(*sampler),
150+ .sampler = sampler,
150151 },
151152 {
152153 .name = "output_img",
@@ -160,7 +161,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 7 unmodified lines
160161 },
161162 };
162163
163− VulkanDescriptorSetBinding desc_b = {
164+ FFVulkanDescriptorSetBinding desc_b = {
164165 .name = "params",
165166 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
166167 .mem_quali = "readonly",
@@ -178,7 +179,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 11 unmodified lines
178179 ff_vk_set_compute_shader_sizes(ctx, shd, CGROUPS);
179180
180181 RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, desc_i, 2, 0)); /* set 0 */
181− RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, &desc_b, 1, 0)); /* set 0 */
182+ RET(ff_vk_add_descriptor_set(ctx, s->pl, shd, &desc_b, 1, 0)); /* set 1 */
182183
183184 GLSLD( scale_bilinear );
184185
@@ -280,7 +281,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 95 unmodified lines
280281 }
281282
282283 /* Execution context */
283− RET(ff_vk_create_exec_ctx(ctx, &s->exec));
284+ RET(ff_vk_create_exec_ctx(ctx, &s->exec, &s->qf));
284285
285286 s->initialized = 1;
286287
@@ -384,6 +385,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *in_f) · 97 unmodified lines
384385 if (err)
385386 return err;
386387
388+ ff_vk_qf_rotate(&s->qf);
389+
387390 return err;
388391
389392 fail:
libavfilter/vulkan.c+210−130
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include "vulkan.h"
2121 #include "glslang.h"
2222
23+#include "libavutil/avassert.h"
2324 #include "libavutil/vulkan_loader.h"
2425
2526 /* Generic macro for creating contexts which need to keep their addresses
@@ -88,15 +89,54 @@ const char *ff_vk_ret2str(VkResult res) · 62 unmodified lines
8889 #undef CASE
8990 }
9091
92+void ff_vk_qf_init(AVFilterContext *avctx, FFVkQueueFamilyCtx *qf,
93+ VkQueueFlagBits dev_family, int queue_limit)
94+{
95+ FFVulkanContext *s = avctx->priv;
96+
97+ if (!queue_limit)
98+ queue_limit = INT32_MAX;
99+
100+ switch (dev_family) {
101+ case VK_QUEUE_GRAPHICS_BIT:
102+ qf->queue_family = s->hwctx->queue_family_index;
103+ qf->nb_queues = FFMIN(s->hwctx->nb_graphics_queues, queue_limit);
104+ return;
105+ case VK_QUEUE_COMPUTE_BIT:
106+ qf->queue_family = s->hwctx->queue_family_comp_index;
107+ qf->nb_queues = FFMIN(s->hwctx->nb_comp_queues, queue_limit);
108+ return;
109+ case VK_QUEUE_TRANSFER_BIT:
110+ qf->queue_family = s->hwctx->queue_family_tx_index;
111+ qf->nb_queues = FFMIN(s->hwctx->nb_tx_queues, queue_limit);
112+ return;
113+ case VK_QUEUE_VIDEO_ENCODE_BIT_KHR:
114+ qf->queue_family = s->hwctx->queue_family_encode_index;
115+ qf->nb_queues = FFMIN(s->hwctx->nb_encode_queues, queue_limit);
116+ return;
117+ case VK_QUEUE_VIDEO_DECODE_BIT_KHR:
118+ qf->queue_family = s->hwctx->queue_family_decode_index;
119+ qf->nb_queues = FFMIN(s->hwctx->nb_decode_queues, queue_limit);
120+ return;
121+ default:
122+ av_assert0(0); /* Should never happen */
123+ }
124+
125+ return;
126+}
127+
128+void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf)
129+{
130+ qf->cur_queue = (qf->cur_queue + 1) % qf->nb_queues;
131+}
132+
91133 static int vk_alloc_mem(AVFilterContext *avctx, VkMemoryRequirements *req,
92134 VkMemoryPropertyFlagBits req_flags, void *alloc_extension,
93135 VkMemoryPropertyFlagBits *mem_flags, VkDeviceMemory *mem)
94136 {
95137 VkResult ret;
96138 int index = -1;
97− VkPhysicalDeviceProperties props;
98− VkPhysicalDeviceMemoryProperties mprops;
99− VulkanFilterContext *s = avctx->priv;
139+ FFVulkanContext *s = avctx->priv;
100140 FFVulkanFunctions *vk = &s->vkfn;
101141
102142 VkMemoryAllocateInfo alloc_info = {
@@ -104,24 +144,21 @@ static int vk_alloc_mem(AVFilterContext *avctx, VkMemoryRequirements *req, · 1 unmodified line
104144 .pNext = alloc_extension,
105145 };
106146
107− vk->GetPhysicalDeviceProperties(s->hwctx->phys_dev, &props);
108− vk->GetPhysicalDeviceMemoryProperties(s->hwctx->phys_dev, &mprops);
109−
110147 /* Align if we need to */
111148 if (req_flags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)
112− req->size = FFALIGN(req->size, props.limits.minMemoryMapAlignment);
149+ req->size = FFALIGN(req->size, s->props.limits.minMemoryMapAlignment);
113150
114151 alloc_info.allocationSize = req->size;
115152
116153 /* The vulkan spec requires memory types to be sorted in the "optimal"
117154 * order, so the first matching type we find will be the best/fastest one */
118− for (int i = 0; i < mprops.memoryTypeCount; i++) {
155+ for (int i = 0; i < s->mprops.memoryTypeCount; i++) {
119156 /* The memory type must be supported by the requirements (bitfield) */
120157 if (!(req->memoryTypeBits & (1 << i)))
121158 continue;
122159
123160 /* The memory type flags must include our properties */
124− if ((mprops.memoryTypes[i].propertyFlags & req_flags) != req_flags)
161+ if ((s->mprops.memoryTypes[i].propertyFlags & req_flags) != req_flags)
125162 continue;
126163
127164 /* Found a suitable memory type */
@@ -145,7 +182,7 @@ static int vk_alloc_mem(AVFilterContext *avctx, VkMemoryRequirements *req, · 17 unmodified lines
145182 return AVERROR(ENOMEM);
146183 }
147184
148− *mem_flags |= mprops.memoryTypes[index].propertyFlags;
185+ *mem_flags |= s->mprops.memoryTypes[index].propertyFlags;
149186
150187 return 0;
151188 }
@@ -156,7 +193,7 @@ int ff_vk_create_buf(AVFilterContext *avctx, FFVkBuffer *buf, size_t size, · 4 unmodified lines
156193 int err;
157194 VkResult ret;
158195 int use_ded_mem;
159− VulkanFilterContext *s = avctx->priv;
196+ FFVulkanContext *s = avctx->priv;
160197 FFVulkanFunctions *vk = &s->vkfn;
161198
162199 VkBufferCreateInfo buf_spawn = {
@@ -220,7 +257,7 @@ int ff_vk_map_buffers(AVFilterContext *avctx, FFVkBuffer *buf, uint8_t *mem[], · 57 unmodified lines
220257 int nb_buffers, int invalidate)
221258 {
222259 VkResult ret;
223− VulkanFilterContext *s = avctx->priv;
260+ FFVulkanContext *s = avctx->priv;
224261 FFVulkanFunctions *vk = &s->vkfn;
225262 VkMappedMemoryRange *inval_list = NULL;
226263 int inval_count = 0;
@@ -271,7 +308,7 @@ int ff_vk_unmap_buffers(AVFilterContext *avctx, FFVkBuffer *buf, int nb_buffers, · 44 unmodified lines
271308 {
272309 int err = 0;
273310 VkResult ret;
274− VulkanFilterContext *s = avctx->priv;
311+ FFVulkanContext *s = avctx->priv;
275312 FFVulkanFunctions *vk = &s->vkfn;
276313 VkMappedMemoryRange *flush_list = NULL;
277314 int flush_count = 0;
@@ -311,7 +348,7 @@ int ff_vk_unmap_buffers(AVFilterContext *avctx, FFVkBuffer *buf, int nb_buffers, · 33 unmodified lines
311348
312349 void ff_vk_free_buf(AVFilterContext *avctx, FFVkBuffer *buf)
313350 {
314− VulkanFilterContext *s = avctx->priv;
351+ FFVulkanContext *s = avctx->priv;
315352 FFVulkanFunctions *vk = &s->vkfn;
316353
317354 if (!buf)
@@ -323,7 +360,7 @@ void ff_vk_free_buf(AVFilterContext *avctx, FFVkBuffer *buf) · 5 unmodified lines
323360 vk->FreeMemory(s->hwctx->act_dev, buf->mem, s->hwctx->alloc);
324361 }
325362
326−int ff_vk_add_push_constant(AVFilterContext *avctx, VulkanPipeline *pl,
363+int ff_vk_add_push_constant(AVFilterContext *avctx, FFVulkanPipeline *pl,
327364 int offset, int size, VkShaderStageFlagBits stage)
328365 {
329366 VkPushConstantRange *pc;
@@ -343,37 +380,37 @@ int ff_vk_add_push_constant(AVFilterContext *avctx, VulkanPipeline *pl, · 13 unmodified lines
343380 return 0;
344381 }
345382
346−FN_CREATING(VulkanFilterContext, FFVkExecContext, exec_ctx, exec_ctx, exec_ctx_num)
347−int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx)
383+FN_CREATING(FFVulkanContext, FFVkExecContext, exec_ctx, exec_ctx, exec_ctx_num)
384+int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx,
385+ FFVkQueueFamilyCtx *qf)
348386 {
349387 VkResult ret;
350388 FFVkExecContext *e;
351− VulkanFilterContext *s = avctx->priv;
389+ FFVulkanContext *s = avctx->priv;
352390 FFVulkanFunctions *vk = &s->vkfn;
353391
354− int queue_family = s->queue_family_idx;
355− int nb_queues = s->queue_count;
356−
357392 VkCommandPoolCreateInfo cqueue_create = {
358393 .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
359394 .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
360− .queueFamilyIndex = queue_family,
395+ .queueFamilyIndex = qf->queue_family,
361396 };
362397 VkCommandBufferAllocateInfo cbuf_create = {
363398 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
364399 .level = VK_COMMAND_BUFFER_LEVEL_PRIMARY,
365− .commandBufferCount = nb_queues,
400+ .commandBufferCount = qf->nb_queues,
366401 };
367402
368403 e = create_exec_ctx(s);
369404 if (!e)
370405 return AVERROR(ENOMEM);
371406
372− e->queues = av_mallocz(nb_queues * sizeof(*e->queues));
407+ e->qf = qf;
408+
409+ e->queues = av_mallocz(qf->nb_queues * sizeof(*e->queues));
373410 if (!e->queues)
374411 return AVERROR(ENOMEM);
375412
376− e->bufs = av_mallocz(nb_queues * sizeof(*e->bufs));
413+ e->bufs = av_mallocz(qf->nb_queues * sizeof(*e->bufs));
377414 if (!e->bufs)
378415 return AVERROR(ENOMEM);
379416
@@ -396,9 +433,9 @@ int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx) · 16 unmodified lines
396433 return AVERROR_EXTERNAL;
397434 }
398435
399− for (int i = 0; i < nb_queues; i++) {
436+ for (int i = 0; i < qf->nb_queues; i++) {
400437 FFVkQueueCtx *q = &e->queues[i];
401− vk->GetDeviceQueue(s->hwctx->act_dev, queue_family, i, &q->queue);
438+ vk->GetDeviceQueue(s->hwctx->act_dev, qf->queue_family, i, &q->queue);
402439 }
403440
404441 *ctx = e;
@@ -408,8 +445,7 @@ int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx) · 3 unmodified lines
408445
409446 void ff_vk_discard_exec_deps(AVFilterContext *avctx, FFVkExecContext *e)
410447 {
411− VulkanFilterContext *s = avctx->priv;
412− FFVkQueueCtx *q = &e->queues[s->cur_queue_idx];
448+ FFVkQueueCtx *q = &e->queues[e->qf->cur_queue];
413449
414450 for (int j = 0; j < q->nb_buf_deps; j++)
415451 av_buffer_unref(&q->buf_deps[j]);
@@ -426,9 +462,9 @@ void ff_vk_discard_exec_deps(AVFilterContext *avctx, FFVkExecContext *e) · 10 unmodified lines
426462 int ff_vk_start_exec_recording(AVFilterContext *avctx, FFVkExecContext *e)
427463 {
428464 VkResult ret;
429− VulkanFilterContext *s = avctx->priv;
465+ FFVulkanContext *s = avctx->priv;
430466 FFVulkanFunctions *vk = &s->vkfn;
431− FFVkQueueCtx *q = &e->queues[s->cur_queue_idx];
467+ FFVkQueueCtx *q = &e->queues[e->qf->cur_queue];
432468
433469 VkCommandBufferBeginInfo cmd_start = {
434470 .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
@@ -455,7 +491,7 @@ int ff_vk_start_exec_recording(AVFilterContext *avctx, FFVkExecContext *e) · 20 unmodified lines
455491 /* Discard queue dependencies */
456492 ff_vk_discard_exec_deps(avctx, e);
457493
458− ret = vk->BeginCommandBuffer(e->bufs[s->cur_queue_idx], &cmd_start);
494+ ret = vk->BeginCommandBuffer(e->bufs[e->qf->cur_queue], &cmd_start);
459495 if (ret != VK_SUCCESS) {
460496 av_log(avctx, AV_LOG_ERROR, "Failed to start command recoding: %s\n",
461497 ff_vk_ret2str(ret));
@@ -467,17 +503,15 @@ int ff_vk_start_exec_recording(AVFilterContext *avctx, FFVkExecContext *e) · 5 unmodified lines
467503
468504 VkCommandBuffer ff_vk_get_exec_buf(AVFilterContext *avctx, FFVkExecContext *e)
469505 {
470− VulkanFilterContext *s = avctx->priv;
471− return e->bufs[s->cur_queue_idx];
506+ return e->bufs[e->qf->cur_queue];
472507 }
473508
474509 int ff_vk_add_exec_dep(AVFilterContext *avctx, FFVkExecContext *e,
475510 AVFrame *frame, VkPipelineStageFlagBits in_wait_dst_flag)
476511 {
477512 AVFrame **dst;
478− VulkanFilterContext *s = avctx->priv;
479513 AVVkFrame *f = (AVVkFrame *)frame->data[0];
480− FFVkQueueCtx *q = &e->queues[s->cur_queue_idx];
514+ FFVkQueueCtx *q = &e->queues[e->qf->cur_queue];
481515 AVHWFramesContext *fc = (AVHWFramesContext *)frame->hw_frames_ctx->data;
482516 int planes = av_pix_fmt_count_planes(fc->sw_format);
483517
@@ -517,16 +551,21 @@ int ff_vk_add_exec_dep(AVFilterContext *avctx, FFVkExecContext *e, · 33 unmodified lines
517551 return AVERROR(ENOMEM);
518552 }
519553
554+ e->sem_sig_val_dst = av_fast_realloc(e->sem_sig_val_dst, &e->sem_sig_val_dst_alloc,
555+ (e->sem_sig_cnt + 1)*sizeof(*e->sem_sig_val_dst));
556+ if (!e->sem_sig_val_dst) {
557+ ff_vk_discard_exec_deps(avctx, e);
558+ return AVERROR(ENOMEM);
559+ }
560+
520561 e->sem_wait[e->sem_wait_cnt] = f->sem[i];
521562 e->sem_wait_dst[e->sem_wait_cnt] = in_wait_dst_flag;
522563 e->sem_wait_val[e->sem_wait_cnt] = f->sem_value[i];
523564 e->sem_wait_cnt++;
524565
525− /* TODO: fix this in case execution fails */
526− f->sem_value[i]++;
527−
528566 e->sem_sig[e->sem_sig_cnt] = f->sem[i];
529− e->sem_sig_val[e->sem_sig_cnt] = f->sem_value[i];
567+ e->sem_sig_val[e->sem_sig_cnt] = f->sem_value[i] + 1;
568+ e->sem_sig_val_dst[e->sem_sig_cnt] = &f->sem_value[i];
530569 e->sem_sig_cnt++;
531570 }
532571
@@ -551,9 +590,9 @@ int ff_vk_add_exec_dep(AVFilterContext *avctx, FFVkExecContext *e, · 18 unmodified lines
551590 int ff_vk_submit_exec_queue(AVFilterContext *avctx, FFVkExecContext *e)
552591 {
553592 VkResult ret;
554− VulkanFilterContext *s = avctx->priv;
593+ FFVulkanContext *s = avctx->priv;
555594 FFVulkanFunctions *vk = &s->vkfn;
556− FFVkQueueCtx *q = &e->queues[s->cur_queue_idx];
595+ FFVkQueueCtx *q = &e->queues[e->qf->cur_queue];
557596
558597 VkTimelineSemaphoreSubmitInfo s_timeline_sem_info = {
559598 .sType = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO,
@@ -568,7 +607,7 @@ int ff_vk_submit_exec_queue(AVFilterContext *avctx, FFVkExecContext *e) · 8 unmodified lines
568607 .pNext = &s_timeline_sem_info,
569608
570609 .commandBufferCount = 1,
571− .pCommandBuffers = &e->bufs[s->cur_queue_idx],
610+ .pCommandBuffers = &e->bufs[e->qf->cur_queue],
572611
573612 .pWaitSemaphores = e->sem_wait,
574613 .pWaitDstStageMask = e->sem_wait_dst,
@@ -578,7 +617,7 @@ int ff_vk_submit_exec_queue(AVFilterContext *avctx, FFVkExecContext *e) · 3 unmodified lines
578617 .signalSemaphoreCount = e->sem_sig_cnt,
579618 };
580619
581− ret = vk->EndCommandBuffer(e->bufs[s->cur_queue_idx]);
620+ ret = vk->EndCommandBuffer(e->bufs[e->qf->cur_queue]);
582621 if (ret != VK_SUCCESS) {
583622 av_log(avctx, AV_LOG_ERROR, "Unable to finish command buffer: %s\n",
584623 ff_vk_ret2str(ret));
@@ -592,8 +631,8 @@ int ff_vk_submit_exec_queue(AVFilterContext *avctx, FFVkExecContext *e) · 7 unmodified lines
592631 return AVERROR_EXTERNAL;
593632 }
594633
595− /* Rotate queues */
596− s->cur_queue_idx = (s->cur_queue_idx + 1) % s->queue_count;
634+ for (int i = 0; i < e->sem_sig_cnt; i++)
635+ *e->sem_sig_val_dst[i] += 1;
597636
598637 return 0;
599638 }
@@ -602,8 +641,7 @@ int ff_vk_add_dep_exec_ctx(AVFilterContext *avctx, FFVkExecContext *e, · 2 unmodified lines
602641 AVBufferRef **deps, int nb_deps)
603642 {
604643 AVBufferRef **dst;
605− VulkanFilterContext *s = avctx->priv;
606− FFVkQueueCtx *q = &e->queues[s->cur_queue_idx];
644+ FFVkQueueCtx *q = &e->queues[e->qf->cur_queue];
607645
608646 if (!deps || !nb_deps)
609647 return 0;
@@ -632,7 +670,7 @@ err: · 22 unmodified lines
632670 static int vulkan_filter_set_device(AVFilterContext *avctx,
633671 AVBufferRef *device)
634672 {
635− VulkanFilterContext *s = avctx->priv;
673+ FFVulkanContext *s = avctx->priv;
636674
637675 av_buffer_unref(&s->device_ref);
638676
@@ -649,7 +687,7 @@ static int vulkan_filter_set_device(AVFilterContext *avctx, · 10 unmodified lines
649687 static int vulkan_filter_set_frames(AVFilterContext *avctx,
650688 AVBufferRef *frames)
651689 {
652− VulkanFilterContext *s = avctx->priv;
690+ FFVulkanContext *s = avctx->priv;
653691
654692 av_buffer_unref(&s->frames_ref);
655693
@@ -664,7 +702,8 @@ int ff_vk_filter_config_input(AVFilterLink *inlink) · 8 unmodified lines
664702 {
665703 int err;
666704 AVFilterContext *avctx = inlink->dst;
667− VulkanFilterContext *s = avctx->priv;
705+ FFVulkanContext *s = avctx->priv;
706+ FFVulkanFunctions *vk = &s->vkfn;
668707 AVHWFramesContext *input_frames;
669708
670709 if (!inlink->hw_frames_ctx) {
@@ -695,6 +734,9 @@ int ff_vk_filter_config_input(AVFilterLink *inlink) · 24 unmodified lines
695734 if (err < 0)
696735 return err;
697736
737+ vk->GetPhysicalDeviceProperties(s->hwctx->phys_dev, &s->props);
738+ vk->GetPhysicalDeviceMemoryProperties(s->hwctx->phys_dev, &s->mprops);
739+
698740 /* Default output parameters match input parameters. */
699741 s->input_format = input_frames->sw_format;
700742 if (s->output_format == AV_PIX_FMT_NONE)
@@ -711,7 +753,7 @@ int ff_vk_filter_config_output_inplace(AVFilterLink *outlink) · 10 unmodified lines
711753 {
712754 int err;
713755 AVFilterContext *avctx = outlink->src;
714− VulkanFilterContext *s = avctx->priv;
756+ FFVulkanContext *s = avctx->priv;
715757
716758 av_buffer_unref(&outlink->hw_frames_ctx);
717759
@@ -741,7 +783,7 @@ int ff_vk_filter_config_output(AVFilterLink *outlink) · 23 unmodified lines
741783 {
742784 int err;
743785 AVFilterContext *avctx = outlink->src;
744− VulkanFilterContext *s = avctx->priv;
786+ FFVulkanContext *s = avctx->priv;
745787 AVBufferRef *output_frames_ref;
746788 AVHWFramesContext *output_frames;
747789
@@ -790,7 +832,7 @@ fail: · 42 unmodified lines
790832
791833 int ff_vk_filter_init(AVFilterContext *avctx)
792834 {
793− VulkanFilterContext *s = avctx->priv;
835+ FFVulkanContext *s = avctx->priv;
794836
795837 s->output_format = AV_PIX_FMT_NONE;
796838
@@ -800,12 +842,12 @@ int ff_vk_filter_init(AVFilterContext *avctx) · 3 unmodified lines
800842 return 0;
801843 }
802844
803−FN_CREATING(VulkanFilterContext, VkSampler, sampler, samplers, samplers_num)
804−VkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords,
805− VkFilter filt)
845+FN_CREATING(FFVulkanContext, FFVkSampler, sampler, samplers, samplers_num)
846+FFVkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords,
847+ VkFilter filt)
806848 {
807849 VkResult ret;
808− VulkanFilterContext *s = avctx->priv;
850+ FFVulkanContext *s = avctx->priv;
809851 FFVulkanFunctions *vk = &s->vkfn;
810852
811853 VkSamplerCreateInfo sampler_info = {
@@ -823,19 +865,22 @@ VkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords, · 11 unmodified lines
823865 .unnormalizedCoordinates = unnorm_coords,
824866 };
825867
826− VkSampler *sampler = create_sampler(s);
827− if (!sampler)
868+ FFVkSampler *sctx = create_sampler(s);
869+ if (!sctx)
828870 return NULL;
829871
830872 ret = vk->CreateSampler(s->hwctx->act_dev, &sampler_info,
831− s->hwctx->alloc, sampler);
873+ s->hwctx->alloc, &sctx->sampler[0]);
832874 if (ret != VK_SUCCESS) {
833875 av_log(avctx, AV_LOG_ERROR, "Unable to init sampler: %s\n",
834876 ff_vk_ret2str(ret));
835877 return NULL;
836878 }
837879
838− return sampler;
880+ for (int i = 1; i < 4; i++)
881+ sctx->sampler[i] = sctx->sampler[0];
882+
883+ return sctx;
839884 }
840885
841886 int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
@@ -863,7 +908,7 @@ typedef struct ImageViewCtx { · 21 unmodified lines
863908
864909 static void destroy_imageview(void *opaque, uint8_t *data)
865910 {
866− VulkanFilterContext *s = opaque;
911+ FFVulkanContext *s = opaque;
867912 FFVulkanFunctions *vk = &s->vkfn;
868913 ImageViewCtx *iv = (ImageViewCtx *)data;
869914
@@ -877,7 +922,7 @@ int ff_vk_create_imageview(AVFilterContext *avctx, FFVkExecContext *e, · 7 unmodified lines
877922 {
878923 int err;
879924 AVBufferRef *buf;
880− VulkanFilterContext *s = avctx->priv;
925+ FFVulkanContext *s = avctx->priv;
881926 FFVulkanFunctions *vk = &s->vkfn;
882927
883928 VkImageViewCreateInfo imgview_spawn = {
@@ -924,8 +969,8 @@ int ff_vk_create_imageview(AVFilterContext *avctx, FFVkExecContext *e, · 40 unmodified lines
924969 return 0;
925970 }
926971
927−FN_CREATING(VulkanPipeline, FFSPIRVShader, shader, shaders, shaders_num)
928−FFSPIRVShader *ff_vk_init_shader(AVFilterContext *avctx, VulkanPipeline *pl,
972+FN_CREATING(FFVulkanPipeline, FFSPIRVShader, shader, shaders, shaders_num)
973+FFSPIRVShader *ff_vk_init_shader(AVFilterContext *avctx, FFVulkanPipeline *pl,
929974 const char *name, VkShaderStageFlags stage)
930975 {
931976 FFSPIRVShader *shd = create_shader(pl);
@@ -984,7 +1029,7 @@ int ff_vk_compile_shader(AVFilterContext *avctx, FFSPIRVShader *shd, · 52 unmodified lines
9841029 {
9851030 int err;
9861031 VkResult ret;
987− VulkanFilterContext *s = avctx->priv;
1032+ FFVulkanContext *s = avctx->priv;
9881033 FFVulkanFunctions *vk = &s->vkfn;
9891034 VkShaderModuleCreateInfo shader_create;
9901035 uint8_t *spirv;
@@ -1043,25 +1088,24 @@ static const struct descriptor_props { · 52 unmodified lines
10431088 [VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER] = { sizeof(VkBufferView), "imageBuffer", 1, 0, 0, 0, },
10441089 };
10451090
1046−int ff_vk_add_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl,
1047− FFSPIRVShader *shd, VulkanDescriptorSetBinding *desc,
1091+int ff_vk_add_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl,
1092+ FFSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc,
10481093 int num, int only_print_to_shader)
10491094 {
10501095 VkResult ret;
10511096 VkDescriptorSetLayout *layout;
1052− VulkanFilterContext *s = avctx->priv;
1097+ FFVulkanContext *s = avctx->priv;
10531098 FFVulkanFunctions *vk = &s->vkfn;
10541099
10551100 if (only_print_to_shader)
10561101 goto print;
10571102
10581103 pl->desc_layout = av_realloc_array(pl->desc_layout, sizeof(*pl->desc_layout),
1059− pl->desc_layout_num + 1);
1104+ pl->desc_layout_num + pl->qf->nb_queues);
10601105 if (!pl->desc_layout)
10611106 return AVERROR(ENOMEM);
10621107
10631108 layout = &pl->desc_layout[pl->desc_layout_num];
1064− memset(layout, 0, sizeof(*layout));
10651109
10661110 { /* Create descriptor set layout descriptions */
10671111 VkDescriptorSetLayoutCreateInfo desc_create_layout = { 0 };
@@ -1076,21 +1120,27 @@ int ff_vk_add_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl, · 8 unmodified lines
10761120 desc_binding[i].descriptorType = desc[i].type;
10771121 desc_binding[i].descriptorCount = FFMAX(desc[i].elems, 1);
10781122 desc_binding[i].stageFlags = desc[i].stages;
1079− desc_binding[i].pImmutableSamplers = desc[i].samplers;
1123+ desc_binding[i].pImmutableSamplers = desc[i].sampler ?
1124+ desc[i].sampler->sampler :
1125+ NULL;
10801126 }
10811127
10821128 desc_create_layout.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
10831129 desc_create_layout.pBindings = desc_binding;
10841130 desc_create_layout.bindingCount = num;
10851131
1086− ret = vk->CreateDescriptorSetLayout(s->hwctx->act_dev, &desc_create_layout,
1087− s->hwctx->alloc, layout);
1088− av_free(desc_binding);
1089− if (ret != VK_SUCCESS) {
1090− av_log(avctx, AV_LOG_ERROR, "Unable to init descriptor set "
1091− "layout: %s\n", ff_vk_ret2str(ret));
1092− return AVERROR_EXTERNAL;
1132+ for (int i = 0; i < pl->qf->nb_queues; i++) {
1133+ ret = vk->CreateDescriptorSetLayout(s->hwctx->act_dev, &desc_create_layout,
1134+ s->hwctx->alloc, &layout[i]);
1135+ if (ret != VK_SUCCESS) {
1136+ av_log(avctx, AV_LOG_ERROR, "Unable to init descriptor set "
1137+ "layout: %s\n", ff_vk_ret2str(ret));
1138+ av_free(desc_binding);
1139+ return AVERROR_EXTERNAL;
1140+ }
10931141 }
1142+
1143+ av_free(desc_binding);
10941144 }
10951145
10961146 { /* Pool each descriptor by type and update pool counts */
@@ -1108,7 +1158,7 @@ int ff_vk_add_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl, · 11 unmodified lines
11081158 memset(&pl->pool_size_desc[j], 0, sizeof(VkDescriptorPoolSize));
11091159 }
11101160 pl->pool_size_desc[j].type = desc[i].type;
1111− pl->pool_size_desc[j].descriptorCount += FFMAX(desc[i].elems, 1);
1161+ pl->pool_size_desc[j].descriptorCount += FFMAX(desc[i].elems, 1)*pl->qf->nb_queues;
11121162 }
11131163 }
11141164
@@ -1132,27 +1182,32 @@ int ff_vk_add_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl, · 17 unmodified lines
11321182
11331183 pl->desc_template_info = av_realloc_array(pl->desc_template_info,
11341184 sizeof(*pl->desc_template_info),
1135− pl->desc_layout_num + 1);
1185+ pl->total_descriptor_sets + pl->qf->nb_queues);
11361186 if (!pl->desc_template_info)
11371187 return AVERROR(ENOMEM);
11381188
1139− dt = &pl->desc_template_info[pl->desc_layout_num];
1140− memset(dt, 0, sizeof(*dt));
1189+ dt = &pl->desc_template_info[pl->total_descriptor_sets];
1190+ memset(dt, 0, sizeof(*dt)*pl->qf->nb_queues);
11411191
1142− dt->sType = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO;
1143− dt->templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET;
1144− dt->descriptorSetLayout = *layout;
1145− dt->pDescriptorUpdateEntries = des_entries;
1146− dt->descriptorUpdateEntryCount = num;
1192+ for (int i = 0; i < pl->qf->nb_queues; i++) {
1193+ dt[i].sType = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO;
1194+ dt[i].templateType = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET;
1195+ dt[i].descriptorSetLayout = layout[i];
1196+ dt[i].pDescriptorUpdateEntries = des_entries;
1197+ dt[i].descriptorUpdateEntryCount = num;
1198+ }
11471199 }
11481200
1149− pl->desc_layout_num++;
1201+ pl->descriptor_sets_num++;
1202+
1203+ pl->desc_layout_num += pl->qf->nb_queues;
1204+ pl->total_descriptor_sets += pl->qf->nb_queues;
11501205
11511206 print:
11521207 /* Write shader info */
11531208 for (int i = 0; i < num; i++) {
11541209 const struct descriptor_props *prop = &descriptor_props[desc[i].type];
1155− GLSLA("layout (set = %i, binding = %i", pl->desc_layout_num - 1, i);
1210+ GLSLA("layout (set = %i, binding = %i", pl->descriptor_sets_num - 1, i);
11561211
11571212 if (desc[i].mem_layout)
11581213 GLSLA(", %s", desc[i].mem_layout);
@@ -1184,12 +1239,14 @@ print: · 25 unmodified lines
11841239 return 0;
11851240 }
11861241
1187−void ff_vk_update_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl,
1242+void ff_vk_update_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl,
11881243 int set_id)
11891244 {
1190− VulkanFilterContext *s = avctx->priv;
1245+ FFVulkanContext *s = avctx->priv;
11911246 FFVulkanFunctions *vk = &s->vkfn;
11921247
1248+ set_id = set_id*pl->qf->nb_queues + pl->qf->cur_queue;
1249+
11931250 vk->UpdateDescriptorSetWithTemplate(s->hwctx->act_dev,
11941251 pl->desc_set[set_id],
11951252 pl->desc_template[set_id],
@@ -1200,27 +1257,29 @@ void ff_vk_update_push_exec(AVFilterContext *avctx, FFVkExecContext *e, · 4 unmodified lines
12001257 VkShaderStageFlagBits stage, int offset,
12011258 size_t size, void *src)
12021259 {
1203− VulkanFilterContext *s = avctx->priv;
1260+ FFVulkanContext *s = avctx->priv;
12041261 FFVulkanFunctions *vk = &s->vkfn;
12051262
1206− vk->CmdPushConstants(e->bufs[s->cur_queue_idx], e->bound_pl->pipeline_layout,
1263+ vk->CmdPushConstants(e->bufs[e->qf->cur_queue], e->bound_pl->pipeline_layout,
12071264 stage, offset, size, src);
12081265 }
12091266
1210−int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl)
1267+int ff_vk_init_pipeline_layout(AVFilterContext *avctx, FFVulkanPipeline *pl)
12111268 {
12121269 VkResult ret;
1213− VulkanFilterContext *s = avctx->priv;
1270+ FFVulkanContext *s = avctx->priv;
12141271 FFVulkanFunctions *vk = &s->vkfn;
12151272
1216− pl->descriptor_sets_num = pl->desc_layout_num * s->queue_count;
1273+ pl->desc_staging = av_malloc(pl->descriptor_sets_num*sizeof(*pl->desc_staging));
1274+ if (!pl->desc_staging)
1275+ return AVERROR(ENOMEM);
12171276
12181277 { /* Init descriptor set pool */
12191278 VkDescriptorPoolCreateInfo pool_create_info = {
12201279 .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
12211280 .poolSizeCount = pl->pool_size_desc_num,
12221281 .pPoolSizes = pl->pool_size_desc,
1223− .maxSets = pl->descriptor_sets_num,
1282+ .maxSets = pl->total_descriptor_sets,
12241283 };
12251284
12261285 ret = vk->CreateDescriptorPool(s->hwctx->act_dev, &pool_create_info,
@@ -1237,11 +1296,11 @@ int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl) · 10 unmodified lines
12371296 VkDescriptorSetAllocateInfo alloc_info = {
12381297 .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO,
12391298 .descriptorPool = pl->desc_pool,
1240− .descriptorSetCount = pl->descriptor_sets_num,
1299+ .descriptorSetCount = pl->total_descriptor_sets,
12411300 .pSetLayouts = pl->desc_layout,
12421301 };
12431302
1244− pl->desc_set = av_malloc(pl->descriptor_sets_num*sizeof(*pl->desc_set));
1303+ pl->desc_set = av_malloc(pl->total_descriptor_sets*sizeof(*pl->desc_set));
12451304 if (!pl->desc_set)
12461305 return AVERROR(ENOMEM);
12471306
@@ -1257,12 +1316,14 @@ int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl) · 9 unmodified lines
12571316 { /* Finally create the pipeline layout */
12581317 VkPipelineLayoutCreateInfo spawn_pipeline_layout = {
12591318 .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
1260− .setLayoutCount = pl->desc_layout_num,
1261− .pSetLayouts = pl->desc_layout,
1319+ .pSetLayouts = (VkDescriptorSetLayout *)pl->desc_staging,
12621320 .pushConstantRangeCount = pl->push_consts_num,
12631321 .pPushConstantRanges = pl->push_consts,
12641322 };
12651323
1324+ for (int i = 0; i < pl->total_descriptor_sets; i += pl->qf->nb_queues)
1325+ pl->desc_staging[spawn_pipeline_layout.setLayoutCount++] = pl->desc_layout[i];
1326+
12661327 ret = vk->CreatePipelineLayout(s->hwctx->act_dev, &spawn_pipeline_layout,
12671328 s->hwctx->alloc, &pl->pipeline_layout);
12681329 av_freep(&pl->push_consts);
@@ -1275,21 +1336,19 @@ int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl) · 6 unmodified lines
12751336 }
12761337
12771338 { /* Descriptor template (for tightly packed descriptors) */
1278− VkDescriptorUpdateTemplateCreateInfo *desc_template_info;
1339+ VkDescriptorUpdateTemplateCreateInfo *dt;
12791340
1280− pl->desc_template = av_malloc(pl->descriptor_sets_num*sizeof(*pl->desc_template));
1341+ pl->desc_template = av_malloc(pl->total_descriptor_sets*sizeof(*pl->desc_template));
12811342 if (!pl->desc_template)
12821343 return AVERROR(ENOMEM);
12831344
12841345 /* Create update templates for the descriptor sets */
1285− for (int i = 0; i < pl->descriptor_sets_num; i++) {
1286− desc_template_info = &pl->desc_template_info[i % pl->desc_layout_num];
1287− desc_template_info->pipelineLayout = pl->pipeline_layout;
1346+ for (int i = 0; i < pl->total_descriptor_sets; i++) {
1347+ dt = &pl->desc_template_info[i];
1348+ dt->pipelineLayout = pl->pipeline_layout;
12881349 ret = vk->CreateDescriptorUpdateTemplate(s->hwctx->act_dev,
1289− desc_template_info,
1290− s->hwctx->alloc,
1350+ dt, s->hwctx->alloc,
12911351 &pl->desc_template[i]);
1292− av_free((void *)desc_template_info->pDescriptorUpdateEntries);
12931352 if (ret != VK_SUCCESS) {
12941353 av_log(avctx, AV_LOG_ERROR, "Unable to init descriptor "
12951354 "template: %s\n", ff_vk_ret2str(ret));
@@ -1297,23 +1356,34 @@ int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl) · 1 unmodified line
12971356 }
12981357 }
12991358
1359+ /* Free the duplicated memory used for the template entries */
1360+ for (int i = 0; i < pl->total_descriptor_sets; i += pl->qf->nb_queues) {
1361+ dt = &pl->desc_template_info[i];
1362+ av_free((void *)dt->pDescriptorUpdateEntries);
1363+ }
1364+
13001365 av_freep(&pl->desc_template_info);
13011366 }
13021367
13031368 return 0;
13041369 }
13051370
1306−FN_CREATING(VulkanFilterContext, VulkanPipeline, pipeline, pipelines, pipelines_num)
1307−VulkanPipeline *ff_vk_create_pipeline(AVFilterContext *avctx)
1371+FN_CREATING(FFVulkanContext, FFVulkanPipeline, pipeline, pipelines, pipelines_num)
1372+FFVulkanPipeline *ff_vk_create_pipeline(AVFilterContext *avctx,
1373+ FFVkQueueFamilyCtx *qf)
13081374 {
1309− return create_pipeline(avctx->priv);
1375+ FFVulkanPipeline *pl = create_pipeline(avctx->priv);
1376+ if (pl)
1377+ pl->qf = qf;
1378+
1379+ return pl;
13101380 }
13111381
1312−int ff_vk_init_compute_pipeline(AVFilterContext *avctx, VulkanPipeline *pl)
1382+int ff_vk_init_compute_pipeline(AVFilterContext *avctx, FFVulkanPipeline *pl)
13131383 {
13141384 int i;
13151385 VkResult ret;
1316− VulkanFilterContext *s = avctx->priv;
1386+ FFVulkanContext *s = avctx->priv;
13171387 FFVulkanFunctions *vk = &s->vkfn;
13181388
13191389 VkComputePipelineCreateInfo pipe = {
@@ -1346,26 +1416,31 @@ int ff_vk_init_compute_pipeline(AVFilterContext *avctx, VulkanPipeline *pl) · 26 unmodified lines
13461416 }
13471417
13481418 void ff_vk_bind_pipeline_exec(AVFilterContext *avctx, FFVkExecContext *e,
1349− VulkanPipeline *pl)
1419+ FFVulkanPipeline *pl)
13501420 {
1351− VulkanFilterContext *s = avctx->priv;
1421+ FFVulkanContext *s = avctx->priv;
13521422 FFVulkanFunctions *vk = &s->vkfn;
13531423
1354− vk->CmdBindPipeline(e->bufs[s->cur_queue_idx], pl->bind_point, pl->pipeline);
1424+ vk->CmdBindPipeline(e->bufs[e->qf->cur_queue], pl->bind_point, pl->pipeline);
13551425
1356− vk->CmdBindDescriptorSets(e->bufs[s->cur_queue_idx], pl->bind_point,
1357− pl->pipeline_layout, 0, pl->descriptor_sets_num,
1358− pl->desc_set, 0, 0);
1426+ for (int i = 0; i < pl->descriptor_sets_num; i++)
1427+ pl->desc_staging[i] = pl->desc_set[i*pl->qf->nb_queues + pl->qf->cur_queue];
1428+
1429+ vk->CmdBindDescriptorSets(e->bufs[e->qf->cur_queue], pl->bind_point,
1430+ pl->pipeline_layout, 0,
1431+ pl->descriptor_sets_num,
1432+ (VkDescriptorSet *)pl->desc_staging,
1433+ 0, NULL);
13591434
13601435 e->bound_pl = pl;
13611436 }
13621437
1363−static void free_exec_ctx(VulkanFilterContext *s, FFVkExecContext *e)
1438+static void free_exec_ctx(FFVulkanContext *s, FFVkExecContext *e)
13641439 {
13651440 FFVulkanFunctions *vk = &s->vkfn;
13661441
13671442 /* Make sure all queues have finished executing */
1368− for (int i = 0; i < s->queue_count; i++) {
1443+ for (int i = 0; i < e->qf->nb_queues; i++) {
13691444 FFVkQueueCtx *q = &e->queues[i];
13701445
13711446 if (q->fence) {
@@ -1389,7 +1464,7 @@ static void free_exec_ctx(VulkanFilterContext *s, FFVkExecContext *e) · 17 unmodified lines
13891464 }
13901465
13911466 if (e->bufs)
1392− vk->FreeCommandBuffers(s->hwctx->act_dev, e->pool, s->queue_count, e->bufs);
1467+ vk->FreeCommandBuffers(s->hwctx->act_dev, e->pool, e->qf->nb_queues, e->bufs);
13931468 if (e->pool)
13941469 vk->DestroyCommandPool(s->hwctx->act_dev, e->pool, s->hwctx->alloc);
13951470
@@ -1397,13 +1472,14 @@ static void free_exec_ctx(VulkanFilterContext *s, FFVkExecContext *e) · 1 unmodified line
13971472 av_freep(&e->queues);
13981473 av_freep(&e->sem_sig);
13991474 av_freep(&e->sem_sig_val);
1475+ av_freep(&e->sem_sig_val_dst);
14001476 av_freep(&e->sem_wait);
14011477 av_freep(&e->sem_wait_dst);
14021478 av_freep(&e->sem_wait_val);
14031479 av_free(e);
14041480 }
14051481
1406−static void free_pipeline(VulkanFilterContext *s, VulkanPipeline *pl)
1482+static void free_pipeline(FFVulkanContext *s, FFVulkanPipeline *pl)
14071483 {
14081484 FFVulkanFunctions *vk = &s->vkfn;
14091485
@@ -1433,6 +1509,7 @@ static void free_pipeline(VulkanFilterContext *s, VulkanPipeline *pl) · 23 unmodified lines
14331509 vk->DestroyDescriptorPool(s->hwctx->act_dev, pl->desc_pool,
14341510 s->hwctx->alloc);
14351511
1512+ av_freep(&pl->desc_staging);
14361513 av_freep(&pl->desc_set);
14371514 av_freep(&pl->shaders);
14381515 av_freep(&pl->desc_layout);
@@ -1443,8 +1520,10 @@ static void free_pipeline(VulkanFilterContext *s, VulkanPipeline *pl) · 4 unmodified lines
14431520 /* Only freed in case of failure */
14441521 av_freep(&pl->pool_size_desc);
14451522 if (pl->desc_template_info) {
1446− for (int i = 0; i < pl->descriptor_sets_num; i++)
1447− av_free((void *)pl->desc_template_info[i].pDescriptorUpdateEntries);
1523+ for (int i = 0; i < pl->total_descriptor_sets; i += pl->qf->nb_queues) {
1524+ VkDescriptorUpdateTemplateCreateInfo *dt = &pl->desc_template_info[i];
1525+ av_free((void *)dt->pDescriptorUpdateEntries);
1526+ }
14481527 av_freep(&pl->desc_template_info);
14491528 }
14501529
@@ -1453,7 +1532,7 @@ static void free_pipeline(VulkanFilterContext *s, VulkanPipeline *pl) · 2 unmodified lines
14531532
14541533 void ff_vk_filter_uninit(AVFilterContext *avctx)
14551534 {
1456− VulkanFilterContext *s = avctx->priv;
1535+ FFVulkanContext *s = avctx->priv;
14571536 FFVulkanFunctions *vk = &s->vkfn;
14581537
14591538 ff_vk_glslang_uninit();
@@ -1463,7 +1542,8 @@ void ff_vk_filter_uninit(AVFilterContext *avctx) · 3 unmodified lines
14631542 av_freep(&s->exec_ctx);
14641543
14651544 for (int i = 0; i < s->samplers_num; i++) {
1466− vk->DestroySampler(s->hwctx->act_dev, *s->samplers[i], s->hwctx->alloc);
1545+ vk->DestroySampler(s->hwctx->act_dev, s->samplers[i]->sampler[0],
1546+ s->hwctx->alloc);
14671547 av_free(s->samplers[i]);
14681548 }
14691549 av_freep(&s->samplers);
libavfilter/vulkan.h+66−37
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #define AVFILTER_VULKAN_H
2121
2222 #define VK_NO_PROTOTYPES
23+#define VK_ENABLE_BETA_EXTENSIONS
2324
2425 #include "avfilter.h"
2526 #include "libavutil/pixdesc.h"
@@ -52,9 +53,6 @@ · 26 unmodified lines
5253 goto fail; \
5354 } while (0)
5455
55−/* Useful for attaching immutable samplers to arrays */
56−#define DUP_SAMPLER_ARRAY4(x) (VkSampler []){ x, x, x, x, }
57−
5856 typedef struct FFSPIRVShader {
5957 const char *name; /* Name for id/debugging purposes */
6058 AVBPrint src;
@@ -62,7 +60,11 @@ typedef struct FFSPIRVShader { · 1 unmodified line
6260 VkPipelineShaderStageCreateInfo shader;
6361 } FFSPIRVShader;
6462
65−typedef struct VulkanDescriptorSetBinding {
63+typedef struct FFVkSampler {
64+ VkSampler sampler[4];
65+} FFVkSampler;
66+
67+typedef struct FFVulkanDescriptorSetBinding {
6668 const char *name;
6769 VkDescriptorType type;
6870 const char *mem_layout; /* Storage images (rgba8, etc.) and buffers (std430, etc.) */
@@ -71,9 +73,9 @@ typedef struct VulkanDescriptorSetBinding { · 2 unmodified lines
7173 uint32_t dimensions; /* Needed for e.g. sampler%iD */
7274 uint32_t elems; /* 0 - scalar, 1 or more - vector */
7375 VkShaderStageFlags stages;
74− const VkSampler *samplers; /* Immutable samplers, length - #elems */
76+ FFVkSampler *sampler; /* Sampler to use for all elems */
7577 void *updater; /* Pointer to VkDescriptor*Info */
76−} VulkanDescriptorSetBinding;
78+} FFVulkanDescriptorSetBinding;
7779
7880 typedef struct FFVkBuffer {
7981 VkBuffer buf;
@@ -81,7 +83,15 @@ typedef struct FFVkBuffer { · 1 unmodified line
8183 VkMemoryPropertyFlagBits flags;
8284 } FFVkBuffer;
8385
84−typedef struct VulkanPipeline {
86+typedef struct FFVkQueueFamilyCtx {
87+ int queue_family;
88+ int nb_queues;
89+ int cur_queue;
90+} FFVkQueueFamilyCtx;
91+
92+typedef struct FFVulkanPipeline {
93+ FFVkQueueFamilyCtx *qf;
94+
8595 VkPipelineBindPoint bind_point;
8696
8797 /* Contexts */
@@ -97,18 +107,21 @@ typedef struct VulkanPipeline { · 9 unmodified lines
97107 int push_consts_num;
98108
99109 /* Descriptors */
100− VkDescriptorSetLayout *desc_layout;
101− VkDescriptorPool desc_pool;
102− VkDescriptorSet *desc_set;
103− VkDescriptorUpdateTemplate *desc_template;
104− int desc_layout_num;
105− int descriptor_sets_num;
106− int pool_size_desc_num;
110+ VkDescriptorSetLayout *desc_layout;
111+ VkDescriptorPool desc_pool;
112+ VkDescriptorSet *desc_set;
113+ void **desc_staging;
114+ VkDescriptorSetLayoutBinding **desc_binding;
115+ VkDescriptorUpdateTemplate *desc_template;
116+ int desc_layout_num;
117+ int descriptor_sets_num;
118+ int total_descriptor_sets;
119+ int pool_size_desc_num;
107120
108121 /* Temporary, used to store data in between initialization stages */
109122 VkDescriptorUpdateTemplateCreateInfo *desc_template_info;
110123 VkDescriptorPoolSize *pool_size_desc;
111−} VulkanPipeline;
124+} FFVulkanPipeline;
112125
113126 typedef struct FFVkQueueCtx {
114127 VkFence fence;
@@ -126,6 +139,8 @@ typedef struct FFVkQueueCtx { · 11 unmodified lines
126139 } FFVkQueueCtx;
127140
128141 typedef struct FFVkExecContext {
142+ FFVkQueueFamilyCtx *qf;
143+
129144 VkCommandPool pool;
130145 VkCommandBuffer *bufs;
131146 FFVkQueueCtx *queues;
@@ -134,7 +149,7 @@ typedef struct FFVkExecContext { · 2 unmodified lines
134149 int *nb_deps;
135150 int *dep_alloc_size;
136151
137− VulkanPipeline *bound_pl;
152+ FFVulkanPipeline *bound_pl;
138153
139154 VkSemaphore *sem_wait;
140155 int sem_wait_alloc; /* Allocated sem_wait */
@@ -152,23 +167,23 @@ typedef struct FFVkExecContext { · 11 unmodified lines
152167
153168 uint64_t *sem_sig_val;
154169 int sem_sig_val_alloc;
170+
171+ uint64_t **sem_sig_val_dst;
172+ int sem_sig_val_dst_alloc;
155173 } FFVkExecContext;
156174
157−typedef struct VulkanFilterContext {
175+typedef struct FFVulkanContext {
158176 const AVClass *class;
159177 FFVulkanFunctions vkfn;
160178 FFVulkanExtensions extensions;
179+ VkPhysicalDeviceProperties props;
180+ VkPhysicalDeviceMemoryProperties mprops;
161181
162182 AVBufferRef *device_ref;
163183 AVBufferRef *frames_ref; /* For in-place filtering */
164184 AVHWDeviceContext *device;
165185 AVVulkanDeviceContext *hwctx;
166186
167− /* State - mirrored with the exec ctx */
168− int cur_queue_idx;
169− int queue_family_idx;
170− int queue_count;
171−
172187 /* Properties */
173188 int output_width;
174189 int output_height;
@@ -176,7 +191,7 @@ typedef struct VulkanFilterContext { · 1 unmodified line
176191 enum AVPixelFormat input_format;
177192
178193 /* Samplers */
179− VkSampler **samplers;
194+ FFVkSampler **samplers;
180195 int samplers_num;
181196
182197 /* Exec contexts */
@@ -184,12 +199,12 @@ typedef struct VulkanFilterContext { · 1 unmodified line
184199 int exec_ctx_num;
185200
186201 /* Pipelines (each can have 1 shader of each type) */
187− VulkanPipeline **pipelines;
202+ FFVulkanPipeline **pipelines;
188203 int pipelines_num;
189204
190205 void *scratch; /* Scratch memory used only in functions */
191206 unsigned int scratch_size;
192−} VulkanFilterContext;
207+} FFVulkanContext;
193208
194209 /* Identity mapping - r = r, b = b, g = g, a = a */
195210 extern const VkComponentMapping ff_comp_identity_map;
@@ -218,11 +233,23 @@ int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt); · 22 unmodified lines
218233 */
219234 const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt);
220235
236+/**
237+ * Initialize a queue family.
238+ * A queue limit of 0 means no limit.
239+ */
240+void ff_vk_qf_init(AVFilterContext *avctx, FFVkQueueFamilyCtx *qf,
241+ VkQueueFlagBits dev_family, int queue_limit);
242+
243+/**
244+ * Rotate through the queues in a queue family.
245+ */
246+void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf);
247+
221248 /**
222249 * Create a Vulkan sampler, will be auto-freed in ff_vk_filter_uninit()
223250 */
224−VkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords,
225− VkFilter filt);
251+FFVkSampler *ff_vk_init_sampler(AVFilterContext *avctx, int unnorm_coords,
252+ VkFilter filt);
226253
227254 /**
228255 * Create an imageview.
@@ -237,19 +264,20 @@ int ff_vk_create_imageview(AVFilterContext *avctx, FFVkExecContext *e, · 8 unmodified lines
237264 * Define a push constant for a given stage into a pipeline.
238265 * Must be called before the pipeline layout has been initialized.
239266 */
240−int ff_vk_add_push_constant(AVFilterContext *avctx, VulkanPipeline *pl,
267+int ff_vk_add_push_constant(AVFilterContext *avctx, FFVulkanPipeline *pl,
241268 int offset, int size, VkShaderStageFlagBits stage);
242269
243270 /**
244271 * Inits a pipeline. Everything in it will be auto-freed when calling
245272 * ff_vk_filter_uninit().
246273 */
247−VulkanPipeline *ff_vk_create_pipeline(AVFilterContext *avctx);
274+FFVulkanPipeline *ff_vk_create_pipeline(AVFilterContext *avctx,
275+ FFVkQueueFamilyCtx *qf);
248276
249277 /**
250278 * Inits a shader for a specific pipeline. Will be auto-freed on uninit.
251279 */
252−FFSPIRVShader *ff_vk_init_shader(AVFilterContext *avctx, VulkanPipeline *pl,
280+FFSPIRVShader *ff_vk_init_shader(AVFilterContext *avctx, FFVulkanPipeline *pl,
253281 const char *name, VkShaderStageFlags stage);
254282
255283 /**
@@ -261,8 +289,8 @@ void ff_vk_set_compute_shader_sizes(AVFilterContext *avctx, FFSPIRVShader *shd, · 5 unmodified lines
261289 /**
262290 * Adds a descriptor set to the shader and registers them in the pipeline.
263291 */
264−int ff_vk_add_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl,
265− FFSPIRVShader *shd, VulkanDescriptorSetBinding *desc,
292+int ff_vk_add_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl,
293+ FFSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc,
266294 int num, int only_print_to_shader);
267295
268296 /**
@@ -280,27 +308,28 @@ void ff_vk_print_shader(AVFilterContext *avctx, FFSPIRVShader *shd, int prio); · 11 unmodified lines
280308 * Initializes the pipeline layout after all shaders and descriptor sets have
281309 * been finished.
282310 */
283−int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl);
311+int ff_vk_init_pipeline_layout(AVFilterContext *avctx, FFVulkanPipeline *pl);
284312
285313 /**
286314 * Initializes a compute pipeline. Will pick the first shader with the
287315 * COMPUTE flag set.
288316 */
289−int ff_vk_init_compute_pipeline(AVFilterContext *avctx, VulkanPipeline *pl);
317+int ff_vk_init_compute_pipeline(AVFilterContext *avctx, FFVulkanPipeline *pl);
290318
291319 /**
292320 * Updates a descriptor set via the updaters defined.
293321 * Can be called immediately after pipeline creation, but must be called
294322 * at least once before queue submission.
295323 */
296−void ff_vk_update_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl,
324+void ff_vk_update_descriptor_set(AVFilterContext *avctx, FFVulkanPipeline *pl,
297325 int set_id);
298326
299327 /**
300328 * Init an execution context for command recording and queue submission.
301329 * WIll be auto-freed on uninit.
302330 */
303−int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx);
331+int ff_vk_create_exec_ctx(AVFilterContext *avctx, FFVkExecContext **ctx,
332+ FFVkQueueFamilyCtx *qf);
304333
305334 /**
306335 * Begin recording to the command buffer. Previous execution must have been
@@ -313,7 +342,7 @@ int ff_vk_start_exec_recording(AVFilterContext *avctx, FFVkExecContext *e); · 6 unmodified lines
313342 * Must be called after ff_vk_start_exec_recording() and before submission.
314343 */
315344 void ff_vk_bind_pipeline_exec(AVFilterContext *avctx, FFVkExecContext *e,
316− VulkanPipeline *pl);
345+ FFVulkanPipeline *pl);
317346
318347 /**
319348 * Updates push constants.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t