Merge 'Disable the FIFO present thread implementation on Wayland by default' into 'main'

See merge request mesa/vulkan-wsi-layer!121
This commit is contained in:
Rosen Zhelev 2024-10-23 10:00:47 +00:00
commit b612383789
3 changed files with 22 additions and 1 deletions

View file

@ -67,6 +67,7 @@ set(EXTERNAL_WSIALLOC_LIBRARY "" CACHE STRING "External implementation of the ws
option(BUILD_WSI_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN "Build with support for VK_EXT_image_compression_control_swapchain" OFF)
option(BUILD_WSI_DISPLAY_SUPPORT_FORMAT_MODIFIERS "Build with support for format modifiers in VK_KHR_display" ON)
option(VULKAN_WSI_LAYER_EXPERIMENTAL "Enable the Vulkan WSI Experimental features" OFF)
option(ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD "Enable the non-conformant FIFO presentation thread implementation in the Wayland backend" OFF)
# Enables the layer to pass frame boundary events if the ICD or layers below have support for it by
# making use of the VK_EXT_frame_boundary extension. If the application itself makes use of the
@ -182,6 +183,11 @@ if(BUILD_WSI_WAYLAND)
endif()
target_link_libraries(wayland_wsi drm_utils ${WAYLAND_CLIENT_LDFLAGS})
list(APPEND LINK_WSI_LIBS wayland_wsi)
if(ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD)
target_compile_definitions(wayland_wsi PRIVATE "-DWAYLAND_FIFO_PRESENTATION_THREAD_ENABLED=1")
else()
target_compile_definitions(wayland_wsi PRIVATE "-DWAYLAND_FIFO_PRESENTATION_THREAD_ENABLED=0")
endif()
else()
list(APPEND JSON_COMMANDS COMMAND sed -i '/VK_KHR_wayland_surface/d' ${CMAKE_CURRENT_BINARY_DIR}/VkLayer_window_system_integration.json)
endif()

View file

@ -126,6 +126,20 @@ provides a generic ion implementation that may work in systems that support
linear formats. This is selected by the `-DSELECT_EXTERNAL_ALLOCATOR=ion`
option, as shown above.
### Wayland support with FIFO presentation mode
The WSI Layer has 2 FIFO implementations for the Wayland backend. One that
blocks in vkQueuePresent and one that uses a presentation thread. This is due
to the fact that the FIFO implementation that utilises the presentation thread
in the Wayland backend is not strictly conformant to the Vulkan specification,
however it has a much better performance due to not needing to block in vkQueuePresent.
By default, the WSI Layer uses the queue present blocking FIFO implementation
when using Wayland swapchains. This can be switched to instead use the presentation
thread implementation by including the build option `ENABLE_WAYLAND_FIFO_PRESENTATION_THREAD`,
along with the other build options mentioned in "Building with Wayland support"
section.
### Building with frame instrumentation support
The layer can be built to pass frame boundary information down to other

View file

@ -104,7 +104,8 @@ VkResult swapchain::init_platform(VkDevice device, const VkSwapchainCreateInfoKH
* initialize the page flip thread so the present_image function can be called
* during vkQueuePresent.
*/
use_presentation_thread = (m_present_mode != VK_PRESENT_MODE_MAILBOX_KHR);
use_presentation_thread =
WAYLAND_FIFO_PRESENTATION_THREAD_ENABLED && (m_present_mode != VK_PRESENT_MODE_MAILBOX_KHR);
return VK_SUCCESS;
}