[FFmpeg-devel] [FFmpeg-cvslog] lavfi/vulkan: use all enabled queues in the queue family

Michael Niedermayer michael at niedermayer.cc
Fri May 29 02:09:48 EEST 2020


On Sat, May 23, 2020 at 06:09:06PM +0000, Lynne wrote:
> ffmpeg | branch: master | Lynne <dev at lynne.ee> | Thu May 14 00:37:21 2020 +0100| [727cac88b8c4b1facd93a3c863ef7e7072feda36] | committer: Lynne
> 
> lavfi/vulkan: use all enabled queues in the queue family
> 
> This should significantly improve the performance with certain
> filterchains.
> 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=727cac88b8c4b1facd93a3c863ef7e7072feda36
> ---
> 
>  libavfilter/vf_avgblur_vulkan.c   |  39 ++---
>  libavfilter/vf_chromaber_vulkan.c |  30 ++--
>  libavfilter/vf_overlay_vulkan.c   |  37 ++---
>  libavfilter/vf_scale_vulkan.c     |  30 ++--
>  libavfilter/vulkan.c              | 296 +++++++++++++++++++++++++++++---------
>  libavfilter/vulkan.h              |  74 ++++++++--
>  6 files changed, 371 insertions(+), 135 deletions(-)
> 
> diff --git a/libavfilter/vf_avgblur_vulkan.c b/libavfilter/vf_avgblur_vulkan.c
> index 105d753f73..12d57e0875 100644
> --- a/libavfilter/vf_avgblur_vulkan.c
> +++ b/libavfilter/vf_avgblur_vulkan.c
> @@ -97,6 +97,10 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
>      if (!sampler)
>          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 = rand() % s->vkctx.queue_count;
[...]
> +    s->vkctx.cur_queue_idx = rand() % s->vkctx.queue_count;
[...]
> +    s->vkctx.cur_queue_idx = rand() % s->vkctx.queue_count;
[...]
> +    s->vkctx.cur_queue_idx = rand() % s->vkctx.queue_count;

This modifies global state, is neither thread safe nor can it be used from a
library (it breaks a user application using rand())

if you need a PRNG, 
Please see libavutil/lfg.h, or simply use a simple LCG like state= state*1664525+1013904223

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200529/83dec61b/attachment.sig>


More information about the ffmpeg-devel mailing list