summaryrefslogtreecommitdiff
path: root/libs/graphicsenv/GraphicsEnv.cpp
diff options
context:
space:
mode:
author Yiwei Zhang <zzyiwei@google.com> 2019-05-09 14:34:19 -0700
committer Yiwei Zhang <zzyiwei@google.com> 2019-05-09 23:46:39 +0000
commit8c5e3bde15a3d4c09d002a2d53de39c45528e2c9 (patch)
tree10b25a38af3d27017b966869f8fe24456d2501ac /libs/graphicsenv/GraphicsEnv.cpp
parent6dec1db01247a00564e433ac2ff904e3d0ccac2c (diff)
GpuStats: track CPU Vulkan implementation usage
Bug: 131927737 Test: test on both GPU and CPU Vulkan implementations Change-Id: I36de47e14cd132a779d9f39fdc19325d4772bb9a
Diffstat (limited to 'libs/graphicsenv/GraphicsEnv.cpp')
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 2f84f86431..407f77d88b 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -263,6 +263,17 @@ static sp<IGpuService> getGpuService() {
return interface_cast<IGpuService>(binder);
}
+void GraphicsEnv::setCpuVulkanInUse() {
+ ATRACE_CALL();
+
+ // Use the same stats lock to protect getGpuService() as well.
+ std::lock_guard<std::mutex> lock(mStatsLock);
+ const sp<IGpuService> gpuService = getGpuService();
+ if (gpuService) {
+ gpuService->setCpuVulkanInUse(mGpuStats.appPackageName, mGpuStats.driverVersionCode);
+ }
+}
+
void GraphicsEnv::sendGpuStatsLocked(GraphicsEnv::Api api, bool isDriverLoaded,
int64_t driverLoadingTime) {
ATRACE_CALL();