DisplayVk: also recreate the swapchain with VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT
According to the spec: https://www.khronos.org/registry/vulkan/specs/1.3-extensions/man/html/vkQueuePresentKHR.html#_description,
VkQueuePresentKHR can recover from VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT
by recreating the swapchain.
Bug: b/217229121
Test: run the emulator
Change-Id: Ibd3316d0d6b37788190faabb7ccc4b37284eb842
diff --git a/stream-servers/DisplayVk.cpp b/stream-servers/DisplayVk.cpp
index 8c1de5a..d353b7f 100644
--- a/stream-servers/DisplayVk.cpp
+++ b/stream-servers/DisplayVk.cpp
@@ -32,7 +32,17 @@
namespace {
bool shouldRecreateSwapchain(VkResult result) {
- return result == VK_SUBOPTIMAL_KHR || result == VK_ERROR_OUT_OF_DATE_KHR;
+ switch (result) {
+ case VK_SUBOPTIMAL_KHR:
+ case VK_ERROR_OUT_OF_DATE_KHR:
+ // b/217229121: drivers may return VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT in
+ // vkQueuePresentKHR even if VK_EXT_full_screen_exclusive is not enabled.
+ case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
+ return true;
+
+ default:
+ return false;
+ }
}
} // namespace