Add support for VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT

Check for VkPhyscialDeviceSwapchainMaintenance1FeaturesEXT struct in
the pNext chains of VkCreateDeviceInfo and VkPhysicalDeviceFeatures2

Change-Id: I540b800d882855c6782043ca6c88bafc850c4bcd
Signed-off-by: Dennis Tsiang <dennis.tsiang@arm.com>
Signed-off-by: Fufu Fang <fufu.fang@arm.com>
This commit is contained in:
Dennis Tsiang 2024-01-16 11:22:29 +00:00 committed by Fufu Fang
parent c48d7382ef
commit 8f2722de92
4 changed files with 54 additions and 4 deletions

View file

@ -15,7 +15,8 @@
{"name" : "VK_KHR_wayland_surface", "spec_version" : "6"},
{"name" : "VK_KHR_surface", "spec_version" : "25"},
{"name" : "VK_KHR_display", "spec_version" : "23"},
{"name" : "VK_KHR_get_surface_capabilities2", "spec_version" : "1"}
{"name" : "VK_KHR_get_surface_capabilities2", "spec_version" : "1"},
{"name" : "VK_EXT_surface_maintenance1", "spec_version" : "1"}
],
"device_extensions": [
{"name": "VK_KHR_shared_presentable_image", "spec_version": "1", "entrypoints": ["vkGetSwapchainStatusKHR"]},
@ -34,7 +35,8 @@
"vkGetDeviceGroupSurfacePresentModesKHR",
"vkGetPhysicalDevicePresentRectanglesKHR"
]
}
},
{"name": "VK_EXT_swapchain_maintenance1", "spec_version": "1"}
],
"disable_environment": {
"DISABLE_WSI_LAYER": "1"

View file

@ -311,6 +311,15 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic
}
#endif
auto *physical_device_swapchain_maintenance1_features =
util::find_extension<VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT>(
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT, pCreateInfo->pNext);
if (physical_device_swapchain_maintenance1_features != nullptr)
{
layer::device_private_data::get(*pDevice).set_swapchain_maintenance1_enabled(
physical_device_swapchain_maintenance1_features->swapchainMaintenance1);
}
return VK_SUCCESS;
}
@ -415,6 +424,14 @@ wsi_layer_vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice,
instance.has_image_compression_support(physicalDevice);
}
#endif
auto *physical_device_swapchain_maintenance1_features =
util::find_extension<VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT>(
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT, pFeatures->pNext);
if (physical_device_swapchain_maintenance1_features != nullptr)
{
physical_device_swapchain_maintenance1_features->swapchainMaintenance1 = true;
}
}
#define GET_PROC_ADDR(func) \

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022, 2024 Arm Limited.
* Copyright (c) 2018-2024 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@ -395,6 +395,7 @@ device_private_data::device_private_data(instance_private_data &inst_data, VkPhy
#if WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN
, compression_control_enabled{ false }
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
, swapchain_maintenance1_enabled{ false }
/* clang-format on */
{
}
@ -546,4 +547,15 @@ bool device_private_data::is_swapchain_compression_control_enabled() const
return compression_control_enabled;
}
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
void device_private_data::set_swapchain_maintenance1_enabled(bool enable)
{
swapchain_maintenance1_enabled = enable;
}
bool device_private_data::is_swapchain_maintenance1_enabled() const
{
return swapchain_maintenance1_enabled;
}
} /* namespace layer */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2022, 2024 Arm Limited.
* Copyright (c) 2018-2024 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@ -803,6 +803,20 @@ public:
bool is_swapchain_compression_control_enabled() const;
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
/**
* @brief Selectively enable/disable the swapchain maintenance1 features for this device.
*
* @param enable Value to set swapchain_maintenance1_enabled member variable.
*/
void set_swapchain_maintenance1_enabled(bool enable);
/**
* @brief Check whether the swapchain maintenance1 features are enabled for this device.
*
* @return true if enabled, false otherwise.
*/
bool is_swapchain_maintenance1_enabled() const;
private:
/* Allow util::allocator to access the private constructor */
friend util::allocator;
@ -845,6 +859,11 @@ private:
*/
bool compression_control_enabled;
#endif /* WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN */
/**
* @brief Stores whether the device has enabled support for the swapchain maintenance1 features.
*/
bool swapchain_maintenance1_enabled;
};
} /* namespace layer */