Commit 65d674b0cc13ff8281a4ab99015d27e6d50c92a9

Igor Nazarov 2024-12-02T18:36:11

Vulkan: Must run UnlockedTailCall from flush and finish `glFlush` and `glFinish` may call `WindowSurfaceVk::swapImpl()` implicitly when the current Window Surface is in the single buffer mode. The `WindowSurfaceVk::swapImpl()` in turn may add unlocked tail call in order to perform CPU throttling. It seems, that CPU throttling is only possible if also enable the `EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID` attribute (using `VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR`). Without this attribute (`VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR`) `vkQueuePresentKHR()` performs implicit waiting for GPU, making ANGLE's throttling uncessary (the serial is already finished). This fix allows running the tail call from `glFlush` and `glFinish` (because these APIs are not performance critical). Alternative solution may instead perform the CPU throttling immediately if the `WindowSurfaceVk::swapImpl()` is called from the `WindowSurfaceVk::onSharedPresentContextFlush()`. Additionally, added "ASSERT(!any())" at the beginning of each entry point. This is to catch scenarios, if some API adds the unlocked tail call and for some reason exit without checking the assert of running the call. Test: angle_end2end_tests --gtest_filter=EGLAndroidAutoRefreshTest.SwapCPUThrottling/ES3_Vulkan_NoFixture Bug: angleproject:42266581 Change-Id: I418c552f6e95b4cfc01db738c9989533377f1050 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/6063719 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Igor Nazarov <i.nazarov@samsung.com>