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; 47 int32_t vulkanVersion = 0; 48 int32_t cpuVulkanVersion = 0; 49 int32_t glesVersion = 0; 50 int32_t angleLoadingCount = 0; 51 int32_t angleLoadingFailureCount = 0; 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 = {}; 71 std::vector<int64_t> angleDriverLoadingTime = {}; 72 bool cpuVulkanInUse = false; 73 bool falsePrerotation = false; 74 bool gles1InUse = false; 75 }; 76 77 /* 78 * class for holding the gpu stats in GraphicsEnv before sending to GpuService. 79 */ 80 class GpuStatsInfo { 81 public: 82 enum Api { 83 API_GL = 0, 84 API_VK = 1, 85 }; 86 87 enum Driver { 88 NONE = 0, 89 GL = 1, 90 GL_UPDATED = 2, 91 VULKAN = 3, 92 VULKAN_UPDATED = 4, 93 ANGLE = 5, 94 }; 95 96 enum Stats { 97 CPU_VULKAN_IN_USE = 0, 98 FALSE_PREROTATION = 1, 99 GLES_1_IN_USE = 2, 100 }; 101 102 GpuStatsInfo() = default; 103 GpuStatsInfo(const GpuStatsInfo&) = default; 104 virtual ~GpuStatsInfo() = default; 105 106 std::string driverPackageName = ""; 107 std::string driverVersionName = ""; 108 uint64_t driverVersionCode = 0; 109 int64_t driverBuildTime = 0; 110 std::string appPackageName = ""; 111 int32_t vulkanVersion = 0; 112 Driver glDriverToLoad = Driver::NONE; 113 Driver glDriverFallback = Driver::NONE; 114 Driver vkDriverToLoad = Driver::NONE; 115 Driver vkDriverFallback = Driver::NONE; 116 bool glDriverToSend = false; 117 bool vkDriverToSend = false; 118 int64_t glDriverLoadingTime = 0; 119 int64_t vkDriverLoadingTime = 0; 120 }; 121 122 } // namespace android 123