blob: 0cf48bb80477712adb5b39b0481eb936463b6748 [file] [log] [blame]
Jesse Hallfc038bd2016-03-26 22:20:22 -07001/*
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 Zhangcb9d4e42019-02-06 20:22:59 -080022#include <graphicsenv/IGpuService.h>
Yiwei Zhangbb4eaf62019-02-23 17:53:27 -080023#include <serviceutils/PriorityDumper.h>
Yiwei Zhangcb9d4e42019-02-06 20:22:59 -080024
25#include <mutex>
26#include <vector>
Jesse Hallfc038bd2016-03-26 22:20:22 -070027
28namespace android {
29
Yiwei Zhang2d4c1882019-02-24 22:28:08 -080030class GpuStats;
31
Yiwei Zhangbb4eaf62019-02-23 17:53:27 -080032class GpuService : public BnGpuService, public PriorityDumper {
Jesse Hallfc038bd2016-03-26 22:20:22 -070033public:
34 static const char* const SERVICE_NAME ANDROID_API;
35
36 GpuService() ANDROID_API;
37
38protected:
Yiwei Zhangcb9d4e42019-02-06 20:22:59 -080039 status_t shellCommand(int in, int out, int err, std::vector<String16>& args) override;
40
41private:
Yiwei Zhangbb4eaf62019-02-23 17:53:27 -080042 /*
43 * IGpuService interface
44 */
Greg Kaiser210bb7e2019-02-12 12:40:05 -080045 void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName,
Yiwei Zhang96c01712019-02-19 16:00:25 -080046 uint64_t driverVersionCode, int64_t driverBuildTime,
Yiwei Zhang512a7232019-02-15 16:04:41 -080047 const std::string& appPackageName, GraphicsEnv::Driver driver,
48 bool isDriverLoaded, int64_t driverLoadingTime);
Yiwei Zhangcb9d4e42019-02-06 20:22:59 -080049
Yiwei Zhangbb4eaf62019-02-23 17:53:27 -080050 /*
51 * IBinder interface
52 */
53 status_t dump(int fd, const Vector<String16>& args) override { return priorityDump(fd, args); }
54
55 /*
56 * Debugging & dumpsys
57 */
58 status_t dumpCritical(int fd, const Vector<String16>& /*args*/, bool asProto) override {
59 return doDump(fd, Vector<String16>(), asProto);
60 }
61
62 status_t dumpAll(int fd, const Vector<String16>& args, bool asProto) override {
63 return doDump(fd, args, asProto);
64 }
65
66 status_t doDump(int fd, const Vector<String16>& args, bool asProto);
67
68 /*
69 * Attributes
70 */
Yiwei Zhang2d4c1882019-02-24 22:28:08 -080071 std::unique_ptr<GpuStats> mGpuStats;
Jesse Hallfc038bd2016-03-26 22:20:22 -070072};
73
74} // namespace android
75
76#endif // ANDROID_GPUSERVICE_H