Game Driver: plumb driver build date into GpuStats
Driver build date is used to track graphics driver age of the Android
ecosystem. This change also make the binder transaction async so that
both GL and Vulkan loaders won't be blocked by GpuStats module in the
GpuService.
Bug: 123156461
Test: Build, flash and boot. Verify the GpuService receiver side.
Change-Id: I89fd94613da2f5be7c28e5a5f8c3ec653f85cd2a
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index a07627a..386f9f0 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -158,6 +158,7 @@
void GraphicsEnv::setGpuStats(const std::string& driverPackageName,
const std::string& driverVersionName, uint64_t driverVersionCode,
+ const std::string& driverBuildDate,
const std::string& appPackageName) {
ATRACE_CALL();
@@ -166,13 +167,15 @@
"\tdriverPackageName[%s]\n"
"\tdriverVersionName[%s]\n"
"\tdriverVersionCode[%llu]\n"
+ "\tdriverBuildDate[%s]\n"
"\tappPackageName[%s]\n",
driverPackageName.c_str(), driverVersionName.c_str(),
- (unsigned long long)driverVersionCode, appPackageName.c_str());
+ (unsigned long long)driverVersionCode, driverBuildDate.c_str(), appPackageName.c_str());
mGpuStats.driverPackageName = driverPackageName;
mGpuStats.driverVersionName = driverVersionName;
mGpuStats.driverVersionCode = driverVersionCode;
+ mGpuStats.driverBuildDate = driverBuildDate;
mGpuStats.appPackageName = appPackageName;
}
@@ -262,19 +265,22 @@
"\tdriverPackageName[%s]\n"
"\tdriverVersionName[%s]\n"
"\tdriverVersionCode[%llu]\n"
+ "\tdriverBuildDate[%s]\n"
"\tappPackageName[%s]\n"
"\tdriver[%d]\n"
"\tisDriverLoaded[%d]\n"
"\tdriverLoadingTime[%lld]",
mGpuStats.driverPackageName.c_str(), mGpuStats.driverVersionName.c_str(),
- (unsigned long long)mGpuStats.driverVersionCode, mGpuStats.appPackageName.c_str(),
- static_cast<int32_t>(driver), isDriverLoaded, (long long)driverLoadingTime);
+ (unsigned long long)mGpuStats.driverVersionCode, mGpuStats.driverBuildDate.c_str(),
+ mGpuStats.appPackageName.c_str(), static_cast<int32_t>(driver), isDriverLoaded,
+ (long long)driverLoadingTime);
const sp<IGpuService> gpuService = getGpuService();
if (gpuService) {
gpuService->setGpuStats(mGpuStats.driverPackageName, mGpuStats.driverVersionName,
- mGpuStats.driverVersionCode, mGpuStats.appPackageName, driver,
- isDriverLoaded, driverLoadingTime);
+ mGpuStats.driverVersionCode, mGpuStats.driverBuildDate,
+ mGpuStats.appPackageName, driver, isDriverLoaded,
+ driverLoadingTime);
}
}
diff --git a/libs/graphicsenv/IGpuService.cpp b/libs/graphicsenv/IGpuService.cpp
index 2a57caf..a8a07c2 100644
--- a/libs/graphicsenv/IGpuService.cpp
+++ b/libs/graphicsenv/IGpuService.cpp
@@ -29,20 +29,22 @@
virtual void setGpuStats(const std::string& driverPackageName,
const std::string& driverVersionName, uint64_t driverVersionCode,
- const std::string& appPackageName, GraphicsEnv::Driver driver,
- bool isDriverLoaded, int64_t driverLoadingTime) {
+ const std::string& driverBuildDate, const std::string& appPackageName,
+ GraphicsEnv::Driver driver, bool isDriverLoaded,
+ int64_t driverLoadingTime) {
Parcel data, reply;
data.writeInterfaceToken(IGpuService::getInterfaceDescriptor());
data.writeUtf8AsUtf16(driverPackageName);
data.writeUtf8AsUtf16(driverVersionName);
data.writeUint64(driverVersionCode);
+ data.writeUtf8AsUtf16(driverBuildDate);
data.writeUtf8AsUtf16(appPackageName);
data.writeInt32(static_cast<int32_t>(driver));
data.writeBool(isDriverLoaded);
data.writeInt64(driverLoadingTime);
- remote()->transact(BnGpuService::SET_GPU_STATS, data, &reply);
+ remote()->transact(BnGpuService::SET_GPU_STATS, data, &reply, IBinder::FLAG_ONEWAY);
}
};
@@ -66,6 +68,9 @@
uint64_t driverVersionCode;
if ((status = data.readUint64(&driverVersionCode)) != OK) return status;
+ std::string driverBuildDate;
+ if ((status = data.readUtf8FromUtf16(&driverBuildDate)) != OK) return status;
+
std::string appPackageName;
if ((status = data.readUtf8FromUtf16(&appPackageName)) != OK) return status;
@@ -78,8 +83,8 @@
int64_t driverLoadingTime;
if ((status = data.readInt64(&driverLoadingTime)) != OK) return status;
- setGpuStats(driverPackageName, driverVersionName, driverVersionCode, appPackageName,
- static_cast<GraphicsEnv::Driver>(driver), isDriverLoaded,
+ setGpuStats(driverPackageName, driverVersionName, driverVersionCode, driverBuildDate,
+ appPackageName, static_cast<GraphicsEnv::Driver>(driver), isDriverLoaded,
driverLoadingTime);
return OK;
diff --git a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
index d88a5c1..20b0205 100644
--- a/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
+++ b/libs/graphicsenv/include/graphicsenv/GraphicsEnv.h
@@ -48,6 +48,7 @@
std::string driverPackageName;
std::string driverVersionName;
uint64_t driverVersionCode;
+ std::string driverBuildDate;
std::string appPackageName;
Driver glDriverToLoad;
Driver glDriverFallback;
@@ -58,6 +59,7 @@
: driverPackageName(""),
driverVersionName(""),
driverVersionCode(0),
+ driverBuildDate(""),
appPackageName(""),
glDriverToLoad(Driver::NONE),
glDriverFallback(Driver::NONE),
@@ -78,7 +80,8 @@
void setDriverPath(const std::string path);
android_namespace_t* getDriverNamespace();
void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName,
- uint64_t versionCode, const std::string& appPackageName);
+ uint64_t versionCode, const std::string& driverBuildDate,
+ const std::string& appPackageName);
void setDriverToLoad(Driver driver);
void setDriverLoaded(Api api, bool isDriverLoaded, int64_t driverLoadingTime);
void clearDriverLoadingInfo(Api api);
diff --git a/libs/graphicsenv/include/graphicsenv/IGpuService.h b/libs/graphicsenv/include/graphicsenv/IGpuService.h
index bfde76f..105a903 100644
--- a/libs/graphicsenv/include/graphicsenv/IGpuService.h
+++ b/libs/graphicsenv/include/graphicsenv/IGpuService.h
@@ -35,8 +35,9 @@
// set GPU stats from GraphicsEnvironment.
virtual void setGpuStats(const std::string& driverPackageName,
const std::string& driverVersionName, uint64_t driverVersionCode,
- const std::string& appPackageName, GraphicsEnv::Driver driver,
- bool isDriverLoaded, int64_t driverLoadingTime) = 0;
+ const std::string& driverBuildDate, const std::string& appPackageName,
+ GraphicsEnv::Driver driver, bool isDriverLoaded,
+ int64_t driverLoadingTime) = 0;
};
class BnGpuService : public BnInterface<IGpuService> {