vulkan_filter: add an argument for setting the Z workgroup count

This commit is contained in:
Lynne
2026-02-12 11:33:07 +01:00
parent dc23adde9b
commit d381151ae3
15 changed files with 29 additions and 23 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ static int avgblur_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd,
out, in, VK_NULL_HANDLE,
&s->opts, sizeof(s->opts)));
1, &s->opts, sizeof(s->opts)));
err = av_frame_copy_props(out, in);
if (err < 0)
+1 -1
View File
@@ -265,7 +265,7 @@ static int blend_frame(FFFrameSync *fs)
RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd,
out, (AVFrame *[]){ top, bottom }, 2,
VK_NULL_HANDLE, NULL, 0));
VK_NULL_HANDLE, 1, NULL, 0));
return ff_filter_frame(outlink, out);
+1 -1
View File
@@ -115,7 +115,7 @@ static void bwdif_vulkan_filter_frame(AVFilterContext *ctx, AVFrame *dst,
ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd, dst,
(AVFrame *[]){ y->prev, y->cur, y->next }, 3,
VK_NULL_HANDLE, &params, sizeof(params));
VK_NULL_HANDLE, 1, &params, sizeof(params));
if (y->current_field == YADIF_FIELD_END)
y->current_field = YADIF_FIELD_NORMAL;
+1 -1
View File
@@ -188,7 +188,7 @@ static int chromaber_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
RET(init_filter(ctx, in));
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
s->sampler, &s->opts, sizeof(s->opts)));
s->sampler, 1, &s->opts, sizeof(s->opts)));
err = av_frame_copy_props(out, in);
if (err < 0)
+1 -1
View File
@@ -174,7 +174,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in, enum FlipType type)
RET(init_filter(ctx, in, type));
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
VK_NULL_HANDLE, NULL, 0));
VK_NULL_HANDLE, 1, NULL, 0));
RET(av_frame_copy_props(out, in));
+1 -1
View File
@@ -316,7 +316,7 @@ static int gblur_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
RET(ff_vk_filter_process_2pass(&s->vkctx, &s->e,
(FFVulkanShader *[2]){ &s->shd_hor, &s->shd_ver },
out, tmp, in, VK_NULL_HANDLE, NULL, 0));
out, tmp, in, VK_NULL_HANDLE, 1, NULL, 0));
err = av_frame_copy_props(out, in);
if (err < 0)
+1 -1
View File
@@ -218,7 +218,7 @@ static int interlace_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd,
out, (AVFrame *[]){ input_top, input_bot }, 2,
s->sampler, NULL, 0));
s->sampler, 1, NULL, 0));
err = av_frame_copy_props(out, s->cur);
if (err < 0)
+1 -1
View File
@@ -240,7 +240,7 @@ static int overlay_vulkan_blend(FFFrameSync *fs)
RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd,
out, (AVFrame *[]){ input_main, input_overlay }, 2,
VK_NULL_HANDLE, &s->opts, sizeof(s->opts)));
VK_NULL_HANDLE, 1, &s->opts, sizeof(s->opts)));
err = av_frame_copy_props(out, input_main);
if (err < 0)
+1 -1
View File
@@ -389,7 +389,7 @@ static int scale_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
}
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
s->sampler, &s->opts, sizeof(s->opts)));
s->sampler, 1, &s->opts, sizeof(s->opts)));
} else {
err = sws_scale_frame(s->sws, out, in);
if (err < 0)
+1 -1
View File
@@ -156,7 +156,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
RET(init_filter(ctx, in));
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in,
VK_NULL_HANDLE, NULL, 0));
VK_NULL_HANDLE, 1, NULL, 0));
RET(av_frame_copy_props(out, in));
+1 -1
View File
@@ -283,7 +283,7 @@ static int v360_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
pd.rot_mat, s->rotation_order);
RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd,
out, in, s->sampler,
out, in, s->sampler, 1,
&pd, sizeof(pd)));
err = av_frame_copy_props(out, in);
+1 -1
View File
@@ -447,7 +447,7 @@ static int xfade_frame(AVFilterContext *avctx, AVFrame *frame_a, AVFrame *frame_
0.f, 1.f);
RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd, output,
(AVFrame *[]){ frame_a, frame_b }, 2, s->sampler,
(AVFrame *[]){ frame_a, frame_b }, 2, s->sampler, 1,
&(XFadeParameters){ progress }, sizeof(XFadeParameters)));
return ff_filter_frame(outlink, output);
+2 -2
View File
@@ -236,7 +236,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)
return AVERROR(ENOMEM);
err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, s->picref, NULL,
VK_NULL_HANDLE, &s->opts, sizeof(s->opts));
VK_NULL_HANDLE, 1, &s->opts, sizeof(s->opts));
if (err < 0)
return err;
}
@@ -255,7 +255,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx)
frame->sample_aspect_ratio = s->sar;
if (!s->draw_once) {
err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, frame, NULL,
VK_NULL_HANDLE, &s->opts, sizeof(s->opts));
VK_NULL_HANDLE, 1, &s->opts, sizeof(s->opts));
if (err < 0) {
av_frame_free(&frame);
return err;
+9 -6
View File
@@ -241,7 +241,8 @@ int ff_vk_filter_init(AVFilterContext *avctx)
int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd, AVFrame *out_f, AVFrame *in_f,
VkSampler sampler, void *push_src, size_t push_size)
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size)
{
int err = 0;
FFVulkanFunctions *vk = &vkctx->vkfn;
@@ -304,7 +305,7 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
vk->CmdDispatch(exec->buf,
FFALIGN(vkctx->output_width, shd->lg_size[0])/shd->lg_size[0],
FFALIGN(vkctx->output_height, shd->lg_size[1])/shd->lg_size[1],
1);
wgc_z);
return ff_vk_exec_submit(vkctx, exec);
fail:
@@ -315,7 +316,8 @@ fail:
int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd_list[2],
AVFrame *out, AVFrame *tmp, AVFrame *in,
VkSampler sampler, void *push_src, size_t push_size)
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size)
{
int err = 0;
FFVulkanFunctions *vk = &vkctx->vkfn;
@@ -395,7 +397,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
vk->CmdDispatch(exec->buf,
FFALIGN(vkctx->output_width, shd->lg_size[0])/shd->lg_size[0],
FFALIGN(vkctx->output_height, shd->lg_size[1])/shd->lg_size[1],
1);
wgc_z);
}
return ff_vk_exec_submit(vkctx, exec);
@@ -407,7 +409,8 @@ fail:
int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd,
AVFrame *out, AVFrame *in[], int nb_in,
VkSampler sampler, void *push_src, size_t push_size)
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size)
{
int err = 0;
FFVulkanFunctions *vk = &vkctx->vkfn;
@@ -474,7 +477,7 @@ int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
vk->CmdDispatch(exec->buf,
FFALIGN(vkctx->output_width, shd->lg_size[0])/shd->lg_size[0],
FFALIGN(vkctx->output_height, shd->lg_size[1])/shd->lg_size[1],
1);
wgc_z);
return ff_vk_exec_submit(vkctx, exec);
fail:
+6 -3
View File
@@ -44,7 +44,8 @@ int ff_vk_filter_init_context(AVFilterContext *avctx, FFVulkanContext *s,
*/
int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd, AVFrame *out_f, AVFrame *in_f,
VkSampler sampler, void *push_src, size_t push_size);
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size);
/**
* Submit a compute shader with a single in and single out with 2 stages.
@@ -52,7 +53,8 @@ int ff_vk_filter_process_simple(FFVulkanContext *vkctx, FFVkExecPool *e,
int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd_list[2],
AVFrame *out, AVFrame *tmp, AVFrame *in,
VkSampler sampler, void *push_src, size_t push_size);
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size);
/**
* Up to 16 inputs, one output
@@ -60,6 +62,7 @@ int ff_vk_filter_process_2pass(FFVulkanContext *vkctx, FFVkExecPool *e,
int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e,
FFVulkanShader *shd,
AVFrame *out, AVFrame *in[], int nb_in,
VkSampler sampler, void *push_src, size_t push_size);
VkSampler sampler, uint32_t wgc_z,
void *push_src, size_t push_size);
#endif /* AVFILTER_VULKAN_FILTER_H */