From e3054056ff059c4b5272caf691ac4b738cea5340 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Thu, 10 Aug 2023 13:10:04 +0200 Subject: [PATCH] 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: --- .../gst-libs/gst/vulkan/gstvkimagebufferpool.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c index 2768a2ebf3..e7edca3e8f 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c @@ -45,6 +45,7 @@ struct _GstVulkanImageBufferPoolPrivate VkMemoryPropertyFlags mem_props; VkFormat vk_fmts[GST_VIDEO_MAX_PLANES]; int n_imgs; + guint32 n_layers; gboolean has_profile; GstVulkanVideoProfile profile; GstVulkanOperation *exec; @@ -104,7 +105,7 @@ gst_vulkan_image_buffer_pool_config_set_decode_caps (GstStructure * config, static inline gboolean gst_vulkan_image_buffer_pool_config_get_allocation_params (GstStructure * config, VkImageUsageFlags * usage, VkMemoryPropertyFlags * mem_props, - GstCaps ** decode_caps) + guint32 * n_layers, GstCaps ** decode_caps) { if (!gst_structure_get_uint (config, "usage", usage)) { *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)) *mem_props = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + if (!gst_structure_get_uint (config, "num-layers", n_layers)) + *n_layers = 1; + if (decode_caps) 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_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; #if GST_VULKAN_HAVE_VIDEO_EXTENSIONS @@ -212,7 +216,7 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool, /* .format = fill per image, */ /* .extent = fill per plane, */ .mipLevels = 1, - .arrayLayers = 1, + .arrayLayers = priv->n_layers, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = tiling, .usage = priv->usage, @@ -446,7 +450,7 @@ gst_vulkan_image_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, /* .format = fill per image, */ /* .extent = fill per plane, */ .mipLevels = 1, - .arrayLayers = 1, + .arrayLayers = priv->n_layers, .samples = VK_SAMPLE_COUNT_1_BIT, .tiling = tiling, .usage = priv->usage,