diff options
| author | 2019-07-09 00:22:16 +0000 | |
|---|---|---|
| committer | 2019-07-09 00:22:16 +0000 | |
| commit | c11137b5e9c2068340bfa0035b7e82ef63b00a87 (patch) | |
| tree | d877d7403441d144f19953c484745b31a9955eb2 /vulkan/libvulkan | |
| parent | 5ae36f50d4794abd41ff9bedd4eef6d95bfb6da8 (diff) | |
| parent | 69395cd3ff5ef500c2b33991c2ab7284bc010ce9 (diff) | |
Merge "GpuStats: track Vulkan apps not doing pre-rotation correctly"
Diffstat (limited to 'vulkan/libvulkan')
| -rw-r--r-- | vulkan/libvulkan/swapchain.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp index 761d128d79..e5ac2de705 100644 --- a/vulkan/libvulkan/swapchain.cpp +++ b/vulkan/libvulkan/swapchain.cpp @@ -18,6 +18,7 @@ #include <android/hardware/graphics/common/1.0/types.h> #include <grallocusage/GrallocUsageConversion.h> +#include <graphicsenv/GraphicsEnv.h> #include <log/log.h> #include <sync/sync.h> #include <system/window.h> @@ -1253,6 +1254,15 @@ VkResult CreateSwapchainKHR(VkDevice device, return VK_ERROR_SURFACE_LOST_KHR; } + int transform_hint; + err = surface.window->query(surface.window.get(), + NATIVE_WINDOW_TRANSFORM_HINT, &transform_hint); + if (err != 0) { + ALOGE("NATIVE_WINDOW_TRANSFORM_HINT query failed: %s (%d)", + strerror(-err), err); + return VK_ERROR_SURFACE_LOST_KHR; + } + // -- Allocate our Swapchain object -- // After this point, we must deallocate the swapchain on error. @@ -1356,6 +1366,12 @@ VkResult CreateSwapchainKHR(VkDevice device, return result; } + if (transform_hint != swapchain->pre_transform) { + // Log that the app is not doing pre-rotation. + android::GraphicsEnv::getInstance().setTargetStats( + android::GpuStatsInfo::Stats::FALSE_PREROTATION); + } + surface.swapchain_handle = HandleFromSwapchain(swapchain); *swapchain_handle = surface.swapchain_handle; return VK_SUCCESS; |