radv: add vk_wsi_disable_unordered_submits and enable for GTK

GTK is missing a semaphore between QueueSubmit() and QueuePresent()
causing the WSI submit to be "unordered" and to immediately signal the
semaphores (because it's missing a wait semaphore in QueuePresent()).

The workaround is to disable unordered WSI submits until GTK fixes it
properly.

Cc: "25.3"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14087
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38351>
This commit is contained in:
Samuel Pitoiset 2025-11-10 11:38:15 +01:00 committed by Marge Bot
parent 668259ef0b
commit 0d9d45db4e
5 changed files with 19 additions and 1 deletions

View file

@ -169,6 +169,7 @@ static const driOptionDescription radv_dri_options[] = {
DRI_CONF_VK_LOWER_TERMINATE_TO_DISCARD(false) DRI_CONF_VK_LOWER_TERMINATE_TO_DISCARD(false)
DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false) DRI_CONF_VK_WSI_FORCE_BGRA8_UNORM_FIRST(false)
DRI_CONF_VK_WSI_FORCE_SWAPCHAIN_TO_CURRENT_EXTENT(false) DRI_CONF_VK_WSI_FORCE_SWAPCHAIN_TO_CURRENT_EXTENT(false)
DRI_CONF_VK_WSI_DISABLE_UNORDERED_SUBMITS(false)
DRI_CONF_VK_X11_IGNORE_SUBOPTIMAL(false) DRI_CONF_VK_X11_IGNORE_SUBOPTIMAL(false)
DRI_CONF_VK_REQUIRE_ETC2(false) DRI_CONF_VK_REQUIRE_ETC2(false)
DRI_CONF_VK_REQUIRE_ASTC(false) DRI_CONF_VK_REQUIRE_ASTC(false)

View file

@ -70,6 +70,10 @@ Application bugs worked around in this file:
<option name="radv_tex_non_uniform" value="true" /> <option name="radv_tex_non_uniform" value="true" />
</engine> </engine>
<engine engine_name_match="GTK">
<option name="vk_wsi_disable_unordered_submits" value="true" />
</engine>
<!-- Game workarounds --> <!-- Game workarounds -->
<application name="Shadow Of The Tomb Raider (Native)" application_name_match="ShadowOfTheTomb"> <application name="Shadow Of The Tomb Raider (Native)" application_name_match="ShadowOfTheTomb">
<option name="radv_report_llvm9_version_string" value="true" /> <option name="radv_report_llvm9_version_string" value="true" />

View file

@ -449,6 +449,10 @@
DRI_CONF_OPT_B(vk_wsi_force_swapchain_to_current_extent, def, \ DRI_CONF_OPT_B(vk_wsi_force_swapchain_to_current_extent, def, \
"Force VkSwapchainCreateInfoKHR::imageExtent to be VkSurfaceCapabilities2KHR::currentExtent") "Force VkSwapchainCreateInfoKHR::imageExtent to be VkSurfaceCapabilities2KHR::currentExtent")
#define DRI_CONF_VK_WSI_DISABLE_UNORDERED_SUBMITS(def) \
DRI_CONF_OPT_B(vk_wsi_disable_unordered_submits, def, \
"Disable unordered WSI submits to workaround application synchronization bugs")
#define DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(def) \ #define DRI_CONF_VK_X11_OVERRIDE_MIN_IMAGE_COUNT(def) \
DRI_CONF_OPT_I(vk_x11_override_min_image_count, def, 0, 999, \ DRI_CONF_OPT_I(vk_x11_override_min_image_count, def, 0, 999, \
"Override the VkSurfaceCapabilitiesKHR::minImageCount (0 = no override)") "Override the VkSurfaceCapabilitiesKHR::minImageCount (0 = no override)")

View file

@ -281,6 +281,12 @@ wsi_device_init(struct wsi_device *wsi,
wsi->force_swapchain_to_currentExtent = wsi->force_swapchain_to_currentExtent =
driQueryOptionb(dri_options, "vk_wsi_force_swapchain_to_current_extent"); driQueryOptionb(dri_options, "vk_wsi_force_swapchain_to_current_extent");
} }
if (driCheckOption(dri_options, "vk_wsi_disable_unordered_submits", DRI_BOOL)) {
wsi->disable_unordered_submits =
driQueryOptionb(dri_options, "vk_wsi_disable_unordered_submits");
}
} }
/* can_present_on_device is a function pointer used to determine if images /* can_present_on_device is a function pointer used to determine if images
@ -1366,7 +1372,8 @@ wsi_queue_submit2_unordered(const struct wsi_device *wsi,
uint32_t fence_count, uint32_t fence_count,
const VkFence *fences) const VkFence *fences)
{ {
if (info->commandBufferInfoCount == 0 && if (!wsi->disable_unordered_submits &&
info->commandBufferInfoCount == 0 &&
queue->base.device->copy_sync_payloads != NULL) { queue->base.device->copy_sync_payloads != NULL) {
/* This helper is unordered so if there are no command buffers, we can /* This helper is unordered so if there are no command buffers, we can
* just signal the signal semaphores and fences with the wait semaphores * just signal the signal semaphores and fences with the wait semaphores

View file

@ -100,6 +100,8 @@ struct wsi_device {
bool force_swapchain_to_currentExtent; bool force_swapchain_to_currentExtent;
bool disable_unordered_submits;
struct { struct {
/* Override the minimum number of images on the swapchain. /* Override the minimum number of images on the swapchain.
* 0 = no override */ * 0 = no override */