| 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 |  | 
|  | 17 | #ifndef ANDROID_GPUSERVICE_H | 
|  | 18 | #define ANDROID_GPUSERVICE_H | 
|  | 19 |  | 
|  | 20 | #include <binder/IInterface.h> | 
|  | 21 | #include <cutils/compiler.h> | 
| Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 22 | #include <graphicsenv/IGpuService.h> | 
| Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 23 | #include <serviceutils/PriorityDumper.h> | 
| Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 24 |  | 
|  | 25 | #include <mutex> | 
|  | 26 | #include <vector> | 
| Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 27 |  | 
|  | 28 | namespace android { | 
|  | 29 |  | 
| Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 30 | class GpuService : public BnGpuService, public PriorityDumper { | 
| Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 31 | public: | 
|  | 32 | static const char* const SERVICE_NAME ANDROID_API; | 
|  | 33 |  | 
|  | 34 | GpuService() ANDROID_API; | 
|  | 35 |  | 
|  | 36 | protected: | 
| Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 37 | status_t shellCommand(int in, int out, int err, std::vector<String16>& args) override; | 
|  | 38 |  | 
|  | 39 | private: | 
| Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 40 | /* | 
|  | 41 | * IGpuService interface | 
|  | 42 | */ | 
| Greg Kaiser | 210bb7e | 2019-02-12 12:40:05 -0800 | [diff] [blame] | 43 | void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName, | 
| Yiwei Zhang | 96c0171 | 2019-02-19 16:00:25 -0800 | [diff] [blame] | 44 | uint64_t driverVersionCode, int64_t driverBuildTime, | 
| Yiwei Zhang | 512a723 | 2019-02-15 16:04:41 -0800 | [diff] [blame] | 45 | const std::string& appPackageName, GraphicsEnv::Driver driver, | 
|  | 46 | bool isDriverLoaded, int64_t driverLoadingTime); | 
| Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 47 |  | 
| Yiwei Zhang | bb4eaf6 | 2019-02-23 17:53:27 -0800 | [diff] [blame] | 48 | /* | 
|  | 49 | * IBinder interface | 
|  | 50 | */ | 
|  | 51 | status_t dump(int fd, const Vector<String16>& args) override { return priorityDump(fd, args); } | 
|  | 52 |  | 
|  | 53 | /* | 
|  | 54 | * Debugging & dumpsys | 
|  | 55 | */ | 
|  | 56 | status_t dumpCritical(int fd, const Vector<String16>& /*args*/, bool asProto) override { | 
|  | 57 | return doDump(fd, Vector<String16>(), asProto); | 
|  | 58 | } | 
|  | 59 |  | 
|  | 60 | status_t dumpAll(int fd, const Vector<String16>& args, bool asProto) override { | 
|  | 61 | return doDump(fd, args, asProto); | 
|  | 62 | } | 
|  | 63 |  | 
|  | 64 | status_t doDump(int fd, const Vector<String16>& args, bool asProto); | 
|  | 65 |  | 
|  | 66 | /* | 
|  | 67 | * Attributes | 
|  | 68 | */ | 
|  | 69 |  | 
| Yiwei Zhang | cb9d4e4 | 2019-02-06 20:22:59 -0800 | [diff] [blame] | 70 | // GpuStats access must be protected by mStateLock | 
|  | 71 | std::mutex mStateLock; | 
| Jesse Hall | fc038bd | 2016-03-26 22:20:22 -0700 | [diff] [blame] | 72 | }; | 
|  | 73 |  | 
|  | 74 | } // namespace android | 
|  | 75 |  | 
|  | 76 | #endif // ANDROID_GPUSERVICE_H |