[FFmpeg-devel] [PATCH 55/97] Vulkan patchset part 2 - hwcontext rewrite and filtering

Leo Izen leo.izen at gmail.com
Fri May 19 15:11:00 EEST 2023


On 4/24/23 11:56, Lynne wrote:
> This is part two of the vulkan patchset, which contains all the
> hwcontext and vulkan.c rewrites, and filtering changes.
> 
> 55 patches attached.
> 
> 

[PATCH 21/97] lavu: add 12-bit 2-plane 422 and 444 pixel formats

iirc new pixel formats need an APIChanges entry, a lavu micro bump, or 
both. I'm not really sure what the policy is but I remember being told 
something like that when I added a NE macro a few months ago.

[various]

 > static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
 >    ...
 >    p->device_features_1_3.foo = dev_features_1_3.foo;

There's a lot of these in various patches, why do these need to be done 
manually?

[PATCH 26/97] hwcontext_vulkan: support threadsafe queue and frame

 > p->qf_mutex = av_mallocz(qf_num*sizeof(*p->qf_mutex));

av_calloc

+    for (int i = 0; i < qf_num; i++) {
+        p->qf_mutex[i] = 
av_mallocz(qf[i].queueCount*sizeof(**p->qf_mutex));
+        if (!p->qf_mutex[i])
+            return AVERROR(ENOMEM);
+        for (int j = 0; j < qf[i].queueCount; j++)
+            pthread_mutex_init(&p->qf_mutex[i][j], NULL);
+    }

If the allocation fails for i > 0, you end up with some initialized 
mutexes, is this going to be an issue ever?

@@ -1732,9 +1778,6 @@ static void vulkan_free_internal(AVVkFrame *f)
  {
      AVVkFrameInternal *internal = f->internal;

-    if (!internal)
-        return;
-
  #if CONFIG_CUDA
      if (internal->cuda_fc_ref) {
          AVHWFramesContext *cuda_fc = (AVHWFramesContext 
*)internal->cuda_fc_ref->data;

What happens if (!internal) and #defined(CONFIG_CUDA), do we just segfault?

- Leo Izen




More information about the ffmpeg-devel mailing list