blob: 795965218959be3047affec2636cfd96410b4519 [file] [log] [blame]
Yiwei Zhangf40fb102019-02-27 21:05:06 -08001/*
2 * Copyright 2019 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#pragma once
18
19#include <string>
20#include <vector>
21
22#include <binder/Parcelable.h>
23
24namespace android {
25
26/*
27 * class for transporting gpu global stats from GpuService to authorized
28 * recipents. This class is intended to be a data container.
29 */
30class GpuStatsGlobalInfo : public Parcelable {
31public:
32 GpuStatsGlobalInfo() = default;
33 GpuStatsGlobalInfo(const GpuStatsGlobalInfo&) = default;
34 virtual ~GpuStatsGlobalInfo() = default;
35 virtual status_t writeToParcel(Parcel* parcel) const;
36 virtual status_t readFromParcel(const Parcel* parcel);
37 std::string toString() const;
38
39 std::string driverPackageName = "";
40 std::string driverVersionName = "";
41 uint64_t driverVersionCode = 0;
42 int64_t driverBuildTime = 0;
43 int32_t glLoadingCount = 0;
44 int32_t glLoadingFailureCount = 0;
45 int32_t vkLoadingCount = 0;
46 int32_t vkLoadingFailureCount = 0;
Yiwei Zhang794d2952019-05-06 17:43:59 -070047 int32_t vulkanVersion = 0;
Yiwei Zhang174a2a02019-05-06 19:08:31 -070048 int32_t cpuVulkanVersion = 0;
49 int32_t glesVersion = 0;
Yiwei Zhang8e7c4b62019-05-08 15:57:59 -070050 int32_t angleLoadingCount = 0;
51 int32_t angleLoadingFailureCount = 0;
Yiwei Zhangf40fb102019-02-27 21:05:06 -080052};
53
54/*
55 * class for transporting gpu app stats from GpuService to authorized recipents.
56 * This class is intended to be a data container.
57 */
58class GpuStatsAppInfo : public Parcelable {
59public:
60 GpuStatsAppInfo() = default;
61 GpuStatsAppInfo(const GpuStatsAppInfo&) = default;
62 virtual ~GpuStatsAppInfo() = default;
63 virtual status_t writeToParcel(Parcel* parcel) const;
64 virtual status_t readFromParcel(const Parcel* parcel);
65 std::string toString() const;
66
67 std::string appPackageName = "";
68 uint64_t driverVersionCode = 0;
69 std::vector<int64_t> glDriverLoadingTime = {};
70 std::vector<int64_t> vkDriverLoadingTime = {};
Yiwei Zhang8e7c4b62019-05-08 15:57:59 -070071 std::vector<int64_t> angleDriverLoadingTime = {};
Yiwei Zhang8c5e3bd2019-05-09 14:34:19 -070072 bool cpuVulkanInUse = false;
Yiwei Zhang69395cd2019-07-03 16:55:39 -070073 bool falsePrerotation = false;
Yiwei Zhangf40fb102019-02-27 21:05:06 -080074};
75
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -070076/*
77 * class for holding the gpu stats in GraphicsEnv before sending to GpuService.
78 */
79class GpuStatsInfo {
80public:
81 enum Api {
82 API_GL = 0,
83 API_VK = 1,
84 };
85
86 enum Driver {
87 NONE = 0,
88 GL = 1,
89 GL_UPDATED = 2,
90 VULKAN = 3,
91 VULKAN_UPDATED = 4,
92 ANGLE = 5,
93 };
94
Yiwei Zhangbcba4112019-07-03 13:39:32 -070095 enum Stats {
96 CPU_VULKAN_IN_USE = 0,
Yiwei Zhang69395cd2019-07-03 16:55:39 -070097 FALSE_PREROTATION = 1,
Yiwei Zhangbcba4112019-07-03 13:39:32 -070098 };
99
Yiwei Zhang27ab3ac2019-07-02 18:10:55 -0700100 GpuStatsInfo() = default;
101 GpuStatsInfo(const GpuStatsInfo&) = default;
102 virtual ~GpuStatsInfo() = default;
103
104 std::string driverPackageName = "";
105 std::string driverVersionName = "";
106 uint64_t driverVersionCode = 0;
107 int64_t driverBuildTime = 0;
108 std::string appPackageName = "";
109 int32_t vulkanVersion = 0;
110 Driver glDriverToLoad = Driver::NONE;
111 Driver glDriverFallback = Driver::NONE;
112 Driver vkDriverToLoad = Driver::NONE;
113 Driver vkDriverFallback = Driver::NONE;
114 bool glDriverToSend = false;
115 bool vkDriverToSend = false;
116 int64_t glDriverLoadingTime = 0;
117 int64_t vkDriverLoadingTime = 0;
118};
119
Yiwei Zhangf40fb102019-02-27 21:05:06 -0800120} // namespace android