From b7ded81f7b53cb18f7e450770ba128e53bda8568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 8 Sep 2023 17:54:25 +0200 Subject: [PATCH] vkbufferimagepool: short circuit usage for decoding NVIDIA & RADV drivers don't report decoding features for color format. Setting requested usage to zero to short circuit validation. Part-of: --- .../gst-libs/gst/vulkan/gstvkimagebufferpool.c | 18 ++++++++++++++---- 1 file changed, 14 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 15bb553afd..61ebeb3c44 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkimagebufferpool.c @@ -130,12 +130,12 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool, GstVulkanImageBufferPool *vk_pool = GST_VULKAN_IMAGE_BUFFER_POOL_CAST (pool); GstVulkanImageBufferPoolPrivate *priv = GET_PRIV (vk_pool); VkImageTiling tiling; - VkImageUsageFlags supported_usage; + VkImageUsageFlags requested_usage, supported_usage; VkImageCreateInfo image_info; guint min_buffers, max_buffers; GstCaps *caps = NULL, *decode_caps = NULL; GstCapsFeatures *features; - gboolean found, no_multiplane = FALSE, ret = TRUE; + gboolean found, no_multiplane, ret = TRUE; guint i; if (!gst_buffer_pool_config_get_params (config, &caps, NULL, &min_buffers, @@ -178,12 +178,22 @@ gst_vulkan_image_buffer_pool_set_config (GstBufferPool * pool, && !priv->has_profile) goto missing_profile; - no_multiplane = !priv->has_profile; + if (priv->has_profile) { + no_multiplane = FALSE; + + /* HACK(victor): NVIDIA & RADV drivers don't report decoding features for + * color format. Setting usage to zero to short circuit validation. */ + requested_usage = 0; + } else #endif + { + no_multiplane = TRUE; + requested_usage = priv->usage; + } tiling = priv->raw_caps ? VK_IMAGE_TILING_LINEAR : VK_IMAGE_TILING_OPTIMAL; found = gst_vulkan_format_from_video_info_2 (vk_pool->device->physical_device, - &priv->v_info, tiling, no_multiplane, priv->usage, priv->vk_fmts, + &priv->v_info, tiling, no_multiplane, requested_usage, priv->vk_fmts, &priv->n_imgs, &supported_usage); if (!found) goto no_vk_format;