From 69395cd3ff5ef500c2b33991c2ab7284bc010ce9 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 3 Jul 2019 16:55:39 -0700 Subject: GpuStats: track Vulkan apps not doing pre-rotation correctly Bug: 135210726 Test: adb shell dumpsys gpu Change-Id: Iff15f0d486b74ca700c12cd960b839ddccebc112 --- vulkan/libvulkan/swapchain.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'vulkan/libvulkan') 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 #include +#include #include #include #include @@ -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; -- cgit v1.2.3-59-g8ed1b