diff --git a/CMakeLists.txt b/CMakeLists.txt index 957dee0..8773d86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2025 Arm Limited. +# Copyright (c) 2019-2026 Arm Limited. # # SPDX-License-Identifier: MIT # @@ -152,17 +152,14 @@ if(BUILD_WSI_WAYLAND) wsi/wayland/surface_properties.cpp wsi/wayland/surface.cpp wsi/wayland/wl_helpers.cpp - wsi/wayland/swapchain.cpp + wsi/wayland/present_id_wayland.cpp + wsi/wayland/present_timing_handler.cpp wsi/wayland/present_wait_wayland.cpp + wsi/wayland/swapchain.cpp + wsi/wayland/wp_presentation_feedback.cpp wsi/extensions/external_memory_extension.cpp wsi/image_backing_memory_external.cpp) - if(VULKAN_WSI_LAYER_EXPERIMENTAL) - target_sources(wayland_wsi PRIVATE wsi/wayland/present_id_wayland.cpp) - target_sources(wayland_wsi PRIVATE wsi/wayland/present_timing_handler.cpp) - target_sources(wayland_wsi PRIVATE wsi/wayland/wp_presentation_feedback.cpp) - endif() - pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client) message(STATUS "Using Wayland client include directories: ${WAYLAND_CLIENT_INCLUDE_DIRS}") message(STATUS "Using Wayland client cflags: ${WAYLAND_CLIENT_CFLAGS}") @@ -243,13 +240,10 @@ if(BUILD_WSI_HEADLESS) wsi/headless/surface_properties.cpp wsi/headless/surface.cpp wsi/headless/swapchain.cpp + wsi/headless/present_timing_handler.cpp wsi/headless/present_wait_headless.cpp wsi/image_backing_memory_device.cpp) - if(VULKAN_WSI_LAYER_EXPERIMENTAL) - target_sources(wsi_headless PRIVATE wsi/headless/present_timing_handler.cpp) - endif() - target_include_directories(wsi_headless PRIVATE ${PROJECT_SOURCE_DIR} ${VULKAN_CXX_INCLUDE} @@ -307,6 +301,7 @@ add_library(${PROJECT_NAME} SHARED layer/surface_api.cpp layer/swapchain_api.cpp layer/swapchain_maintenance_api.cpp + layer/present_timing_api.cpp layer/present_wait_api.cpp util/timed_semaphore.cpp util/custom_allocator.cpp @@ -320,6 +315,7 @@ add_library(${PROJECT_NAME} SHARED wsi/extensions/present_wait.cpp wsi/extensions/frame_boundary.cpp wsi/extensions/mutable_format_extension.cpp + wsi/extensions/present_timing.cpp util/wsi_extension.cpp wsi/extensions/swapchain_maintenance.cpp wsi/surface_properties.cpp @@ -329,16 +325,13 @@ add_library(${PROJECT_NAME} SHARED wsi/vulkan_image_handle_creator.cpp wsi/swapchain_image_factory.cpp wsi/swapchain_image.cpp) + if (VULKAN_WSI_LAYER_EXPERIMENTAL) - target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/layer/present_timing_api.cpp) - target_sources(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/wsi/extensions/present_timing.cpp) add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=1") else() - list(APPEND JSON_COMMANDS COMMAND sed -Ei '/VK_EXT_present_timing/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json) add_definitions("-DVULKAN_WSI_LAYER_EXPERIMENTAL=0") endif() - if((CMAKE_BUILD_TYPE MATCHES "^[Dd]ebug$") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) target_sources(${PROJECT_NAME} PUBLIC util/debug.cpp) endif() diff --git a/layer/calibrated_timestamps_api.cpp b/layer/calibrated_timestamps_api.cpp index 4ca5aa0..cc9c174 100644 --- a/layer/calibrated_timestamps_api.cpp +++ b/layer/calibrated_timestamps_api.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -31,7 +31,6 @@ #include #include -#if VULKAN_WSI_LAYER_EXPERIMENTAL VWL_VKAPI_CALL(VkResult) wsi_layer_vkGetCalibratedTimestampsKHR(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps, @@ -173,4 +172,3 @@ wsi_layer_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physic { return wsi_layer_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR(physicalDevice, pTimeDomainCount, pTimeDomains); } -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ diff --git a/layer/calibrated_timestamps_api.hpp b/layer/calibrated_timestamps_api.hpp index fbe6e0e..d1eee9c 100644 --- a/layer/calibrated_timestamps_api.hpp +++ b/layer/calibrated_timestamps_api.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -32,7 +32,6 @@ #pragma once #include "util/macros.hpp" -#if VULKAN_WSI_LAYER_EXPERIMENTAL VWL_VKAPI_CALL(VkResult) wsi_layer_vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR *pTimestampInfos, uint64_t *pTimestamps, @@ -49,4 +48,3 @@ wsi_layer_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR(VkPhysicalDevice physic VWL_VKAPI_CALL(VkResult) wsi_layer_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainEXT *pTimeDomains) VWL_API_POST; -#endif diff --git a/layer/layer.cpp b/layer/layer.cpp index 106000d..6117c15 100644 --- a/layer/layer.cpp +++ b/layer/layer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2025 Arm Limited. + * Copyright (c) 2016-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -31,8 +31,8 @@ #include #include "layer/calibrated_timestamps_api.hpp" +#include "present_timing_api.hpp" #include "present_wait_api.hpp" -#include "wsi_layer_experimental.hpp" #include "private_data.hpp" #include "surface_api.hpp" #include "swapchain_api.hpp" @@ -246,16 +246,13 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic util::vector modified_enabled_extensions{ allocator }; util::extension_list enabled_extensions{ allocator }; -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkPhysicalDeviceMaintenance9FeaturesKHR maintenance9_features = {}; -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ const util::wsi_platform_set &enabled_platforms = inst_data.get_enabled_platforms(); if (!enabled_platforms.empty()) { TRY_LOG_CALL(enabled_extensions.add(pCreateInfo->ppEnabledExtensionNames, pCreateInfo->enabledExtensionCount)); TRY_LOG_CALL(wsi::add_device_extensions_required_by_layer(physicalDevice, enabled_platforms, enabled_extensions, inst_data.api_version)); -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto present_timing_supported = wsi::present_timing_dependencies_supported(physicalDevice); if (std::holds_alternative(present_timing_supported)) { @@ -286,7 +283,6 @@ VKAPI_ATTR VkResult create_device(VkPhysicalDevice physicalDevice, const VkDevic modified_info.pNext = &maintenance9_features; } } -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ TRY_LOG_CALL(enabled_extensions.get_extension_strings(modified_enabled_extensions)); @@ -598,7 +594,6 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, } } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *present_timing_features = util::find_extension( VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_TIMING_FEATURES_EXT, pFeatures->pNext); if (present_timing_features != nullptr) @@ -615,7 +610,6 @@ wsi_layer_vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physical_device, present_timing_features->presentAtAbsoluteTime = VK_TRUE; present_timing_features->presentAtRelativeTime = VK_TRUE; } -#endif auto *present_mode_fifo_latest_ready_features = util::find_extension( @@ -679,7 +673,7 @@ wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POS { GET_PROC_ADDR(vkGetSwapchainStatusKHR); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL + if (device_data.is_device_extension_enabled(VK_EXT_PRESENT_TIMING_EXTENSION_NAME)) { GET_PROC_ADDR(vkSetSwapchainPresentTimingQueueSizeEXT); @@ -692,7 +686,7 @@ wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POS GET_PROC_ADDR(vkGetCalibratedTimestampsEXT); } } -#endif + GET_PROC_ADDR(vkDestroyDevice); GET_PROC_ADDR(vkCreateImage); @@ -809,10 +803,9 @@ wsi_layer_vkGetInstanceProcAddr(VkInstance instance, const char *funcName) VWL_A GET_PROC_ADDR(vkGetPhysicalDeviceSurfaceCapabilities2KHR); GET_PROC_ADDR(vkGetPhysicalDeviceSurfaceFormats2KHR); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL + GET_PROC_ADDR(vkGetPhysicalDeviceCalibrateableTimeDomainsKHR); GET_PROC_ADDR(vkGetPhysicalDeviceCalibrateableTimeDomainsEXT); -#endif if (instance_data.is_instance_extension_enabled(VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { diff --git a/layer/present_timing_api.cpp b/layer/present_timing_api.cpp index 16dce6f..acbecb0 100644 --- a/layer/present_timing_api.cpp +++ b/layer/present_timing_api.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Arm Limited. + * Copyright (c) 2024-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -28,13 +28,12 @@ * @brief Contains the Vulkan entrypoints for the present timing. */ #include -#include "wsi_layer_experimental.hpp" +#include "present_timing_api.hpp" #include #include #include "util/macros.hpp" -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Implements vkSetSwapchainPresentTimingQueueSizeEXT Vulkan entrypoint. */ @@ -119,4 +118,3 @@ wsi_layer_vkGetPastPresentationTimingEXT( auto *ext = sc->get_swapchain_extension(true); return ext->get_past_presentation_results(pPastPresentationTimingProperties, pPastPresentationTimingInfo->flags); } -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ diff --git a/layer/present_timing_api.hpp b/layer/present_timing_api.hpp new file mode 100644 index 0000000..3e5d659 --- /dev/null +++ b/layer/present_timing_api.hpp @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024-2026 Arm Limited. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/** + * @file present_timing_api.hpp + * + * @brief Contains the declarations of the structures and entry point APIs of experimental extensions. + * + */ + +#pragma once +#include "util/macros.hpp" + +VWL_VKAPI_CALL(VkResult) +wsi_layer_vkSetSwapchainPresentTimingQueueSizeEXT(VkDevice device, VkSwapchainKHR swapchain, + uint32_t size) VWL_API_POST; + +VWL_VKAPI_CALL(VkResult) +wsi_layer_vkGetSwapchainTimingPropertiesEXT(VkDevice device, VkSwapchainKHR swapchain, + VkSwapchainTimingPropertiesEXT *pSwapchainTimingProperties, + uint64_t *pSwapchainTimingPropertiesCounter) VWL_API_POST; +VWL_VKAPI_CALL(VkResult) +wsi_layer_vkGetSwapchainTimeDomainPropertiesEXT(VkDevice device, VkSwapchainKHR swapchain, + VkSwapchainTimeDomainPropertiesEXT *pSwapchainTimeDomainProperties, + uint64_t *pTimeDomainsCounter) VWL_API_POST; + +VWL_VKAPI_CALL(VkResult) +wsi_layer_vkGetPastPresentationTimingEXT( + VkDevice device, const VkPastPresentationTimingInfoEXT *pPastPresentationTimingInfo, + VkPastPresentationTimingPropertiesEXT *pPastPresentationTimingProperties) VWL_API_POST; diff --git a/layer/private_data.cpp b/layer/private_data.cpp index 30464ca..973a60c 100644 --- a/layer/private_data.cpp +++ b/layer/private_data.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 Arm Limited. + * Copyright (c) 2018-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -472,9 +472,7 @@ device_private_data::device_private_data(instance_private_data &inst_data, VkPhy , compression_control_enabled{ false } , present_id_enabled { false } , swapchain_maintenance1_enabled{ false } -#if VULKAN_WSI_LAYER_EXPERIMENTAL , present_timing_enabled { true } -#endif , present_wait2_enabled { false } , present_id2_enabled { false } , present_mode_fifo_latest_ready_enabled { false } diff --git a/layer/private_data.hpp b/layer/private_data.hpp index edb1526..dcf1bfa 100644 --- a/layer/private_data.hpp +++ b/layer/private_data.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2025 Arm Limited. + * Copyright (c) 2018-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -24,7 +24,7 @@ #pragma once -#include +#include #include #include @@ -379,15 +379,7 @@ private: * alias: Name of the promoted entrypoint alias if different to entrypoint_name. */ -#if VULKAN_WSI_LAYER_EXPERIMENTAL -#define DEVICE_ENTRYPOINTS_LIST_EXPERIMENTAL(EP) \ - EP(GetSwapchainTimeDomainPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ - EP(GetSwapchainTimingPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ - EP(SetSwapchainPresentTimingQueueSizeEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ - EP(GetPastPresentationTimingEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) -#else #define DEVICE_ENTRYPOINTS_LIST_EXPERIMENTAL(EP) -#endif /* Define a list of custom entrypoints that might rely on preprocessor conditions and similar */ #define DEVICE_ENTRYPOINTS_LIST_EXPANSION(EP) DEVICE_ENTRYPOINTS_LIST_EXPERIMENTAL(EP) @@ -481,6 +473,10 @@ private: EP(WaitForPresentKHR, VK_KHR_PRESENT_WAIT_EXTENSION_NAME, API_VERSION_MAX, false, ) \ /* VK_KHR_present_wait2 */ \ EP(WaitForPresent2KHR, VK_KHR_PRESENT_WAIT_2_EXTENSION_NAME, API_VERSION_MAX, false, ) \ + EP(GetSwapchainTimeDomainPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ + EP(GetSwapchainTimingPropertiesEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ + EP(SetSwapchainPresentTimingQueueSizeEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ + EP(GetPastPresentationTimingEXT, VK_EXT_PRESENT_TIMING_EXTENSION_NAME, API_VERSION_MAX, false, ) \ /* Custom entrypoints */ \ DEVICE_ENTRYPOINTS_LIST_EXPANSION(EP) @@ -1099,12 +1095,10 @@ private: */ bool present_wait_enabled{ false }; -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Stores whether the device has enabled support for the present timing features. */ bool present_timing_enabled{ false }; -#endif /** * @brief Stores whether the device supports the present wait2 feature. diff --git a/layer/surface_api.cpp b/layer/surface_api.cpp index dde362d..7a7e24f 100644 --- a/layer/surface_api.cpp +++ b/layer/surface_api.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, 2019, 2021-2022, 2024-2025 Arm Limited. + * Copyright (c) 2016-2017, 2019, 2021-2022, 2024-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -119,14 +119,12 @@ wsi_layer_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDe wsi::surface_properties *props = wsi::get_surface_properties(instance, pSurfaceInfo->surface); assert(props != nullptr); -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *surf_caps_ext = util::find_extension( VK_STRUCTURE_TYPE_PRESENT_TIMING_SURFACE_CAPABILITIES_EXT, pSurfaceCapabilities); if (surf_caps_ext != nullptr) { TRY_LOG_CALL(props->get_present_timing_surface_caps(physicalDevice, surf_caps_ext)); } -#endif auto shared_present_surface_cap_struct = util::find_extension( VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR, pSurfaceCapabilities); diff --git a/layer/swapchain_api.cpp b/layer/swapchain_api.cpp index 2c5dbd8..9a4f8f9 100644 --- a/layer/swapchain_api.cpp +++ b/layer/swapchain_api.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, 2021-2025 Arm Limited. + * Copyright (c) 2017, 2019, 2021-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -218,14 +218,13 @@ wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT, present_info->pNext); const auto swapchain_present_mode_info = util::find_extension( VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT, present_info->pNext); -#if VULKAN_WSI_LAYER_EXPERIMENTAL const auto present_timings_info = util::find_extension(VK_STRUCTURE_TYPE_PRESENT_TIMINGS_INFO_EXT, present_info->pNext); if (present_timings_info) { assert(present_timings_info->swapchainCount == pPresentInfo->swapchainCount); } -#endif + for (uint32_t i = 0; i < pPresentInfo->swapchainCount; ++i) { VkSwapchainKHR swapc = pPresentInfo->pSwapchains[i]; @@ -260,13 +259,11 @@ wsi_layer_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) present_params.use_image_present_semaphore = use_image_present_semaphore; present_params.handle_present_frame_boundary_event = frame_boundary_event_handled; -#if VULKAN_WSI_LAYER_EXPERIMENTAL if (present_timings_info) { present_params.m_present_timing_info = present_timings_info->pTimingInfos[i]; present_params.m_present_timing_info.pNext = nullptr; } -#endif VkResult res = sc->queue_present(queue, present_info, present_params); if (pPresentInfo->pResults != nullptr) { diff --git a/layer/wsi_layer_experimental.hpp b/layer/wsi_layer_experimental.hpp index d7251a5..8e86520 100644 --- a/layer/wsi_layer_experimental.hpp +++ b/layer/wsi_layer_experimental.hpp @@ -34,22 +34,4 @@ #if VULKAN_WSI_LAYER_EXPERIMENTAL -VWL_VKAPI_CALL(VkResult) -wsi_layer_vkSetSwapchainPresentTimingQueueSizeEXT(VkDevice device, VkSwapchainKHR swapchain, - uint32_t size) VWL_API_POST; - -VWL_VKAPI_CALL(VkResult) -wsi_layer_vkGetSwapchainTimingPropertiesEXT(VkDevice device, VkSwapchainKHR swapchain, - VkSwapchainTimingPropertiesEXT *pSwapchainTimingProperties, - uint64_t *pSwapchainTimingPropertiesCounter) VWL_API_POST; -VWL_VKAPI_CALL(VkResult) -wsi_layer_vkGetSwapchainTimeDomainPropertiesEXT(VkDevice device, VkSwapchainKHR swapchain, - VkSwapchainTimeDomainPropertiesEXT *pSwapchainTimeDomainProperties, - uint64_t *pTimeDomainsCounter) VWL_API_POST; - -VWL_VKAPI_CALL(VkResult) -wsi_layer_vkGetPastPresentationTimingEXT( - VkDevice device, const VkPastPresentationTimingInfoEXT *pPastPresentationTimingInfo, - VkPastPresentationTimingPropertiesEXT *pPastPresentationTimingProperties) VWL_API_POST; - #endif diff --git a/wsi/display/surface_properties.cpp b/wsi/display/surface_properties.cpp index 332d72e..686fb15 100644 --- a/wsi/display/surface_properties.cpp +++ b/wsi/display/surface_properties.cpp @@ -566,7 +566,6 @@ bool surface_properties::is_surface_extension_enabled(const layer::instance_priv return instance_data.is_instance_extension_enabled(VK_KHR_SURFACE_EXTENSION_NAME); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult surface_properties::get_present_timing_surface_caps_internal( VkPhysicalDevice, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) { @@ -577,7 +576,6 @@ VkResult surface_properties::get_present_timing_surface_caps_internal( return VK_SUCCESS; } -#endif surface_properties &surface_properties::get_instance() { diff --git a/wsi/display/surface_properties.hpp b/wsi/display/surface_properties.hpp index c8e68b5..3ef8300 100644 --- a/wsi/display/surface_properties.hpp +++ b/wsi/display/surface_properties.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Arm Limited. + * Copyright (c) 2024-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -82,10 +82,8 @@ private: void get_surface_present_scaling_and_gravity(VkSurfacePresentScalingCapabilitiesEXT *scaling_capabilities) override; void populate_present_mode_compatibilities() override; -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) override; -#endif }; } /* namespace display */ diff --git a/wsi/extensions/present_timing.cpp b/wsi/extensions/present_timing.cpp index 4b6aa1a..f12b4da 100644 --- a/wsi/extensions/present_timing.cpp +++ b/wsi/extensions/present_timing.cpp @@ -34,7 +34,6 @@ #include "present_timing.hpp" -#if VULKAN_WSI_LAYER_EXPERIMENTAL namespace wsi { /* VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT, @@ -732,5 +731,3 @@ std::variant present_timing_dependencies_supported(VkPhysicalDev return maintenance9.maintenance9 != VK_FALSE; } } /* namespace wsi */ - -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ diff --git a/wsi/extensions/present_timing.hpp b/wsi/extensions/present_timing.hpp index a7a860b..017cd99 100644 --- a/wsi/extensions/present_timing.hpp +++ b/wsi/extensions/present_timing.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Arm Limited. + * Copyright (c) 2024-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -42,15 +42,14 @@ #include #include -#include #include +#include #include #include #include #include #include -#if VULKAN_WSI_LAYER_EXPERIMENTAL namespace wsi { @@ -846,4 +845,3 @@ inline uint64_t ticks_to_ns(uint64_t ticks, const float ×tamp_period) } } /* namespace wsi */ -#endif diff --git a/wsi/headless/present_timing_handler.cpp b/wsi/headless/present_timing_handler.cpp index 9bd9d83..ac063e2 100644 --- a/wsi/headless/present_timing_handler.cpp +++ b/wsi/headless/present_timing_handler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,7 +27,6 @@ * * @brief Contains the functionality to implement features for present timing extension. */ -#if VULKAN_WSI_LAYER_EXPERIMENTAL #include #include #include @@ -183,5 +182,3 @@ VkPresentStageFlagsEXT wsi_ext_present_timing_headless::stages_supported() } return stages; } - -#endif diff --git a/wsi/headless/present_timing_handler.hpp b/wsi/headless/present_timing_handler.hpp index dd5396c..f2d58c2 100644 --- a/wsi/headless/present_timing_handler.hpp +++ b/wsi/headless/present_timing_handler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -29,8 +29,6 @@ */ #pragma once -#if VULKAN_WSI_LAYER_EXPERIMENTAL - #include #include @@ -109,5 +107,3 @@ private: */ bool m_is_swapchain_using_shared_present_mode; }; - -#endif diff --git a/wsi/headless/surface_properties.cpp b/wsi/headless/surface_properties.cpp index 2c39518..3bfe538 100644 --- a/wsi/headless/surface_properties.cpp +++ b/wsi/headless/surface_properties.cpp @@ -34,15 +34,11 @@ #include #include - +#include "present_timing_handler.hpp" #include "surface_properties.hpp" #include "surface.hpp" #include "util/macros.hpp" -#if VULKAN_WSI_LAYER_EXPERIMENTAL -#include "present_timing_handler.hpp" -#endif - namespace wsi { namespace headless @@ -249,7 +245,6 @@ bool surface_properties::is_compatible_present_modes(VkPresentModeKHR present_mo return m_compatible_present_modes.is_compatible_present_modes(present_mode_a, present_mode_b); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult surface_properties::get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) { @@ -280,7 +275,6 @@ VkResult surface_properties::get_present_timing_surface_caps_internal( return VK_SUCCESS; } -#endif } /* namespace headless */ } /* namespace wsi */ diff --git a/wsi/headless/surface_properties.hpp b/wsi/headless/surface_properties.hpp index 82cd693..51e80f6 100644 --- a/wsi/headless/surface_properties.hpp +++ b/wsi/headless/surface_properties.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, 2022-2025 Arm Limited. + * Copyright (c) 2017-2019, 2022-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -75,10 +75,8 @@ private: void get_surface_present_scaling_and_gravity(VkSurfacePresentScalingCapabilitiesEXT *scaling_capabilities) override; -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) override; -#endif }; } /* namespace headless */ diff --git a/wsi/headless/swapchain.cpp b/wsi/headless/swapchain.cpp index e7b93b6..0570789 100644 --- a/wsi/headless/swapchain.cpp +++ b/wsi/headless/swapchain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2025 Arm Limited. + * Copyright (c) 2017-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -99,7 +99,6 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr } } -#if VULKAN_WSI_LAYER_EXPERIMENTAL bool swapchain_support_enabled = swapchain_create_info->flags & VK_SWAPCHAIN_CREATE_PRESENT_TIMING_BIT_EXT; if (swapchain_support_enabled) { @@ -109,7 +108,6 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr return VK_ERROR_OUT_OF_HOST_MEMORY; } } -#endif bool present_wait2; constexpr VkSwapchainCreateFlagsKHR present_wait2_mask = @@ -176,7 +174,6 @@ VkResult swapchain::allocate_and_bind_swapchain_image(swapchain_image &image) void swapchain::present_image(const pending_present_request &pending_present) { -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *ext_present_timing = get_swapchain_extension(); if (ext_present_timing) { @@ -215,7 +212,6 @@ void swapchain::present_image(const pending_present_request &pending_present) ext_present_timing->remove_presentation_target_entry(pending_present.image_index); } -#endif auto *ext = get_swapchain_extension(); if (ext != nullptr) @@ -223,7 +219,6 @@ void swapchain::present_image(const pending_present_request &pending_present) ext->mark_delivered(pending_present.present_id); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL if (ext_present_timing && ext_present_timing->get_monotonic_domain().has_value()) { auto current_time = ext_present_timing->get_current_clock_time_ns(); @@ -244,8 +239,6 @@ void swapchain::present_image(const pending_present_request &pending_present) ext_present_timing->set_pending_stage_time(pending_present.image_index, stage, *current_time); } } -#endif - unpresent_image(pending_present.image_index); } diff --git a/wsi/surface_properties.cpp b/wsi/surface_properties.cpp index 0299c9e..673bc5a 100644 --- a/wsi/surface_properties.cpp +++ b/wsi/surface_properties.cpp @@ -141,7 +141,6 @@ void get_surface_capabilities_common(VkPhysicalDevice physical_device, VkSurface VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT; } -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Get the present timing surface capabilities for the specific VkSurface type. */ @@ -163,6 +162,5 @@ VkResult surface_properties::get_present_timing_surface_caps( return VK_SUCCESS; } -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ } /* namespace wsi */ diff --git a/wsi/surface_properties.hpp b/wsi/surface_properties.hpp index ce996a9..92d270a 100644 --- a/wsi/surface_properties.hpp +++ b/wsi/surface_properties.hpp @@ -31,7 +31,7 @@ #pragma once #include -#include "layer/wsi_layer_experimental.hpp" +#include "layer/present_timing_api.hpp" #include "layer/private_data.hpp" #include "util/custom_allocator.hpp" #include "util/drm/drm_utils.hpp" @@ -119,13 +119,11 @@ public: virtual bool is_compatible_present_modes(VkPresentModeKHR present_mode_a, VkPresentModeKHR present_mode_b) = 0; -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Get the present timing surface capabilities for the specific VkSurface type. */ VkResult get_present_timing_surface_caps(VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps); -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ /** * @brief Virtual destructor. @@ -138,13 +136,11 @@ private: */ virtual void populate_present_mode_compatibilities() = 0; -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * @brief Get the present timing surface capabilities for the specific VkSurface type. */ virtual VkResult get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) = 0; -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ }; class surface_format_properties diff --git a/wsi/swapchain_base.cpp b/wsi/swapchain_base.cpp index 37551c6..cb39ee5 100644 --- a/wsi/swapchain_base.cpp +++ b/wsi/swapchain_base.cpp @@ -581,7 +581,6 @@ VkResult swapchain_base::notify_presentation_engine(const pending_present_reques VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *present_info, const swapchain_presentation_parameters &submit_info) { -#if VULKAN_WSI_LAYER_EXPERIMENTAL const VkPresentTimingInfoEXT *present_timing_info = nullptr; const auto *present_timings_info = util::find_extension(VK_STRUCTURE_TYPE_PRESENT_TIMINGS_INFO_EXT, present_info->pNext); @@ -595,7 +594,7 @@ VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *pr TRY(ext_present_timing->queue_has_space()); } } -#endif + if (submit_info.switch_presentation_mode) { /* Assert when a presentation mode switch is requested and the swapchain_maintenance1 extension which implements this is not available */ @@ -636,7 +635,6 @@ VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *pr signal_semaphores[count_signal_semaphores++] = m_swapchain_images[submit_info.pending_present.image_index].get_present_fence_wait_semaphore(); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL if ((present_timing_info != nullptr) && (present_timing_info->presentStageQueries & VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT)) { @@ -647,7 +645,7 @@ VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *pr ext_present_timing->get_image_present_semaphore(submit_info.pending_present.image_index); } } -#endif + queue_submit_semaphores semaphores = { wait_semaphores, sem_count, @@ -669,14 +667,12 @@ VkResult swapchain_base::queue_present(VkQueue queue, const VkPresentInfoKHR *pr TRY(sync_queue_submit(m_device_data, queue, submit_info.present_fence, present_fence_semaphores)); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL if (present_timing_info != nullptr) { auto *ext_present_timing = get_swapchain_extension(true); TRY_LOG_CALL(ext_present_timing->add_presentation_entry( queue, submit_info.pending_present.present_id, submit_info.pending_present.image_index, *present_timing_info)); } -#endif TRY(notify_presentation_engine(submit_info.pending_present)); return VK_SUCCESS; diff --git a/wsi/swapchain_base.hpp b/wsi/swapchain_base.hpp index f23669f..0847248 100644 --- a/wsi/swapchain_base.hpp +++ b/wsi/swapchain_base.hpp @@ -100,20 +100,16 @@ struct swapchain_presentation_parameters */ VkBool32 handle_present_frame_boundary_event{ true }; -#if VULKAN_WSI_LAYER_EXPERIMENTAL /** * The present timing info. */ VkPresentTimingInfoEXT m_present_timing_info; -#endif }; enum signal_semaphores_type { SIGNAL_SEMAPHORE_PRESENT_FENCE, -#if VULKAN_WSI_LAYER_EXPERIMENTAL SIGNAL_SEMAPHORE_PRESENT_TIMING, -#endif SIGNAL_SEMAPHORE_MAX_NUM, }; diff --git a/wsi/wayland/present_id_wayland.cpp b/wsi/wayland/present_id_wayland.cpp index 0804da1..aa4e227 100644 --- a/wsi/wayland/present_id_wayland.cpp +++ b/wsi/wayland/present_id_wayland.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -27,7 +27,6 @@ * * @brief Contains the functionality to implement Wayland specific features for present ID extension. */ -#if VULKAN_WSI_LAYER_EXPERIMENTAL #include #include "present_id_wayland.hpp" @@ -105,5 +104,3 @@ void wsi_ext_present_id_wayland::remove_from_pending_present_feedback_list(uint6 } // namespace wayland } // namespace wsi - -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ diff --git a/wsi/wayland/present_id_wayland.hpp b/wsi/wayland/present_id_wayland.hpp index 2d27f8d..af7d87f 100644 --- a/wsi/wayland/present_id_wayland.hpp +++ b/wsi/wayland/present_id_wayland.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -29,8 +29,6 @@ */ #pragma once -#if VULKAN_WSI_LAYER_EXPERIMENTAL - #include #include #include "surface_properties.hpp" @@ -97,5 +95,3 @@ private: } // namespace wayland } // namespace wsi - -#endif /* VULKAN_WSI_LAYER_EXPERIMENTAL */ diff --git a/wsi/wayland/present_timing_handler.hpp b/wsi/wayland/present_timing_handler.hpp index 343c3ea..4e1c202 100644 --- a/wsi/wayland/present_timing_handler.hpp +++ b/wsi/wayland/present_timing_handler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arm Limited. + * Copyright (c) 2025-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -29,8 +29,6 @@ */ #pragma once -#if VULKAN_WSI_LAYER_EXPERIMENTAL - #include #include @@ -178,5 +176,3 @@ private: } // namespace wayland } // namespace wsi - -#endif diff --git a/wsi/wayland/surface_properties.cpp b/wsi/wayland/surface_properties.cpp index 1dcbf07..72602d1 100644 --- a/wsi/wayland/surface_properties.cpp +++ b/wsi/wayland/surface_properties.cpp @@ -36,6 +36,7 @@ #include #include #include +#include "present_timing_handler.hpp" #include "surface_properties.hpp" #include "surface.hpp" #include "layer/private_data.hpp" @@ -46,10 +47,6 @@ #include "util/macros.hpp" #include "util/helpers.hpp" -#if VULKAN_WSI_LAYER_EXPERIMENTAL -#include "present_timing_handler.hpp" -#endif - namespace wsi { namespace wayland @@ -454,7 +451,6 @@ bool surface_properties::is_compatible_present_modes(VkPresentModeKHR present_mo return m_compatible_present_modes.is_compatible_present_modes(present_mode_a, present_mode_b); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult surface_properties::get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) { @@ -503,7 +499,6 @@ VkResult surface_properties::get_present_timing_surface_caps_internal( return VK_SUCCESS; } -#endif } // namespace wayland } // namespace wsi diff --git a/wsi/wayland/surface_properties.hpp b/wsi/wayland/surface_properties.hpp index 4953e6d..034f567 100644 --- a/wsi/wayland/surface_properties.hpp +++ b/wsi/wayland/surface_properties.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019, 2021-2025 Arm Limited. + * Copyright (c) 2017-2019, 2021-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -95,10 +95,8 @@ private: void get_surface_present_scaling_and_gravity(VkSurfacePresentScalingCapabilitiesEXT *scaling_capabilities) override; -#if VULKAN_WSI_LAYER_EXPERIMENTAL VkResult get_present_timing_surface_caps_internal( VkPhysicalDevice physical_device, VkPresentTimingSurfaceCapabilitiesEXT *present_timing_surface_caps) override; -#endif }; } // namespace wayland diff --git a/wsi/wayland/swapchain.cpp b/wsi/wayland/swapchain.cpp index 62ce5ce..4346d69 100644 --- a/wsi/wayland/swapchain.cpp +++ b/wsi/wayland/swapchain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2025 Arm Limited. + * Copyright (c) 2017-2026 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -123,11 +123,7 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr if (m_device_data.is_present_id_enabled() || (swapchain_create_info->flags & VK_SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR)) { -#if VULKAN_WSI_LAYER_EXPERIMENTAL if (!add_swapchain_extension(m_allocator.make_unique())) -#else - if (!add_swapchain_extension(m_allocator.make_unique())) -#endif { return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -163,7 +159,6 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr } } -#if VULKAN_WSI_LAYER_EXPERIMENTAL bool swapchain_support_enabled = swapchain_create_info->flags & VK_SWAPCHAIN_CREATE_PRESENT_TIMING_BIT_EXT; if (swapchain_support_enabled) { @@ -187,8 +182,6 @@ VkResult swapchain::add_required_extensions(VkDevice device, const VkSwapchainCr return VK_ERROR_OUT_OF_HOST_MEMORY; } } -#endif - return VK_SUCCESS; } @@ -225,13 +218,12 @@ VkResult swapchain::init_platform(VkDevice device, const VkSwapchainCreateInfoKH { present_wait->set_wayland_dispatcher(m_display, m_buffer_queue); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL + auto *present_timing_ext = get_swapchain_extension(); if (present_timing_ext != nullptr) { present_timing_ext->init(m_display, m_buffer_queue); } -#endif auto wsi_allocator = swapchain_wsialloc_allocator::create(); if (!wsi_allocator.has_value()) @@ -304,7 +296,6 @@ void swapchain::release_buffer(struct wl_buffer *wayl_buffer) auto data = m_swapchain_images[i].get_data(); if (data && data->get_buffer() == wayl_buffer) { -#if VULKAN_WSI_LAYER_EXPERIMENTAL /* Some compositors might not deliver wp_presentation_feedback events if the images are pushed to compositor quick enough * in presentation modes that allow it (mailbox). If that happens, double check if these images were submitted for feedback * and handle it as a 'image discarded' event. */ @@ -318,8 +309,6 @@ void swapchain::release_buffer(struct wl_buffer *wayl_buffer) { present_id_ext->mark_buffer_release(i); } -#endif - unpresent_image(i); break; } @@ -433,7 +422,6 @@ void swapchain::present_image(const pending_present_request &pending_present) } } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *present_id_ext = get_swapchain_extension(); if (present_id_ext != nullptr) { @@ -474,7 +462,6 @@ void swapchain::present_image(const pending_present_request &pending_present) register_wp_presentation_feedback_listener(feedback, feedback_obj); } } -#endif wl_surface_commit(m_surface); int res = wl_display_flush(m_display); @@ -485,21 +472,14 @@ void swapchain::present_image(const pending_present_request &pending_present) set_error_state(VK_ERROR_SURFACE_LOST_KHR); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL auto *ext = get_swapchain_extension(); if (ext != nullptr) { if (m_wsi_surface->get_presentation_time_interface() == nullptr) -#else - auto *ext = get_swapchain_extension(); - if (ext != nullptr) -#endif { ext->mark_delivered(pending_present.present_id); } -#if VULKAN_WSI_LAYER_EXPERIMENTAL } -#endif } bool swapchain::free_image_found()