Mesa (main): tu: VkExternalImageFormatProperties is optional

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 26 17:03:07 UTC 2022


Module: Mesa
Branch: main
Commit: 96acd0933eeb638ce2399a2dd8bf03906c765120
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=96acd0933eeb638ce2399a2dd8bf03906c765120

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Wed Jan 26 07:53:59 2022 +0000

tu: VkExternalImageFormatProperties is optional

..even if external image info has valid external handles.

Fixes: 26380b3a9f8 ("turnip: Add driver skeleton (v2)")

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14730>

---

 src/freedreno/vulkan/tu_formats.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/freedreno/vulkan/tu_formats.c b/src/freedreno/vulkan/tu_formats.c
index 934c46ed423..91b5023fe0f 100644
--- a/src/freedreno/vulkan/tu_formats.c
+++ b/src/freedreno/vulkan/tu_formats.c
@@ -486,7 +486,7 @@ tu_get_external_image_format_properties(
    const struct tu_physical_device *physical_device,
    const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
    VkExternalMemoryHandleTypeFlagBits handleType,
-   VkExternalMemoryProperties *external_properties)
+   VkExternalImageFormatProperties *external_properties)
 {
    VkExternalMemoryFeatureFlagBits flags = 0;
    VkExternalMemoryHandleTypeFlags export_flags = 0;
@@ -528,11 +528,14 @@ tu_get_external_image_format_properties(
                        handleType);
    }
 
-   *external_properties = (VkExternalMemoryProperties) {
-      .externalMemoryFeatures = flags,
-      .exportFromImportedHandleTypes = export_flags,
-      .compatibleHandleTypes = compat_flags,
-   };
+   if (external_properties) {
+      external_properties->externalMemoryProperties =
+         (VkExternalMemoryProperties) {
+            .externalMemoryFeatures = flags,
+            .exportFromImportedHandleTypes = export_flags,
+            .compatibleHandleTypes = compat_flags,
+         };
+   }
 
    return VK_SUCCESS;
 }
@@ -599,7 +602,7 @@ tu_GetPhysicalDeviceImageFormatProperties2(
    if (external_info && external_info->handleType != 0) {
       result = tu_get_external_image_format_properties(
          physical_device, base_info, external_info->handleType,
-         &external_props->externalMemoryProperties);
+         external_props);
       if (result != VK_SUCCESS)
          goto fail;
    }



More information about the mesa-commit mailing list