present_id2 dependency handling in present_timing extension

The present_timing extension depends on present_id2. The dependency
handling is incorrect and is fixed in this change.

Signed-off-by: Ginu Jacob <ginu.jacob@arm.com>
Change-Id: Id645450eeb5b22551f328a860ffec75ebdbfbc79
This commit is contained in:
Ginu Jacob 2025-09-29 15:11:01 +00:00 committed by Rosen Zhelev
parent ec20ec83ae
commit 7d88e2a619
2 changed files with 24 additions and 32 deletions

View file

@ -191,36 +191,26 @@ wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo)
VkResult ret = VK_SUCCESS;
struct present_ids
const uint64_t *p_present_ids{ nullptr };
auto *present_id2_ext =
util::find_extension<VkPresentId2KHR>(VK_STRUCTURE_TYPE_PRESENT_ID_2_KHR, pPresentInfo->pNext);
if (present_id2_ext != nullptr)
{
uint32_t ids_num{ 0 };
const uint64_t *p_present_ids{ nullptr };
bool has_ids()
{
return ids_num > 0;
}
};
present_ids present_ids{};
if (device_data.is_present_id2_enabled())
{
auto *ext2 = util::find_extension<VkPresentIdKHR>(VK_STRUCTURE_TYPE_PRESENT_ID_2_KHR, pPresentInfo->pNext);
if (ext2 != nullptr)
{
present_ids.ids_num = ext2->swapchainCount;
present_ids.p_present_ids = ext2->pPresentIds;
}
p_present_ids = present_id2_ext->pPresentIds;
}
if (!present_ids.has_ids())
else
{
auto *ext = util::find_extension<VkPresentIdKHR>(VK_STRUCTURE_TYPE_PRESENT_ID_KHR, pPresentInfo->pNext);
if (ext != nullptr)
{
present_ids.ids_num = ext->swapchainCount;
present_ids.p_present_ids = ext->pPresentIds;
p_present_ids = ext->pPresentIds;
/* If a VkPresentIdKHR structure is included in the pNext chain, and the presentId feature is not enabled,
* each presentIds entry in that structure must be NULL */
if (p_present_ids != nullptr)
{
assert(device_data.is_present_id_enabled());
}
}
}
@ -244,9 +234,16 @@ wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo)
uint64_t present_id = 0; /* No present ID by default */
if (present_ids.p_present_ids && present_ids.ids_num == pPresentInfo->swapchainCount)
if (p_present_ids != nullptr)
{
present_id = present_ids.p_present_ids[i];
present_id = p_present_ids[i];
/* If a VkPresentId2KHR structure is included in the pNext chain, and the presentId2 feature is not enabled,
* each presentIds entry in that structure must be zero. */
if (present_id2_ext && present_id != 0)
{
assert(device_data.is_present_id2_enabled());
}
}
wsi::swapchain_presentation_parameters present_params{};

View file

@ -64,12 +64,7 @@ wsi_ext_present_timing::wsi_ext_present_timing(const util::allocator &allocator,
, m_present_semaphore(allocator)
, m_timestamp_period(0.f)
{
if (!m_device.is_present_id_enabled())
{
WSI_LOG_ERROR(VK_EXT_PRESENT_TIMING_EXTENSION_NAME
" enabled but required extension " VK_KHR_PRESENT_ID_EXTENSION_NAME " is not enabled.");
}
assert(m_device.is_device_extension_enabled(VK_KHR_PRESENT_ID_2_EXTENSION_NAME));
VkPhysicalDeviceProperties2KHR physical_device_properties{};
physical_device_properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
auto &inst = layer::instance_private_data::get(m_device.physical_device);