diff mbox series

[FFmpeg-devel,3/4] avutil/hwcontext_vulkan: check if created before destroying the instance

Message ID 20211123090119.868788-3-jianhua.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] avutil/vulkan_functions: add EnumerateInstanceLayerProperties | 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

Wu Jianhua Nov. 23, 2021, 9:01 a.m. UTC
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
---
 libavutil/hwcontext_vulkan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dennis Mungai Nov. 23, 2021, 2:58 p.m. UTC | #1
On Tue, 23 Nov 2021, 12:06 Wu Jianhua, <jianhua.wu@intel.com> wrote:

> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
> ---
>  libavutil/hwcontext_vulkan.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 4ac1058181..644ed947f8 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -1157,7 +1157,8 @@ static void vulkan_device_free(AVHWDeviceContext
> *ctx)
>          vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx,
>                                            hwctx->alloc);
>
> -    vk->DestroyInstance(hwctx->inst, hwctx->alloc);
> +    if (hwctx->inst)
> +        vk->DestroyInstance(hwctx->inst, hwctx->alloc);
>
>      if (p->libvulkan)
>          dlclose(p->libvulkan);
> --
> 2.25.1
>


Ping.

This fixes a (somewhat obscure) bug where a "generic library error" is
reported when running multiple concurrent ffmpeg commands with one or more
Vulkan filter chains.

>
Wu Jianhua Nov. 23, 2021, 3:30 p.m. UTC | #2
Dennis Mungai<mailto:dmngaie@gmail.com>:
> Sent: 2021年11月23日 22:58
> To: FFmpeg development discussions and patches<mailto:ffmpeg-devel@ffmpeg.org>
> Cc: Wu Jianhua<mailto:jianhua.wu@intel.com>
> Subject: Re: [FFmpeg-devel] [PATCH 3/4] avutil/hwcontext_vulkan: check if created before destroying the instance
>
> On Tue, 23 Nov 2021, 12:06 Wu Jianhua, <jianhua.wu@intel.com> wrote:
>
>> Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
>> ---
>>  libavutil/hwcontext_vulkan.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
>> index 4ac1058181..644ed947f8 100644
>> --- a/libavutil/hwcontext_vulkan.c
>> +++ b/libavutil/hwcontext_vulkan.c
>> @@ -1157,7 +1157,8 @@ static void vulkan_device_free(AVHWDeviceContext
>> *ctx)
>>          vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx,
>>                                            hwctx->alloc);
>>
>> -    vk->DestroyInstance(hwctx->inst, hwctx->alloc);
>> +    if (hwctx->inst)
>> +        vk->DestroyInstance(hwctx->inst, hwctx->alloc);
>>
>>      if (p->libvulkan)
>>          dlclose(p->libvulkan);
>> --
>> 2.25.1
>>
>
> Ping.
>
> This fixes a (somewhat obscure) bug where a "generic library error" is
> reported when running multiple concurrent ffmpeg commands with one or more
> Vulkan filter chains.
>

Hi Dennis:

Glad that this patch is helpful, but I’m unable to do more. Lynne may help apply
this patch when she sees your ping.

Thanks,
Jianhua
diff mbox series

Patch

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 4ac1058181..644ed947f8 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1157,7 +1157,8 @@  static void vulkan_device_free(AVHWDeviceContext *ctx)
         vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx,
                                           hwctx->alloc);
 
-    vk->DestroyInstance(hwctx->inst, hwctx->alloc);
+    if (hwctx->inst)
+        vk->DestroyInstance(hwctx->inst, hwctx->alloc);
 
     if (p->libvulkan)
         dlclose(p->libvulkan);