vkimagebufferpool: reset buffer's access flags

The access flags are kept around the operations, but when the buffer is
released, the access flag should be reset to its original value, since queue
transfers can be done along the pipeline and, when reusing the buffer, the new
queue might not support the latest access flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7165>
This commit is contained in:
Víctor Manuel Jáquez Leal 2024-07-12 10:34:56 +02:00
parent cdf07cd912
commit e91ffae1f0

View file

@ -580,6 +580,23 @@ gst_vulkan_image_buffer_pool_stop (GstBufferPool * pool)
return GST_BUFFER_POOL_CLASS (parent_class)->stop (pool); return GST_BUFFER_POOL_CLASS (parent_class)->stop (pool);
} }
static void
gst_vulkan_image_buffer_pool_reset_buffer (GstBufferPool * pool,
GstBuffer * buffer)
{
GstVulkanImageBufferPool *vk_pool = GST_VULKAN_IMAGE_BUFFER_POOL_CAST (pool);
GstVulkanImageBufferPoolPrivate *priv = GET_PRIV (vk_pool);
GstVulkanImageMemory *mem;
guint i, n = gst_buffer_n_memory (buffer);
GST_BUFFER_POOL_CLASS (parent_class)->reset_buffer (pool, buffer);
for (i = 0; i < n; i++) {
mem = (GstVulkanImageMemory *) gst_buffer_peek_memory (buffer, i);
mem->barrier.parent.access_flags = priv->initial_access;
}
}
/** /**
* gst_vulkan_image_buffer_pool_new: * gst_vulkan_image_buffer_pool_new:
* @device: the #GstVulkanDevice to use * @device: the #GstVulkanDevice to use
@ -614,6 +631,7 @@ gst_vulkan_image_buffer_pool_class_init (GstVulkanImageBufferPoolClass * klass)
gstbufferpool_class->set_config = gst_vulkan_image_buffer_pool_set_config; gstbufferpool_class->set_config = gst_vulkan_image_buffer_pool_set_config;
gstbufferpool_class->alloc_buffer = gst_vulkan_image_buffer_pool_alloc; gstbufferpool_class->alloc_buffer = gst_vulkan_image_buffer_pool_alloc;
gstbufferpool_class->stop = gst_vulkan_image_buffer_pool_stop; gstbufferpool_class->stop = gst_vulkan_image_buffer_pool_stop;
gstbufferpool_class->reset_buffer = gst_vulkan_image_buffer_pool_reset_buffer;
} }
static void static void