vkimagebufferpool: set image's number of layers

Handle the image's number of layers as configuration so it can be set by the
user, still isn't exposed as function since it's very niche.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
This commit is contained in:
Víctor Manuel Jáquez Leal 2023-08-10 13:10:04 +02:00 committed by GStreamer Marge Bot
parent d52d50570e
commit e3054056ff

View file

@ -45,6 +45,7 @@ struct _GstVulkanImageBufferPoolPrivate
VkMemoryPropertyFlags mem_props; VkMemoryPropertyFlags mem_props;
VkFormat vk_fmts[GST_VIDEO_MAX_PLANES]; VkFormat vk_fmts[GST_VIDEO_MAX_PLANES];
int n_imgs; int n_imgs;
guint32 n_layers;
gboolean has_profile; gboolean has_profile;
GstVulkanVideoProfile profile; GstVulkanVideoProfile profile;
GstVulkanOperation *exec; GstVulkanOperation *exec;
@ -104,7 +105,7 @@ gst_vulkan_image_buffer_pool_config_set_decode_caps (GstStructure * config,
static inline gboolean static inline gboolean
gst_vulkan_image_buffer_pool_config_get_allocation_params (GstStructure * gst_vulkan_image_buffer_pool_config_get_allocation_params (GstStructure *
config, VkImageUsageFlags * usage, VkMemoryPropertyFlags * mem_props, config, VkImageUsageFlags * usage, VkMemoryPropertyFlags * mem_props,
GstCaps ** decode_caps) guint32 * n_layers, GstCaps ** decode_caps)
{ {
if (!gst_structure_get_uint (config, "usage", usage)) { if (!gst_structure_get_uint (config, "usage", usage)) {
*usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT *usage = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT
@ -115,6 +116,9 @@ gst_vulkan_image_buffer_pool_config_get_allocation_params (GstStructure *
if (!gst_structure_get_uint (config, "memory-properties", mem_props)) if (!gst_structure_get_uint (config, "memory-properties", mem_props))
*mem_props = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; *mem_props = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
if (!gst_structure_get_uint (config, "num-layers", n_layers))
*n_layers = 1;
if (decode_caps) if (decode_caps)
gst_structure_get (config, "decode-caps", GST_TYPE_CAPS, decode_caps, NULL); gst_structure_get (config, "decode-caps", GST_TYPE_CAPS, decode_caps, NULL);
@ -157,7 +161,7 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool,
GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY); GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY);
gst_vulkan_image_buffer_pool_config_get_allocation_params (config, gst_vulkan_image_buffer_pool_config_get_allocation_params (config,
&priv->usage, &priv->mem_props, &decode_caps); &priv->usage, &priv->mem_props, &priv->n_layers, &decode_caps);
priv->has_profile = FALSE; priv->has_profile = FALSE;
#if GST_VULKAN_HAVE_VIDEO_EXTENSIONS #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS
@ -212,7 +216,7 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool,
/* .format = fill per image, */ /* .format = fill per image, */
/* .extent = fill per plane, */ /* .extent = fill per plane, */
.mipLevels = 1, .mipLevels = 1,
.arrayLayers = 1, .arrayLayers = priv->n_layers,
.samples = VK_SAMPLE_COUNT_1_BIT, .samples = VK_SAMPLE_COUNT_1_BIT,
.tiling = tiling, .tiling = tiling,
.usage = priv->usage, .usage = priv->usage,
@ -446,7 +450,7 @@ gst_vulkan_image_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
/* .format = fill per image, */ /* .format = fill per image, */
/* .extent = fill per plane, */ /* .extent = fill per plane, */
.mipLevels = 1, .mipLevels = 1,
.arrayLayers = 1, .arrayLayers = priv->n_layers,
.samples = VK_SAMPLE_COUNT_1_BIT, .samples = VK_SAMPLE_COUNT_1_BIT,
.tiling = tiling, .tiling = tiling,
.usage = priv->usage, .usage = priv->usage,