Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 17 | #define ATRACE_TAG ATRACE_TAG_GRAPHICS |
| 18 | |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 19 | #include "gpuservice/GpuService.h" |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 20 | |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 21 | #include <android-base/stringprintf.h> |
Yuxin Hu | b69e988 | 2023-04-13 03:51:41 +0000 | [diff] [blame] | 22 | #include <android-base/properties.h> |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 23 | #include <binder/IPCThreadState.h> |
Jesse Hall | c0b1577 | 2016-12-20 14:47:45 -0800 | [diff] [blame] | 24 | #include <binder/IResultReceiver.h> |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 25 | #include <binder/Parcel.h> |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 26 | #include <binder/PermissionCache.h> |
Yiwei Zhang | 2a61c15 | 2019-02-27 11:27:18 -0800 | [diff] [blame] | 27 | #include <cutils/properties.h> |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 28 | #include <gpumem/GpuMem.h> |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 29 | #include <gpuwork/GpuWork.h> |
Yiwei Zhang | baaef88 | 2020-02-02 17:45:30 -0800 | [diff] [blame] | 30 | #include <gpustats/GpuStats.h> |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 31 | #include <private/android_filesystem_config.h> |
Adithya Srinivasan | b9f62d6 | 2020-06-18 11:28:12 -0700 | [diff] [blame] | 32 | #include <tracing/GpuMemTracer.h> |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 33 | #include <utils/String8.h> |
Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 34 | #include <utils/Trace.h> |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 35 | #include <vkjson.h> |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 36 | #include <vkprofiles.h> |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 37 | |
Yiwei Zhang | a265b40 | 2020-06-25 22:02:29 -0700 | [diff] [blame] | 38 | #include <thread> |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 39 | #include <memory> |
Yiwei Zhang | a265b40 | 2020-06-25 22:02:29 -0700 | [diff] [blame] | 40 | |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 41 | namespace android { |
| 42 | |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 43 | using base::StringAppendF; |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 44 | |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 45 | namespace { |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 46 | status_t cmdHelp(int out); |
| 47 | status_t cmdVkjson(int out, int err); |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 48 | status_t cmdVkprofiles(int out, int err); |
Yiwei Zhang | 2a61c15 | 2019-02-27 11:27:18 -0800 | [diff] [blame] | 49 | void dumpGameDriverInfo(std::string* result); |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 50 | } // namespace |
| 51 | |
| 52 | const String16 sDump("android.permission.DUMP"); |
Yuxin Hu | b69e988 | 2023-04-13 03:51:41 +0000 | [diff] [blame] | 53 | const String16 sAccessGpuServicePermission("android.permission.ACCESS_GPU_SERVICE"); |
| 54 | const std::string sAngleGlesDriverSuffix = "angle"; |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 55 | |
Yiwei Zhang | 423d080 | 2018-11-16 10:56:12 -0800 | [diff] [blame] | 56 | const char* const GpuService::SERVICE_NAME = "gpu"; |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 57 | |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 58 | GpuService::GpuService() |
Adithya Srinivasan | b9f62d6 | 2020-06-18 11:28:12 -0700 | [diff] [blame] | 59 | : mGpuMem(std::make_shared<GpuMem>()), |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 60 | mGpuWork(std::make_shared<gpuwork::GpuWork>()), |
Adithya Srinivasan | b9f62d6 | 2020-06-18 11:28:12 -0700 | [diff] [blame] | 61 | mGpuStats(std::make_unique<GpuStats>()), |
| 62 | mGpuMemTracer(std::make_unique<GpuMemTracer>()) { |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 63 | |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 64 | mGpuMemAsyncInitThread = std::make_unique<std::thread>([this] (){ |
Adithya Srinivasan | b9f62d6 | 2020-06-18 11:28:12 -0700 | [diff] [blame] | 65 | mGpuMem->initialize(); |
| 66 | mGpuMemTracer->initialize(mGpuMem); |
| 67 | }); |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 68 | |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 69 | mGpuWorkAsyncInitThread = std::make_unique<std::thread>([this]() { |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 70 | mGpuWork->initialize(); |
| 71 | }); |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 72 | }; |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 73 | |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 74 | GpuService::~GpuService() { |
Steven Moreland | 52361b4 | 2024-04-26 21:53:06 +0000 | [diff] [blame] | 75 | mGpuMem->stop(); |
| 76 | mGpuWork->stop(); |
| 77 | |
sergiuferentz | 3c00cbc | 2023-06-26 18:01:47 +0000 | [diff] [blame] | 78 | mGpuWorkAsyncInitThread->join(); |
| 79 | mGpuMemAsyncInitThread->join(); |
| 80 | } |
| 81 | |
Greg Kaiser | 210bb7e | 2019-02-12 12:40:05 -0800 | [diff] [blame] | 82 | void GpuService::setGpuStats(const std::string& driverPackageName, |
Yiwei Zhang | d986181 | 2019-02-13 11:51:55 -0800 | [diff] [blame] | 83 | const std::string& driverVersionName, uint64_t driverVersionCode, |
Yiwei Zhang | 96c0171 | 2019-02-19 16:00:25 -0800 | [diff] [blame] | 84 | int64_t driverBuildTime, const std::string& appPackageName, |
Yiwei Zhang | 27ab3ac | 2019-07-02 18:10:55 -0700 | [diff] [blame] | 85 | const int32_t vulkanVersion, GpuStatsInfo::Driver driver, |
Yiwei Zhang | 794d295 | 2019-05-06 17:43:59 -0700 | [diff] [blame] | 86 | bool isDriverLoaded, int64_t driverLoadingTime) { |
Yiwei Zhang | fdd7e78 | 2020-01-31 15:59:34 -0800 | [diff] [blame] | 87 | mGpuStats->insertDriverStats(driverPackageName, driverVersionName, driverVersionCode, |
| 88 | driverBuildTime, appPackageName, vulkanVersion, driver, |
| 89 | isDriverLoaded, driverLoadingTime); |
Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 90 | } |
| 91 | |
Yiwei Zhang | bcba411 | 2019-07-03 13:39:32 -0700 | [diff] [blame] | 92 | void GpuService::setTargetStats(const std::string& appPackageName, const uint64_t driverVersionCode, |
| 93 | const GpuStatsInfo::Stats stats, const uint64_t value) { |
| 94 | mGpuStats->insertTargetStats(appPackageName, driverVersionCode, stats, value); |
Yiwei Zhang | 8c5e3bd | 2019-05-09 14:34:19 -0700 | [diff] [blame] | 95 | } |
| 96 | |
Serdar Kocdemir | b2901c9 | 2022-11-17 00:39:05 +0000 | [diff] [blame] | 97 | void GpuService::setTargetStatsArray(const std::string& appPackageName, |
| 98 | const uint64_t driverVersionCode, const GpuStatsInfo::Stats stats, |
| 99 | const uint64_t* values, const uint32_t valueCount) { |
| 100 | mGpuStats->insertTargetStatsArray(appPackageName, driverVersionCode, stats, values, valueCount); |
| 101 | } |
| 102 | |
Tom Murphy | c23fcd0 | 2024-03-13 10:22:06 +0000 | [diff] [blame] | 103 | void GpuService::addVulkanEngineName(const std::string& appPackageName, |
| 104 | const uint64_t driverVersionCode, |
| 105 | const char* engineName) { |
| 106 | mGpuStats->addVulkanEngineName(appPackageName, driverVersionCode, engineName); |
| 107 | } |
| 108 | |
Yuxin Hu | b69e988 | 2023-04-13 03:51:41 +0000 | [diff] [blame] | 109 | void GpuService::toggleAngleAsSystemDriver(bool enabled) { |
| 110 | IPCThreadState* ipc = IPCThreadState::self(); |
| 111 | const int pid = ipc->getCallingPid(); |
| 112 | const int uid = ipc->getCallingUid(); |
| 113 | |
| 114 | // only system_server with the ACCESS_GPU_SERVICE permission is allowed to set |
| 115 | // persist.graphics.egl |
| 116 | if (uid != AID_SYSTEM || |
| 117 | !PermissionCache::checkPermission(sAccessGpuServicePermission, pid, uid)) { |
| 118 | ALOGE("Permission Denial: can't set persist.graphics.egl from setAngleAsSystemDriver() " |
| 119 | "pid=%d, uid=%d\n", pid, uid); |
| 120 | return; |
| 121 | } |
| 122 | |
| 123 | std::lock_guard<std::mutex> lock(mLock); |
| 124 | if (enabled) { |
| 125 | android::base::SetProperty("persist.graphics.egl", sAngleGlesDriverSuffix); |
| 126 | } else { |
| 127 | android::base::SetProperty("persist.graphics.egl", ""); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
Peiyong Lin | 0acbfdc | 2020-06-17 18:47:12 -0700 | [diff] [blame] | 132 | void GpuService::setUpdatableDriverPath(const std::string& driverPath) { |
Yiwei Zhang | c7cdd05 | 2020-07-28 23:11:21 -0700 | [diff] [blame] | 133 | IPCThreadState* ipc = IPCThreadState::self(); |
| 134 | const int pid = ipc->getCallingPid(); |
| 135 | const int uid = ipc->getCallingUid(); |
| 136 | |
| 137 | // only system_server is allowed to set updatable driver path |
| 138 | if (uid != AID_SYSTEM) { |
| 139 | ALOGE("Permission Denial: can't set updatable driver path from pid=%d, uid=%d\n", pid, uid); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | std::lock_guard<std::mutex> lock(mLock); |
| 144 | mDeveloperDriverPath = driverPath; |
Peiyong Lin | 0acbfdc | 2020-06-17 18:47:12 -0700 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | std::string GpuService::getUpdatableDriverPath() { |
Yiwei Zhang | c7cdd05 | 2020-07-28 23:11:21 -0700 | [diff] [blame] | 148 | std::lock_guard<std::mutex> lock(mLock); |
| 149 | return mDeveloperDriverPath; |
Peiyong Lin | 0acbfdc | 2020-06-17 18:47:12 -0700 | [diff] [blame] | 150 | } |
| 151 | |
Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 152 | status_t GpuService::shellCommand(int /*in*/, int out, int err, std::vector<String16>& args) { |
| 153 | ATRACE_CALL(); |
| 154 | |
| 155 | ALOGV("shellCommand"); |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 156 | for (size_t i = 0, n = args.size(); i < n; i++) |
Tomasz Wasilczyk | b19fe0c | 2023-08-11 00:06:51 +0000 | [diff] [blame] | 157 | ALOGV(" arg[%zu]: '%s'", i, String8(args[i]).c_str()); |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 158 | |
Jesse Hall | 3e26b13 | 2016-12-20 14:31:28 -0800 | [diff] [blame] | 159 | if (args.size() >= 1) { |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 160 | if (args[0] == String16("vkjson")) return cmdVkjson(out, err); |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 161 | if (args[0] == String16("vkprofiles")) return cmdVkprofiles(out, err); |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 162 | if (args[0] == String16("help")) return cmdHelp(out); |
Jesse Hall | 3e26b13 | 2016-12-20 14:31:28 -0800 | [diff] [blame] | 163 | } |
| 164 | // no command, or unrecognized command |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 165 | cmdHelp(err); |
Jesse Hall | 3e26b13 | 2016-12-20 14:31:28 -0800 | [diff] [blame] | 166 | return BAD_VALUE; |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 167 | } |
| 168 | |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 169 | status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto*/) { |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 170 | std::string result; |
| 171 | |
| 172 | IPCThreadState* ipc = IPCThreadState::self(); |
| 173 | const int pid = ipc->getCallingPid(); |
| 174 | const int uid = ipc->getCallingUid(); |
| 175 | |
| 176 | if ((uid != AID_SHELL) && !PermissionCache::checkPermission(sDump, pid, uid)) { |
| 177 | StringAppendF(&result, "Permission Denial: can't dump gpu from pid=%d, uid=%d\n", pid, uid); |
| 178 | } else { |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 179 | bool dumpAll = true; |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 180 | bool dumpDriverInfo = false; |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 181 | bool dumpMem = false; |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 182 | bool dumpStats = false; |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 183 | bool dumpWork = false; |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 184 | size_t numArgs = args.size(); |
| 185 | |
| 186 | if (numArgs) { |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 187 | for (size_t index = 0; index < numArgs; ++index) { |
| 188 | if (args[index] == String16("--gpustats")) { |
| 189 | dumpStats = true; |
| 190 | } else if (args[index] == String16("--gpudriverinfo")) { |
| 191 | dumpDriverInfo = true; |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 192 | } else if (args[index] == String16("--gpumem")) { |
| 193 | dumpMem = true; |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 194 | } else if (args[index] == String16("--gpuwork")) { |
| 195 | dumpWork = true; |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 196 | } |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 197 | } |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 198 | dumpAll = !(dumpDriverInfo || dumpMem || dumpStats || dumpWork); |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 199 | } |
| 200 | |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 201 | if (dumpAll || dumpDriverInfo) { |
Yiwei Zhang | 2a61c15 | 2019-02-27 11:27:18 -0800 | [diff] [blame] | 202 | dumpGameDriverInfo(&result); |
| 203 | result.append("\n"); |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 204 | } |
Yiwei Zhang | 252e5f6 | 2020-02-19 15:44:17 -0800 | [diff] [blame] | 205 | if (dumpAll || dumpMem) { |
| 206 | mGpuMem->dump(args, &result); |
| 207 | result.append("\n"); |
| 208 | } |
Mikael Pessa | 3d14605 | 2019-07-09 09:25:38 -0700 | [diff] [blame] | 209 | if (dumpAll || dumpStats) { |
Yiwei Zhang | 8cf7c7b | 2019-08-28 13:07:30 -0700 | [diff] [blame] | 210 | mGpuStats->dump(args, &result); |
Yiwei Zhang | 2a61c15 | 2019-02-27 11:27:18 -0800 | [diff] [blame] | 211 | result.append("\n"); |
Yiwei Zhang | 2d4c188 | 2019-02-24 22:28:08 -0800 | [diff] [blame] | 212 | } |
Paul Thomson | f44c6b8 | 2021-12-01 13:53:58 +0000 | [diff] [blame] | 213 | if (dumpAll || dumpWork) { |
| 214 | mGpuWork->dump(args, &result); |
| 215 | result.append("\n"); |
| 216 | } |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | write(fd, result.c_str(), result.size()); |
| 220 | return NO_ERROR; |
| 221 | } |
| 222 | |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 223 | namespace { |
| 224 | |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 225 | status_t cmdHelp(int out) { |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 226 | FILE* outs = fdopen(out, "w"); |
| 227 | if (!outs) { |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 228 | ALOGE("gpuservice: failed to create out stream: %s (%d)", strerror(errno), errno); |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 229 | return BAD_VALUE; |
| 230 | } |
| 231 | fprintf(outs, |
Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 232 | "GPU Service commands:\n" |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 233 | " vkjson dump Vulkan properties as JSON\n" |
| 234 | " vkprofiles print support for select Vulkan profiles\n"); |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 235 | fclose(outs); |
| 236 | return NO_ERROR; |
| 237 | } |
| 238 | |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 239 | status_t cmdVkjson(int out, int /*err*/) { |
| 240 | dprintf(out, "%s\n", VkJsonInstanceToJson(VkJsonGetInstance()).c_str()); |
| 241 | return NO_ERROR; |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 242 | } |
| 243 | |
Trevor David Black | f2b7c86 | 2024-02-15 23:12:22 +0000 | [diff] [blame] | 244 | status_t cmdVkprofiles(int out, int /*err*/) { |
| 245 | dprintf(out, "%s\n", android::vkprofiles::vkProfiles().c_str()); |
Jesse Hall | 3841bf4 | 2016-06-12 15:08:28 -0700 | [diff] [blame] | 246 | return NO_ERROR; |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 247 | } |
| 248 | |
Yiwei Zhang | 2a61c15 | 2019-02-27 11:27:18 -0800 | [diff] [blame] | 249 | void dumpGameDriverInfo(std::string* result) { |
| 250 | if (!result) return; |
| 251 | |
| 252 | char stableGameDriver[PROPERTY_VALUE_MAX] = {}; |
| 253 | property_get("ro.gfx.driver.0", stableGameDriver, "unsupported"); |
| 254 | StringAppendF(result, "Stable Game Driver: %s\n", stableGameDriver); |
| 255 | |
| 256 | char preReleaseGameDriver[PROPERTY_VALUE_MAX] = {}; |
| 257 | property_get("ro.gfx.driver.1", preReleaseGameDriver, "unsupported"); |
| 258 | StringAppendF(result, "Pre-release Game Driver: %s\n", preReleaseGameDriver); |
| 259 | } |
| 260 | |
Jesse Hall | 8b0d55e | 2016-03-31 19:29:36 -0700 | [diff] [blame] | 261 | } // anonymous namespace |
| 262 | |
Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 263 | } // namespace android |