summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2021-11-07 08:16:11 +0100
committerLynne <dev@lynne.ee>2021-11-12 05:23:36 +0100
commit6bf9a6539e3db94ee88dd2a8e4816fadf10a4970 (patch)
treed56025f67ab520d3b9d92ef0a8bc7df5f912a579 /libavfilter
parentdfc61800a26747dc91bf00b0d841fc88a5d7473d (diff)
vulkan: add support for encode and decode queues and refactor queue code
This simplifies and makes queue family picking simpler and more robust. The requirements on the device context are relaxed. They made no sense in the first place. The video encode/decode extension is still in beta, at least on paper, but I really doubt they'd change needing a separate queue family.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_avgblur_vulkan.c3
-rw-r--r--libavfilter/vf_chromaber_vulkan.c3
-rw-r--r--libavfilter/vf_overlay_vulkan.c3
-rw-r--r--libavfilter/vf_scale_vulkan.c3
-rw-r--r--libavfilter/vulkan.h11
5 files changed, 4 insertions, 19 deletions
diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
index 93a7f0d62a..deb2d0f186 100644
--- a/libavfilter/vf_avgblur_vulkan.c
+++ b/libavfilter/vf_avgblur_vulkan.c
@@ -99,8 +99,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
return AVERROR_EXTERNAL;
s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
- s->vkctx.queue_count = GET_QUEUE_COUNT(s->vkctx.hwctx, 0, 1, 0);
- s->vkctx.cur_queue_idx = av_get_random_seed() % s->vkctx.queue_count;
+ s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
{ /* Create shader for the horizontal pass */
desc_i[0].updater = s->input_images;
diff --git a/libavfilter/vf_chromaber_vulkan.c b/libavfilter/vf_chromaber_vulkan.c
index 9e0926c7c0..89e5ed2167 100644
--- a/libavfilter/vf_chromaber_vulkan.c
+++ b/libavfilter/vf_chromaber_vulkan.c
@@ -75,8 +75,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
return AVERROR_EXTERNAL;
s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
- s->vkctx.queue_count = GET_QUEUE_COUNT(s->vkctx.hwctx, 0, 1, 0);
- s->vkctx.cur_queue_idx = av_get_random_seed() % s->vkctx.queue_count;
+ s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
s->pl = ff_vk_create_pipeline(ctx);
if (!s->pl)
diff --git a/libavfilter/vf_overlay_vulkan.c b/libavfilter/vf_overlay_vulkan.c
index 4b49878b85..1b809f836c 100644
--- a/libavfilter/vf_overlay_vulkan.c
+++ b/libavfilter/vf_overlay_vulkan.c
@@ -89,8 +89,7 @@ static av_cold int init_filter(AVFilterContext *ctx)
return AVERROR(ENOMEM);
s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
- s->vkctx.queue_count = GET_QUEUE_COUNT(s->vkctx.hwctx, 0, 1, 0);
- s->vkctx.cur_queue_idx = av_get_random_seed() % s->vkctx.queue_count;
+ s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
{ /* Create the shader */
const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index 2b83170029..3dd6e3ff0b 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -117,8 +117,7 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
int crop_h = in->height - (in->crop_top + in->crop_bottom);
s->vkctx.queue_family_idx = s->vkctx.hwctx->queue_family_comp_index;
- s->vkctx.queue_count = GET_QUEUE_COUNT(s->vkctx.hwctx, 0, 1, 0);
- s->vkctx.cur_queue_idx = av_get_random_seed() % s->vkctx.queue_count;
+ s->vkctx.queue_count = s->vkctx.hwctx->nb_comp_queues;
switch (s->scaler) {
case F_NEAREST:
diff --git a/libavfilter/vulkan.h b/libavfilter/vulkan.h
index dbe181e898..fa77995075 100644
--- a/libavfilter/vulkan.h
+++ b/libavfilter/vulkan.h
@@ -49,17 +49,6 @@
goto fail; \
} while (0)
-/* Gets the queues count for a single queue family */
-#define GET_QUEUE_COUNT(hwctx, graph, comp, tx) ( \
- graph ? hwctx->nb_graphics_queues : \
- comp ? (hwctx->nb_comp_queues ? \
- hwctx->nb_comp_queues : hwctx->nb_graphics_queues) : \
- tx ? (hwctx->nb_tx_queues ? hwctx->nb_tx_queues : \
- (hwctx->nb_comp_queues ? \
- hwctx->nb_comp_queues : hwctx->nb_graphics_queues)) : \
- 0 \
-)
-
/* Useful for attaching immutable samplers to arrays */
#define DUP_SAMPLER_ARRAY4(x) (VkSampler []){ x, x, x, x, }