| Yiwei Zhang | f40fb10 | 2019-02-27 21:05:06 -0800 | [diff] [blame] | 1 | /* | 
|  | 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 |  | 
|  | 24 | namespace 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 | */ | 
|  | 30 | class GpuStatsGlobalInfo : public Parcelable { | 
|  | 31 | public: | 
|  | 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 Zhang | 794d295 | 2019-05-06 17:43:59 -0700 | [diff] [blame] | 47 | int32_t vulkanVersion = 0; | 
| Yiwei Zhang | 174a2a0 | 2019-05-06 19:08:31 -0700 | [diff] [blame] | 48 | int32_t cpuVulkanVersion = 0; | 
|  | 49 | int32_t glesVersion = 0; | 
| Yiwei Zhang | 8e7c4b6 | 2019-05-08 15:57:59 -0700 | [diff] [blame] | 50 | int32_t angleLoadingCount = 0; | 
|  | 51 | int32_t angleLoadingFailureCount = 0; | 
| Yiwei Zhang | f40fb10 | 2019-02-27 21:05:06 -0800 | [diff] [blame] | 52 | }; | 
|  | 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 | */ | 
|  | 58 | class GpuStatsAppInfo : public Parcelable { | 
|  | 59 | public: | 
|  | 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 Zhang | 8e7c4b6 | 2019-05-08 15:57:59 -0700 | [diff] [blame] | 71 | std::vector<int64_t> angleDriverLoadingTime = {}; | 
| Yiwei Zhang | 8c5e3bd | 2019-05-09 14:34:19 -0700 | [diff] [blame] | 72 | bool cpuVulkanInUse = false; | 
| Yiwei Zhang | 69395cd | 2019-07-03 16:55:39 -0700 | [diff] [blame] | 73 | bool falsePrerotation = false; | 
| Yiwei Zhang | f40fb10 | 2019-02-27 21:05:06 -0800 | [diff] [blame] | 74 | }; | 
|  | 75 |  | 
| Yiwei Zhang | 27ab3ac | 2019-07-02 18:10:55 -0700 | [diff] [blame] | 76 | /* | 
|  | 77 | * class for holding the gpu stats in GraphicsEnv before sending to GpuService. | 
|  | 78 | */ | 
|  | 79 | class GpuStatsInfo { | 
|  | 80 | public: | 
|  | 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 Zhang | bcba411 | 2019-07-03 13:39:32 -0700 | [diff] [blame] | 95 | enum Stats { | 
|  | 96 | CPU_VULKAN_IN_USE = 0, | 
| Yiwei Zhang | 69395cd | 2019-07-03 16:55:39 -0700 | [diff] [blame] | 97 | FALSE_PREROTATION = 1, | 
| Yiwei Zhang | bcba411 | 2019-07-03 13:39:32 -0700 | [diff] [blame] | 98 | }; | 
|  | 99 |  | 
| Yiwei Zhang | 27ab3ac | 2019-07-02 18:10:55 -0700 | [diff] [blame] | 100 | 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 Zhang | f40fb10 | 2019-02-27 21:05:06 -0800 | [diff] [blame] | 120 | } // namespace android |