diff options
author | Lynne <dev@lynne.ee> | 2021-11-10 03:50:54 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2021-11-12 05:23:41 +0100 |
commit | f705e9ea0567c8dcf800ae1ee0647fca157c6199 (patch) | |
tree | 529e20c9015f3ee93e297097d77f38ba52c29037 /libavfilter/vf_avgblur_vulkan.c | |
parent | 246f841b53e16f2cccf3101cb61c264014f54e5c (diff) | |
download | ffmpeg-f705e9ea0567c8dcf800ae1ee0647fca157c6199.tar.gz |
lavfi/vulkan: refactor, fix and fully implement multiple queues
Diffstat (limited to 'libavfilter/vf_avgblur_vulkan.c')
-rw-r--r-- | libavfilter/vf_avgblur_vulkan.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c index bf02dab1db..4795e482a9 100644 --- a/libavfilter/vf_avgblur_vulkan.c +++ b/libavfilter/vf_avgblur_vulkan.c @@ -24,12 +24,13 @@ #define CGS 32 typedef struct AvgBlurVulkanContext { - VulkanFilterContext vkctx; + FFVulkanContext vkctx; int initialized; + FFVkQueueFamilyCtx qf; FFVkExecContext *exec; - VulkanPipeline *pl_hor; - VulkanPipeline *pl_ver; + FFVulkanPipeline *pl_hor; + FFVulkanPipeline *pl_ver; /* Shader updators, must be in the main filter struct */ VkDescriptorImageInfo input_images[3]; @@ -73,16 +74,14 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) FFSPIRVShader *shd; AvgBlurVulkanContext *s = ctx->priv; const int planes = av_pix_fmt_count_planes(s->vkctx.output_format); - VkSampler *sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_LINEAR); - VulkanDescriptorSetBinding desc_i[2] = { + FFVulkanDescriptorSetBinding desc_i[2] = { { .name = "input_img", .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, .dimensions = 2, .elems = planes, .stages = VK_SHADER_STAGE_COMPUTE_BIT, - .samplers = DUP_SAMPLER_ARRAY4(*sampler), }, { .name = "output_img", @@ -95,17 +94,17 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) }, }; - if (!sampler) - return AVERROR_EXTERNAL; + ff_vk_qf_init(ctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0); - s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index; - s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues; + desc_i[0].sampler = ff_vk_init_sampler(ctx, 1, VK_FILTER_LINEAR); + if (!desc_i[0].sampler) + return AVERROR_EXTERNAL; { /* Create shader for the horizontal pass */ desc_i[0].updater = s->input_images; desc_i[1].updater = s->tmp_images; - s->pl_hor = ff_vk_create_pipeline(ctx); + s->pl_hor = ff_vk_create_pipeline(ctx, &s->qf); if (!s->pl_hor) return AVERROR(ENOMEM); @@ -148,7 +147,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) desc_i[0].updater = s->tmp_images; desc_i[1].updater = s->output_images; - s->pl_ver = ff_vk_create_pipeline(ctx); + s->pl_ver = ff_vk_create_pipeline(ctx, &s->qf); if (!s->pl_ver) return AVERROR(ENOMEM); @@ -188,7 +187,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) } /* Execution context */ - RET(ff_vk_create_exec_ctx(ctx, &s->exec)); + RET(ff_vk_create_exec_ctx(ctx, &s->exec, &s->qf)); s->initialized = 1; @@ -311,6 +310,8 @@ static int process_frames(AVFilterContext *avctx, AVFrame *out_f, AVFrame *tmp_f if (err) return err; + ff_vk_qf_rotate(&s->qf); + return err; fail: |