anv/video: move format properties to outarray.
authorDave Airlie <airlied@redhat.com>
Tue, 30 May 2023 05:49:52 +0000 (15:49 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 30 May 2023 05:58:23 +0000 (15:58 +1000)
This should be using the helper code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23304>

src/intel/vulkan/anv_video.c

index 38d1e4a..c58256b 100644 (file)
@@ -170,7 +170,9 @@ anv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
                                                uint32_t *pVideoFormatPropertyCount,
                                                VkVideoFormatPropertiesKHR *pVideoFormatProperties)
 {
-   *pVideoFormatPropertyCount = 1;
+   VK_OUTARRAY_MAKE_TYPED(VkVideoFormatPropertiesKHR, out,
+                          pVideoFormatProperties,
+                          pVideoFormatPropertyCount);
 
    bool need_10bit = false;
    const struct VkVideoProfileListInfoKHR *prof_list = (struct VkVideoProfileListInfoKHR *)
@@ -185,25 +187,23 @@ anv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
       }
    }
 
-   if (need_10bit)
-      (*pVideoFormatPropertyCount)++;
-
-   if (!pVideoFormatProperties)
-      return VK_SUCCESS;
-
-   pVideoFormatProperties[0].format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM;
-   pVideoFormatProperties[0].imageType = VK_IMAGE_TYPE_2D;
-   pVideoFormatProperties[0].imageTiling = VK_IMAGE_TILING_OPTIMAL;
-   pVideoFormatProperties[0].imageUsageFlags = pVideoFormatInfo->imageUsage;
+   vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) {
+      p->format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM;
+      p->imageType = VK_IMAGE_TYPE_2D;
+      p->imageTiling = VK_IMAGE_TILING_OPTIMAL;
+      p->imageUsageFlags = pVideoFormatInfo->imageUsage;
+   }
 
    if (need_10bit) {
-      pVideoFormatProperties[1].format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16;
-      pVideoFormatProperties[1].imageType = VK_IMAGE_TYPE_2D;
-      pVideoFormatProperties[1].imageTiling = VK_IMAGE_TILING_OPTIMAL;
-      pVideoFormatProperties[1].imageUsageFlags = pVideoFormatInfo->imageUsage;
+      vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p) {
+         p->format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16;
+         p->imageType = VK_IMAGE_TYPE_2D;
+         p->imageTiling = VK_IMAGE_TILING_OPTIMAL;
+         p->imageUsageFlags = pVideoFormatInfo->imageUsage;
+      }
    }
 
-   return VK_SUCCESS;
+   return vk_outarray_status(&out);
 }
 
 static void