From fd9c69218ae2967f8bbc91cf84c86556881363c1 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 30 Mar 2023 11:56:57 -0400 Subject: [PATCH] tu: Use vk_features2_to_features Sanitizes properties returned through GetPhysicalDeviceFormatProperties2. Bit-31 is not valid to return in the original vkGetPhysicalDeviceFormatProperties{2,}. Sanitize the bit returned from the internal to ensure invalid bits aren't return to the application. Falls in line with the other vulkan drivers. Based on original commit by Ryan Houdek. Closes: #8733 Signed-off-by: Alyssa Rosenzweig Reviewed-by: Faith Ekstrand Cc: mesa-stable Part-of: --- src/freedreno/vulkan/tu_formats.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/freedreno/vulkan/tu_formats.cc b/src/freedreno/vulkan/tu_formats.cc index 555d58ad5d4..9c2c28b9dd0 100644 --- a/src/freedreno/vulkan/tu_formats.cc +++ b/src/freedreno/vulkan/tu_formats.cc @@ -8,6 +8,7 @@ #include "fdl/fd6_format_table.h" +#include "vk_enum_defines.h" #include "vk_util.h" #include "drm-uapi/drm_fourcc.h" @@ -373,9 +374,12 @@ tu_GetPhysicalDeviceFormatProperties2( physical_device, format, props3); pFormatProperties->formatProperties = (VkFormatProperties) { - .linearTilingFeatures = props3->linearTilingFeatures, - .optimalTilingFeatures = props3->optimalTilingFeatures, - .bufferFeatures = props3->bufferFeatures, + .linearTilingFeatures = + vk_format_features2_to_features(props3->linearTilingFeatures), + .optimalTilingFeatures = + vk_format_features2_to_features(props3->optimalTilingFeatures), + .bufferFeatures = + vk_format_features2_to_features(props3->bufferFeatures), }; VkDrmFormatModifierPropertiesListEXT *list =