diff mbox series

[FFmpeg-devel,V2,01/10] libavfilter/vulkan: Fix problem when device have queue_count greater than 1

Message ID 20210831072430.303090-1-wenbin.chen@intel.com
State New
Headers show
Series [FFmpeg-devel,V2,01/10] libavfilter/vulkan: Fix problem when device have queue_count greater than 1 | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Wenbin Chen Aug. 31, 2021, 7:24 a.m. UTC
If the descriptorSetCount is greater than the number of setLayouts,
vkAllocateDescriptorSets will report error. Now fix it.

Now the following command can run on the device that has queue_count greater
than one:
ffmpeg -v verbose -init_hw_device vulkan=vul:0 -filter_hw_device vul
-i input1080p.264 -vf "hwupload=extra_hw_frames=16,scale_vulkan=1920:1080,
hwdownload,format=yuv420p" -f rawvideo output.yuv

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
---
 libavfilter/vulkan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lynne Aug. 31, 2021, 11:34 a.m. UTC | #1
31 Aug 2021, 09:24 by wenbin.chen@intel.com:

> If the descriptorSetCount is greater than the number of setLayouts,
> vkAllocateDescriptorSets will report error. Now fix it.
>
> Now the following command can run on the device that has queue_count greater
> than one:
> ffmpeg -v verbose -init_hw_device vulkan=vul:0 -filter_hw_device vul
> -i input1080p.264 -vf "hwupload=extra_hw_frames=16,scale_vulkan=1920:1080,
> hwdownload,format=yuv420p" -f rawvideo output.yuv
>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
>

According to NIklas Haas, drivers are smart enough to rebalance queues
themselves, so I'm thinking of maybe dropping the messy queue selection
code.
But I'll get around to it once I fix the hwcontext.
Dennis Mungai Nov. 19, 2022, 8:47 p.m. UTC | #2
On Tue, 31 Aug 2021 at 10:26, Wenbin Chen <wenbin.chen@intel.com> wrote:

> If the descriptorSetCount is greater than the number of setLayouts,
> vkAllocateDescriptorSets will report error. Now fix it.
>
> Now the following command can run on the device that has queue_count
> greater
> than one:
> ffmpeg -v verbose -init_hw_device vulkan=vul:0 -filter_hw_device vul
> -i input1080p.264 -vf "hwupload=extra_hw_frames=16,scale_vulkan=1920:1080,
> hwdownload,format=yuv420p" -f rawvideo output.yuv
>
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> ---
>  libavfilter/vulkan.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c
> index 337c8d7d5a..e5b070b3e6 100644
> --- a/libavfilter/vulkan.c
> +++ b/libavfilter/vulkan.c
> @@ -1160,7 +1160,7 @@ void ff_vk_update_descriptor_set(AVFilterContext
> *avctx, VulkanPipeline *pl,
>      VulkanFilterContext *s = avctx->priv;
>
>      vkUpdateDescriptorSetWithTemplate(s->hwctx->act_dev,
> -                                      pl->desc_set[s->cur_queue_idx *
> pl->desc_layout_num + set_id],
> +                                      pl->desc_set[set_id],
>                                        pl->desc_template[set_id],
>                                        s);
>  }
> @@ -1179,7 +1179,7 @@ int ff_vk_init_pipeline_layout(AVFilterContext
> *avctx, VulkanPipeline *pl)
>      VkResult ret;
>      VulkanFilterContext *s = avctx->priv;
>
> -    pl->descriptor_sets_num = pl->desc_layout_num * s->queue_count;
> +    pl->descriptor_sets_num = pl->desc_layout_num;
>
>      { /* Init descriptor set pool */
>          VkDescriptorPoolCreateInfo pool_create_info = {
> --
> 2.25.1
>

Hello there,

Was this ever merged? I have an issue mentioned in ticket #8962, see
https://trac.ffmpeg.org/ticket/8962 and this thread on Reddit
https://www.reddit.com/r/ffmpeg/comments/jn5skj/comment/gazmt8b/?utm_source=share&utm_medium=web2x&context=3
diff mbox series

Patch

diff --git a/libavfilter/vulkan.c b/libavfilter/vulkan.c
index 337c8d7d5a..e5b070b3e6 100644
--- a/libavfilter/vulkan.c
+++ b/libavfilter/vulkan.c
@@ -1160,7 +1160,7 @@  void ff_vk_update_descriptor_set(AVFilterContext *avctx, VulkanPipeline *pl,
     VulkanFilterContext *s = avctx->priv;
 
     vkUpdateDescriptorSetWithTemplate(s->hwctx->act_dev,
-                                      pl->desc_set[s->cur_queue_idx * pl->desc_layout_num + set_id],
+                                      pl->desc_set[set_id],
                                       pl->desc_template[set_id],
                                       s);
 }
@@ -1179,7 +1179,7 @@  int ff_vk_init_pipeline_layout(AVFilterContext *avctx, VulkanPipeline *pl)
     VkResult ret;
     VulkanFilterContext *s = avctx->priv;
 
-    pl->descriptor_sets_num = pl->desc_layout_num * s->queue_count;
+    pl->descriptor_sets_num = pl->desc_layout_num;
 
     { /* Init descriptor set pool */
         VkDescriptorPoolCreateInfo pool_create_info = {