Have vkGetRefreshCycleDurationGOOGLE query SF every time.
When VK_GOOGLE_display_timing was first created, we assumed displays
never changed refresh rates. Now that they are dynamic, we need to
query SF everytime the app requests it.
Test: ANGLE-on-Vulkan
Bug: b/130888074
Change-Id: I5eb9a20690f82b8663899a2ded8b5bb866cebe58
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index bc00190..a22f60e 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -222,6 +222,15 @@
window,
&refresh_duration);
}
+ uint64_t get_refresh_duration()
+ {
+ ANativeWindow* window = surface.window.get();
+ native_window_get_refresh_cycle_duration(
+ window,
+ &refresh_duration);
+ return static_cast<uint64_t>(refresh_duration);
+
+ }
Surface& surface;
uint32_t num_images;
@@ -1730,8 +1739,7 @@
Swapchain& swapchain = *SwapchainFromHandle(swapchain_handle);
VkResult result = VK_SUCCESS;
- pDisplayTimingProperties->refreshDuration =
- static_cast<uint64_t>(swapchain.refresh_duration);
+ pDisplayTimingProperties->refreshDuration = swapchain.get_refresh_duration();
return result;
}