History

vulkan: do not reinvent a queue context struct

We recently introduced a public field which was a superset of the queue context we used to have. Switch to using it entirely. This also allows us to get rid of the NIH function which was valid only for video queues.

Lynne committed 1 year ago

Commit 2e06b841 parent 157cd8222 files · +157 −123Browse files

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

Unified · Split

12 files
  1. libavfilter/vf_avgblur_vulkan.c +9 −3
  2. libavfilter/vf_blend_vulkan.c +9 −3
  3. libavfilter/vf_bwdif_vulkan.c +9 −3
  4. libavfilter/vf_chromaber_vulkan.c +9 −3
  5. libavfilter/vf_flip_vulkan.c +9 −3
  6. libavfilter/vf_gblur_vulkan.c +9 −3
  7. libavfilter/vf_nlmeans_vulkan.c +9 −3
  8. libavfilter/vf_overlay_vulkan.c +9 −3
  9. libavfilter/vf_scale_vulkan.c +9 −3
  10. libavfilter/vf_transpose_vulkan.c +9 −3
  11. libavfilter/vf_xfade_vulkan.c +9 −3
  12. libavfilter/vsrc_testsrc_vulkan.c +9 −3
libavfilter/vf_avgblur_vulkan.c+9−3
@@ -31,7 +31,7 @@ typedef struct AvgBlurVulkanContext { · 30 unmodified lines
31 31
32 int initialized;32 int initialized;
33 FFVkExecPool e;33 FFVkExecPool e;
34 FFVkQueueFamilyCtx qf;34 AVVulkanDeviceQueueFamily *qf;
35 VkSampler sampler;35 VkSampler sampler;
36 FFVulkanShader shd;36 FFVulkanShader shd;
37 37
@@ -77,8 +77,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 39 unmodified lines
77 return AVERROR_EXTERNAL;77 return AVERROR_EXTERNAL;
78 }78 }
79 79
80 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);80 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
81 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));81 if (!s->qf) {
82 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
83 err = AVERROR(ENOTSUP);
84 goto fail;
85 }
86
87 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
82 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));88 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));
83 RET(ff_vk_shader_init(vkctx, &s->shd, "avgblur",89 RET(ff_vk_shader_init(vkctx, &s->shd, "avgblur",
84 VK_SHADER_STAGE_COMPUTE_BIT,90 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_blend_vulkan.c+9−3
@@ -47,7 +47,7 @@ typedef struct BlendVulkanContext { · 46 unmodified lines
47 47
48 int initialized;48 int initialized;
49 FFVkExecPool e;49 FFVkExecPool e;
50 FFVkQueueFamilyCtx qf;50 AVVulkanDeviceQueueFamily *qf;
51 FFVulkanShader shd;51 FFVulkanShader shd;
52 VkSampler sampler;52 VkSampler sampler;
53 53
@@ -141,8 +141,14 @@ static av_cold int init_filter(AVFilterContext *avctx) · 87 unmodified lines
141 return AVERROR_EXTERNAL;141 return AVERROR_EXTERNAL;
142 }142 }
143 143
144 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);144 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
145 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));145 if (!s->qf) {
146 av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n");
147 err = AVERROR(ENOTSUP);
148 goto fail;
149 }
150
151 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
146 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));152 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
147 RET(ff_vk_shader_init(vkctx, &s->shd, "blend",153 RET(ff_vk_shader_init(vkctx, &s->shd, "blend",
148 VK_SHADER_STAGE_COMPUTE_BIT,154 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_bwdif_vulkan.c+9−3
@@ -33,7 +33,7 @@ typedef struct BWDIFVulkanContext { · 32 unmodified lines
33 33
34 int initialized;34 int initialized;
35 FFVkExecPool e;35 FFVkExecPool e;
36 FFVkQueueFamilyCtx qf;36 AVVulkanDeviceQueueFamily *qf;
37 VkSampler sampler;37 VkSampler sampler;
38 FFVulkanShader shd;38 FFVulkanShader shd;
39} BWDIFVulkanContext;39} BWDIFVulkanContext;
@@ -65,8 +65,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 25 unmodified lines
65 return AVERROR_EXTERNAL;65 return AVERROR_EXTERNAL;
66 }66 }
67 67
68 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);68 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
69 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));69 if (!s->qf) {
70 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
71 err = AVERROR(ENOTSUP);
72 goto fail;
73 }
74
75 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
70 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));76 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
71 77
72 RET(ff_vk_shader_init(vkctx, &s->shd, "bwdif",78 RET(ff_vk_shader_init(vkctx, &s->shd, "bwdif",
libavfilter/vf_chromaber_vulkan.c+9−3
@@ -31,7 +31,7 @@ typedef struct ChromaticAberrationVulkanContext { · 30 unmodified lines
31 31
32 int initialized;32 int initialized;
33 FFVkExecPool e;33 FFVkExecPool e;
34 FFVkQueueFamilyCtx qf;34 AVVulkanDeviceQueueFamily *qf;
35 FFVulkanShader shd;35 FFVulkanShader shd;
36 VkSampler sampler;36 VkSampler sampler;
37 37
@@ -88,8 +88,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 50 unmodified lines
88 return AVERROR_EXTERNAL;88 return AVERROR_EXTERNAL;
89 }89 }
90 90
91 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);91 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
92 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));92 if (!s->qf) {
93 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
94 err = AVERROR(ENOTSUP);
95 goto fail;
96 }
97
98 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
93 RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, VK_FILTER_LINEAR));99 RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, VK_FILTER_LINEAR));
94 RET(ff_vk_shader_init(vkctx, &s->shd, "chromatic_abberation",100 RET(ff_vk_shader_init(vkctx, &s->shd, "chromatic_abberation",
95 VK_SHADER_STAGE_COMPUTE_BIT,101 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_flip_vulkan.c+9−3
@@ -38,7 +38,7 @@ typedef struct FlipVulkanContext { · 37 unmodified lines
38 38
39 int initialized;39 int initialized;
40 FFVkExecPool e;40 FFVkExecPool e;
41 FFVkQueueFamilyCtx qf;41 AVVulkanDeviceQueueFamily *qf;
42 FFVulkanShader shd;42 FFVulkanShader shd;
43 VkSampler sampler;43 VkSampler sampler;
44} FlipVulkanContext;44} FlipVulkanContext;
@@ -62,8 +62,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType · 17 unmodified lines
62 return AVERROR_EXTERNAL;62 return AVERROR_EXTERNAL;
63 }63 }
64 64
65 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);65 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
66 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));66 if (!s->qf) {
67 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
68 err = AVERROR(ENOTSUP);
69 goto fail;
70 }
71
72 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
67 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));73 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));
68 RET(ff_vk_shader_init(vkctx, &s->shd, "flip",74 RET(ff_vk_shader_init(vkctx, &s->shd, "flip",
69 VK_SHADER_STAGE_COMPUTE_BIT,75 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_gblur_vulkan.c+9−3
@@ -36,7 +36,7 @@ typedef struct GBlurVulkanContext { · 35 unmodified lines
36 36
37 int initialized;37 int initialized;
38 FFVkExecPool e;38 FFVkExecPool e;
39 FFVkQueueFamilyCtx qf;39 AVVulkanDeviceQueueFamily *qf;
40 VkSampler sampler;40 VkSampler sampler;
41 FFVulkanShader shd_hor;41 FFVulkanShader shd_hor;
42 FFVkBuffer params_hor;42 FFVkBuffer params_hor;
@@ -212,8 +212,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 169 unmodified lines
212 return AVERROR_EXTERNAL;212 return AVERROR_EXTERNAL;
213 }213 }
214 214
215 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);215 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
216 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));216 if (!s->qf) {
217 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
218 err = AVERROR(ENOTSUP);
219 goto fail;
220 }
221
222 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
217 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));223 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));
218 224
219 desc = (FFVulkanDescriptorSetBinding []) {225 desc = (FFVulkanDescriptorSetBinding []) {
libavfilter/vf_nlmeans_vulkan.c+9−3
@@ -36,7 +36,7 @@ typedef struct NLMeansVulkanContext { · 35 unmodified lines
36 36
37 int initialized;37 int initialized;
38 FFVkExecPool e;38 FFVkExecPool e;
39 FFVkQueueFamilyCtx qf;39 AVVulkanDeviceQueueFamily *qf;
40 VkSampler sampler;40 VkSampler sampler;
41 41
42 AVBufferPool *integral_buf_pool;42 AVBufferPool *integral_buf_pool;
@@ -652,8 +652,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 609 unmodified lines
652 return AVERROR_EXTERNAL;652 return AVERROR_EXTERNAL;
653 }653 }
654 654
655 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);655 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
656 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, 1, 0, 0, 0, NULL));656 if (!s->qf) {
657 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
658 err = AVERROR(ENOTSUP);
659 goto fail;
660 }
661
662 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, 1, 0, 0, 0, NULL));
657 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));663 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
658 664
659 RET(init_weights_pipeline(vkctx, &s->e, &s->shd_weights, s->sampler,665 RET(init_weights_pipeline(vkctx, &s->e, &s->shd_weights, s->sampler,
libavfilter/vf_overlay_vulkan.c+9−3
@@ -33,7 +33,7 @@ typedef struct OverlayVulkanContext { · 32 unmodified lines
33 33
34 int initialized;34 int initialized;
35 FFVkExecPool e;35 FFVkExecPool e;
36 FFVkQueueFamilyCtx qf;36 AVVulkanDeviceQueueFamily *qf;
37 FFVulkanShader shd;37 FFVulkanShader shd;
38 VkSampler sampler;38 VkSampler sampler;
39 39
@@ -101,8 +101,14 @@ static av_cold int init_filter(AVFilterContext *ctx) · 61 unmodified lines
101 return AVERROR_EXTERNAL;101 return AVERROR_EXTERNAL;
102 }102 }
103 103
104 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);104 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
105 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));105 if (!s->qf) {
106 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
107 err = AVERROR(ENOTSUP);
108 goto fail;
109 }
110
111 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
106 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));112 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
107 RET(ff_vk_shader_init(vkctx, &s->shd, "overlay",113 RET(ff_vk_shader_init(vkctx, &s->shd, "overlay",
108 VK_SHADER_STAGE_COMPUTE_BIT,114 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_scale_vulkan.c+9−3
@@ -39,7 +39,7 @@ typedef struct ScaleVulkanContext { · 38 unmodified lines
39 39
40 int initialized;40 int initialized;
41 FFVkExecPool e;41 FFVkExecPool e;
42 FFVkQueueFamilyCtx qf;42 AVVulkanDeviceQueueFamily *qf;
43 FFVulkanShader shd;43 FFVulkanShader shd;
44 VkSampler sampler;44 VkSampler sampler;
45 45
@@ -142,8 +142,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 96 unmodified lines
142 return AVERROR_EXTERNAL;142 return AVERROR_EXTERNAL;
143 }143 }
144 144
145 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);145 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
146 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));146 if (!s->qf) {
147 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
148 err = AVERROR(ENOTSUP);
149 goto fail;
150 }
151
152 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
147 RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, sampler_mode));153 RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, sampler_mode));
148 RET(ff_vk_shader_init(vkctx, &s->shd, "scale",154 RET(ff_vk_shader_init(vkctx, &s->shd, "scale",
149 VK_SHADER_STAGE_COMPUTE_BIT,155 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_transpose_vulkan.c+9−3
@@ -33,7 +33,7 @@ typedef struct TransposeVulkanContext { · 32 unmodified lines
33 33
34 int initialized;34 int initialized;
35 FFVkExecPool e;35 FFVkExecPool e;
36 FFVkQueueFamilyCtx qf;36 AVVulkanDeviceQueueFamily *qf;
37 FFVulkanShader shd;37 FFVulkanShader shd;
38 VkSampler sampler;38 VkSampler sampler;
39 39
@@ -61,8 +61,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) · 21 unmodified lines
61 return AVERROR_EXTERNAL;61 return AVERROR_EXTERNAL;
62 }62 }
63 63
64 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);64 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
65 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));65 if (!s->qf) {
66 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
67 err = AVERROR(ENOTSUP);
68 goto fail;
69 }
70
71 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
66 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));72 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_LINEAR));
67 RET(ff_vk_shader_init(vkctx, &s->shd, "transpose",73 RET(ff_vk_shader_init(vkctx, &s->shd, "transpose",
68 VK_SHADER_STAGE_COMPUTE_BIT,74 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vf_xfade_vulkan.c+9−3
@@ -41,7 +41,7 @@ typedef struct XFadeVulkanContext { · 40 unmodified lines
41 41
42 int initialized;42 int initialized;
43 FFVkExecPool e;43 FFVkExecPool e;
44 FFVkQueueFamilyCtx qf;44 AVVulkanDeviceQueueFamily *qf;
45 FFVulkanShader shd;45 FFVulkanShader shd;
46 VkSampler sampler;46 VkSampler sampler;
47 47
@@ -335,8 +335,14 @@ static av_cold int init_vulkan(AVFilterContext *avctx) · 287 unmodified lines
335 return AVERROR_EXTERNAL;335 return AVERROR_EXTERNAL;
336 }336 }
337 337
338 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);338 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
339 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));339 if (!s->qf) {
340 av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n");
341 err = AVERROR(ENOTSUP);
342 goto fail;
343 }
344
345 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
340 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));346 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
341 RET(ff_vk_shader_init(vkctx, &s->shd, "xfade",347 RET(ff_vk_shader_init(vkctx, &s->shd, "xfade",
342 VK_SHADER_STAGE_COMPUTE_BIT,348 VK_SHADER_STAGE_COMPUTE_BIT,
libavfilter/vsrc_testsrc_vulkan.c+9−3
@@ -40,7 +40,7 @@ typedef struct TestSrcVulkanContext { · 39 unmodified lines
40 40
41 int initialized;41 int initialized;
42 FFVkExecPool e;42 FFVkExecPool e;
43 FFVkQueueFamilyCtx qf;43 AVVulkanDeviceQueueFamily *qf;
44 FFVulkanShader shd;44 FFVulkanShader shd;
45 45
46 /* Only used by color_vulkan */46 /* Only used by color_vulkan */
@@ -82,8 +82,14 @@ static av_cold int init_filter(AVFilterContext *ctx, enum TestSrcVulkanMode mode · 35 unmodified lines
82 return AVERROR_EXTERNAL;82 return AVERROR_EXTERNAL;
83 }83 }
84 84
85 ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);85 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
86 RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));86 if (!s->qf) {
87 av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n");
88 err = AVERROR(ENOTSUP);
89 goto fail;
90 }
91
92 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, s->qf->num*4, 0, 0, 0, NULL));
87 RET(ff_vk_shader_init(vkctx, &s->shd, "scale",93 RET(ff_vk_shader_init(vkctx, &s->shd, "scale",
88 VK_SHADER_STAGE_COMPUTE_BIT,94 VK_SHADER_STAGE_COMPUTE_BIT,
89 NULL, 0,95 NULL, 0,

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