summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-06-29 23:06:16 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-06-29 23:06:16 +0000
commit4b8a881132689abee2cafa3dd455a09d23393555 (patch)
tree65e2bb360e5ab0621f0f7b51f58aaab03426b7d2
parentdeead5ecbe2ce815b475fadadffdf97194db131e (diff)
parentab9e462966dfb738d9b4f00ed73ecbb8ad6c2df5 (diff)
downloadnative-4b8a881132689abee2cafa3dd455a09d23393555.tar.gz
Snap for 5698743 from ab9e462966dfb738d9b4f00ed73ecbb8ad6c2df5 to qt-release
Change-Id: Icb51f0d92e54a3b41893d61efeb7253ccfe5000a
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index 1c5fa52855..24b6c2d6de 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -37,6 +37,7 @@
#include <memory>
#include <string>
+#include <thread>
// TODO(b/37049319) Get this from a header once one exists
extern "C" {
@@ -163,17 +164,20 @@ void GraphicsEnv::setDriverPathAndSphalLibraries(const std::string path,
void GraphicsEnv::hintActivityLaunch() {
ATRACE_CALL();
- // If there's already graphics driver preloaded in the process, just send
- // the stats info to GpuStats directly through async binder.
- std::lock_guard<std::mutex> lock(mStatsLock);
- if (mGpuStats.glDriverToSend) {
- mGpuStats.glDriverToSend = false;
- sendGpuStatsLocked(GraphicsEnv::Api::API_GL, true, mGpuStats.glDriverLoadingTime);
- }
- if (mGpuStats.vkDriverToSend) {
- mGpuStats.vkDriverToSend = false;
- sendGpuStatsLocked(GraphicsEnv::Api::API_VK, true, mGpuStats.vkDriverLoadingTime);
- }
+ std::thread trySendGpuStatsThread([this]() {
+ // If there's already graphics driver preloaded in the process, just send
+ // the stats info to GpuStats directly through async binder.
+ std::lock_guard<std::mutex> lock(mStatsLock);
+ if (mGpuStats.glDriverToSend) {
+ mGpuStats.glDriverToSend = false;
+ sendGpuStatsLocked(GraphicsEnv::Api::API_GL, true, mGpuStats.glDriverLoadingTime);
+ }
+ if (mGpuStats.vkDriverToSend) {
+ mGpuStats.vkDriverToSend = false;
+ sendGpuStatsLocked(GraphicsEnv::Api::API_VK, true, mGpuStats.vkDriverLoadingTime);
+ }
+ });
+ trySendGpuStatsThread.detach();
}
void GraphicsEnv::setGpuStats(const std::string& driverPackageName,