mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
vulkan: make new trash objects ref the fence
Avoids gst_vulkan_fence_ref at each call site of the trash object creation
This commit is contained in:
parent
4e467e0082
commit
0c3eec57f2
8 changed files with 63 additions and 67 deletions
|
@ -741,8 +741,8 @@ swizzle_rgb_update_command_state (GstVulkanColorConvert * conv,
|
|||
render->pipeline_layout, 0, 1, &descriptor_set->set, 0, NULL);
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(fence), (GstMiniObject *) descriptor_set));
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) descriptor_set));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -811,8 +811,8 @@ yuv_to_rgb_update_command_state (GstVulkanColorConvert * conv,
|
|||
render->pipeline_layout, 0, 1, &descriptor_set->set, 0, NULL);
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(fence), (GstMiniObject *) descriptor_set));
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) descriptor_set));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1546,13 +1546,13 @@ gst_vulkan_color_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
|
||||
if (conv->descriptor_pool)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) conv->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) conv->descriptor_pool));
|
||||
conv->descriptor_pool = NULL;
|
||||
if (conv->uniform)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) conv->uniform));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) conv->uniform));
|
||||
conv->uniform = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -1586,18 +1586,17 @@ gst_vulkan_color_convert_stop (GstBaseTransform * bt)
|
|||
|
||||
if (conv->descriptor_pool)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) conv->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) conv->descriptor_pool));
|
||||
conv->descriptor_pool = NULL;
|
||||
if (conv->sampler)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
|
||||
(last_fence), conv->sampler));
|
||||
gst_vulkan_trash_new_free_sampler (last_fence, conv->sampler));
|
||||
conv->sampler = VK_NULL_HANDLE;
|
||||
if (conv->uniform)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) conv->uniform));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) conv->uniform));
|
||||
conv->uniform = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -1679,7 +1678,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
in_img_mems[i] = (GstVulkanImageMemory *) mem;
|
||||
in_img_views[i] = get_or_create_image_view (in_img_mems[i]);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) in_img_views[i]));
|
||||
}
|
||||
|
||||
|
@ -1807,7 +1806,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
for (i = 0; i < GST_VIDEO_INFO_N_PLANES (&render->out_info); i++) {
|
||||
render_img_views[i] = get_or_create_image_view (render_img_mems[i]);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) render_img_views[i]));
|
||||
attachments[i] = render_img_views[i]->view;
|
||||
}
|
||||
|
@ -1918,7 +1917,7 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
|
||||
/* XXX: try to reuse this image later */
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) render_img_mems[i]));
|
||||
}
|
||||
}
|
||||
|
@ -1929,10 +1928,9 @@ gst_vulkan_color_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
goto error;
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_framebuffer (gst_vulkan_fence_ref (fence),
|
||||
framebuffer));
|
||||
gst_vulkan_trash_new_free_framebuffer (fence, framebuffer));
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
|
||||
if (!gst_vulkan_full_screen_render_submit (render, cmd_buf->cmd, fence))
|
||||
|
|
|
@ -320,6 +320,7 @@ _image_to_raw_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
gst_vulkan_trash_list_add (raw->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
gst_vulkan_fence_unref (fence);
|
||||
}
|
||||
|
||||
/* XXX: STALL!
|
||||
|
|
|
@ -577,26 +577,26 @@ gst_vulkan_full_screen_render_set_caps (GstBaseTransform * bt,
|
|||
|
||||
if (render->descriptor_set_layout) {
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) render->descriptor_set_layout));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) render->descriptor_set_layout));
|
||||
render->descriptor_set_layout = NULL;
|
||||
}
|
||||
if (render->pipeline_layout) {
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_pipeline_layout (gst_vulkan_fence_ref
|
||||
(last_fence), render->pipeline_layout));
|
||||
gst_vulkan_trash_new_free_pipeline_layout (last_fence,
|
||||
render->pipeline_layout));
|
||||
render->pipeline_layout = VK_NULL_HANDLE;
|
||||
}
|
||||
if (render->render_pass) {
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_render_pass (gst_vulkan_fence_ref
|
||||
(last_fence), render->render_pass));
|
||||
gst_vulkan_trash_new_free_render_pass (last_fence,
|
||||
render->render_pass));
|
||||
render->render_pass = VK_NULL_HANDLE;
|
||||
}
|
||||
if (render->graphics_pipeline) {
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_pipeline (gst_vulkan_fence_ref
|
||||
(last_fence), render->graphics_pipeline));
|
||||
gst_vulkan_trash_new_free_pipeline (last_fence,
|
||||
render->graphics_pipeline));
|
||||
render->graphics_pipeline = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
|
@ -768,20 +768,20 @@ gst_vulkan_full_screen_render_stop (GstBaseTransform * bt)
|
|||
last_fence = gst_vulkan_fence_new_always_signalled (render->device);
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_pipeline (gst_vulkan_fence_ref
|
||||
(last_fence), render->graphics_pipeline));
|
||||
gst_vulkan_trash_new_free_pipeline (last_fence,
|
||||
render->graphics_pipeline));
|
||||
render->graphics_pipeline = VK_NULL_HANDLE;
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_pipeline_layout (gst_vulkan_fence_ref
|
||||
(last_fence), render->pipeline_layout));
|
||||
gst_vulkan_trash_new_free_pipeline_layout (last_fence,
|
||||
render->pipeline_layout));
|
||||
render->pipeline_layout = VK_NULL_HANDLE;
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_render_pass (gst_vulkan_fence_ref
|
||||
(last_fence), render->render_pass));
|
||||
gst_vulkan_trash_new_free_render_pass (last_fence,
|
||||
render->render_pass));
|
||||
render->render_pass = VK_NULL_HANDLE;
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) render->descriptor_set_layout));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) render->descriptor_set_layout));
|
||||
render->descriptor_set_layout = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
|
|
@ -339,8 +339,8 @@ gst_vulkan_image_identity_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
|
||||
if (vk_identity->descriptor_pool)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) vk_identity->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) vk_identity->descriptor_pool));
|
||||
vk_identity->descriptor_pool = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -421,12 +421,11 @@ gst_vulkan_image_identity_stop (GstBaseTransform * bt)
|
|||
last_fence = gst_vulkan_fence_new_always_signalled (render->device);
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) vk_identity->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) vk_identity->descriptor_pool));
|
||||
vk_identity->descriptor_pool = NULL;
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
|
||||
(last_fence), vk_identity->sampler));
|
||||
gst_vulkan_trash_new_free_sampler (last_fence, vk_identity->sampler));
|
||||
vk_identity->sampler = VK_NULL_HANDLE;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -534,7 +533,7 @@ gst_vulkan_image_identity_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
in_img_mem = (GstVulkanImageMemory *) in_mem;
|
||||
in_img_view = get_or_create_image_view (in_img_mem);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (in_img_view)));
|
||||
|
||||
out_mem = gst_buffer_peek_memory (outbuf, 0);
|
||||
|
@ -546,7 +545,7 @@ gst_vulkan_image_identity_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
out_img_mem = (GstVulkanImageMemory *) out_mem;
|
||||
out_img_view = get_or_create_image_view (out_img_mem);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (out_img_view)));
|
||||
|
||||
if (!vk_identity->cmd_pool) {
|
||||
|
@ -655,13 +654,12 @@ gst_vulkan_image_identity_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
goto error;
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (set)));
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_framebuffer (gst_vulkan_fence_ref (fence),
|
||||
framebuffer));
|
||||
gst_vulkan_trash_new_free_framebuffer (fence, framebuffer));
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
|
||||
if (!gst_vulkan_full_screen_render_submit (render, cmd_buf->cmd, fence))
|
||||
|
|
|
@ -612,6 +612,7 @@ _buffer_to_image_perform (gpointer impl, GstBuffer * inbuf, GstBuffer ** outbuf)
|
|||
gst_vulkan_trash_list_add (raw->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
gst_vulkan_fence_unref (fence);
|
||||
}
|
||||
|
||||
gst_vulkan_trash_list_gc (raw->trash_list);
|
||||
|
|
|
@ -532,8 +532,7 @@ view_convert_update_command_state (GstVulkanViewConvert * conv,
|
|||
render->pipeline_layout, 0, 1, &set->set, 0, NULL);
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(fence), (GstMiniObject *) set));
|
||||
gst_vulkan_trash_new_mini_object_unref (fence, (GstMiniObject *) set));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2115,13 +2114,13 @@ gst_vulkan_view_convert_set_caps (GstBaseTransform * bt, GstCaps * in_caps,
|
|||
|
||||
if (conv->descriptor_pool)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) conv->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) conv->descriptor_pool));
|
||||
conv->descriptor_pool = NULL;
|
||||
if (conv->uniform)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) conv->uniform));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) conv->uniform));
|
||||
conv->uniform = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -2157,18 +2156,17 @@ gst_vulkan_view_convert_stop (GstBaseTransform * bt)
|
|||
|
||||
if (conv->descriptor_pool)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstObject *) conv->descriptor_pool));
|
||||
gst_vulkan_trash_new_object_unref (last_fence,
|
||||
(GstObject *) conv->descriptor_pool));
|
||||
conv->descriptor_pool = NULL;
|
||||
if (conv->sampler)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_sampler (gst_vulkan_fence_ref
|
||||
(last_fence), conv->sampler));
|
||||
gst_vulkan_trash_new_free_sampler (last_fence, conv->sampler));
|
||||
conv->sampler = VK_NULL_HANDLE;
|
||||
if (conv->uniform)
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref
|
||||
(last_fence), (GstMiniObject *) conv->uniform));
|
||||
gst_vulkan_trash_new_mini_object_unref (last_fence,
|
||||
(GstMiniObject *) conv->uniform));
|
||||
conv->uniform = NULL;
|
||||
|
||||
gst_vulkan_fence_unref (last_fence);
|
||||
|
@ -2247,7 +2245,7 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
in_img_mems[i] = (GstVulkanImageMemory *) mem;
|
||||
in_img_views[i] = get_or_create_image_view (in_img_mems[i]);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) in_img_views[i]));
|
||||
}
|
||||
|
||||
|
@ -2261,7 +2259,7 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
out_img_mems[i] = (GstVulkanImageMemory *) mem;
|
||||
out_img_views[i] = get_or_create_image_view (out_img_mems[i]);
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
(GstMiniObject *) out_img_views[i]));
|
||||
}
|
||||
|
||||
|
@ -2382,10 +2380,9 @@ gst_vulkan_view_convert_transform (GstBaseTransform * bt, GstBuffer * inbuf,
|
|||
goto error;
|
||||
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_free_framebuffer (gst_vulkan_fence_ref (fence),
|
||||
framebuffer));
|
||||
gst_vulkan_trash_new_free_framebuffer (fence, framebuffer));
|
||||
gst_vulkan_trash_list_add (render->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
|
||||
if (!gst_vulkan_full_screen_render_submit (render, cmd_buf->cmd, fence))
|
||||
|
|
|
@ -1275,7 +1275,7 @@ reacquire:
|
|||
goto error;
|
||||
|
||||
gst_vulkan_trash_list_add (priv->trash_list,
|
||||
gst_vulkan_trash_new_mini_object_unref (gst_vulkan_fence_ref (fence),
|
||||
gst_vulkan_trash_new_mini_object_unref (fence,
|
||||
GST_MINI_OBJECT_CAST (cmd_buf)));
|
||||
gst_vulkan_trash_list_add (priv->trash_list,
|
||||
gst_vulkan_trash_new_free_semaphore (fence, acquire_semaphore));
|
||||
|
@ -1333,6 +1333,7 @@ reacquire:
|
|||
|
||||
gst_vulkan_trash_list_add (priv->trash_list,
|
||||
gst_vulkan_trash_new_free_semaphore (fence, present_semaphore));
|
||||
gst_vulkan_fence_unref (fence);
|
||||
fence = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ gst_vulkan_trash_new (GstVulkanFence * fence, GstVulkanTrashNotify notify,
|
|||
" on device %" GST_PTR_FORMAT, ret, fence, fence->device);
|
||||
gst_mini_object_init ((GstMiniObject *) ret, 0, gst_vulkan_trash_get_type (),
|
||||
NULL, NULL, (GstMiniObjectFreeFunction) gst_vulkan_trash_free);
|
||||
ret->fence = fence;
|
||||
ret->fence = gst_vulkan_fence_ref (fence);
|
||||
ret->notify = notify;
|
||||
ret->user_data = user_data;
|
||||
|
||||
|
|
Loading…
Reference in a new issue