A bug in vulkan tools, https://github.com/KhronosGroup/Vulkan-Tools/issues/846
causes vulkaninfo to crash in Mesa under wayland since the changes
in
5ceba97c
Handle the crashing case on wayland similarly to how other WSIs
do (nonsensically claiming a single compatible mode), and log
the condition once for all WSIs.
Fixes
5ceba97c2
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24888>
#include <stdint.h>
#include <stdbool.h>
+#include "util/log.h"
#include "vk_alloc.h"
#include "vk_dispatch_table.h"
#include <vulkan/vulkan.h>
bool
wsi_common_vk_instance_supports_present_wait(const struct vk_instance *instance);
+#define wsi_common_vk_warn_once(warning) \
+ do { \
+ static int warned = false; \
+ if (!warned) { \
+ mesa_loge(warning); \
+ warned = true; \
+ } \
+ } while (0)
+
#ifdef __cplusplus
}
#endif
break;
}
} else {
- switch (present_mode->presentMode) {
- case VK_PRESENT_MODE_MAILBOX_KHR:
- case VK_PRESENT_MODE_FIFO_KHR:
- compat->presentModeCount = 2;
- break;
- default:
+ if (!present_mode) {
+ wsi_common_vk_warn_once("Use of VkSurfacePresentModeCompatibilityEXT "
+ "without a VkSurfacePresentModeEXT set. This is an "
+ "application bug.\n");
compat->presentModeCount = 1;
- break;
+ } else {
+ switch (present_mode->presentMode) {
+ case VK_PRESENT_MODE_MAILBOX_KHR:
+ case VK_PRESENT_MODE_FIFO_KHR:
+ compat->presentModeCount = 2;
+ break;
+ default:
+ compat->presentModeCount = 1;
+ break;
+ }
}
}
break;
compat->presentModeCount = 1;
}
} else {
+ if (!present_mode)
+ wsi_common_vk_warn_once("Use of VkSurfacePresentModeCompatibilityEXT "
+ "without a VkSurfacePresentModeEXT set. This is an "
+ "application bug.\n");
compat->presentModeCount = 1;
}
break;
compat->presentModeCount = 1;
}
} else {
+ if (!present_mode)
+ wsi_common_vk_warn_once("Use of VkSurfacePresentModeCompatibilityEXT "
+ "without a VkSurfacePresentModeEXT set. This is an "
+ "application bug.\n");
compat->presentModeCount = 1;
}
break;