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 <binder/IInterface.h> 20 #include <cutils/compiler.h> 21 #include <graphicsenv/GpuStatsInfo.h> 22 23 #include <vector> 24 25 namespace android { 26 27 /* 28 * This class defines the Binder IPC interface for GPU-related queries and 29 * control. 30 */ 31 class IGpuService : public IInterface { 32 public: 33 DECLARE_META_INTERFACE(GpuService) 34 35 // set GPU stats from GraphicsEnvironment. 36 virtual void setGpuStats(const std::string& driverPackageName, 37 const std::string& driverVersionName, uint64_t driverVersionCode, 38 int64_t driverBuildTime, const std::string& appPackageName, 39 const int32_t vulkanVersion, GpuStatsInfo::Driver driver, 40 bool isDriverLoaded, int64_t driverLoadingTime) = 0; 41 42 // set target stats. 43 virtual void setTargetStats(const std::string& appPackageName, const uint64_t driverVersionCode, 44 const GpuStatsInfo::Stats stats, const uint64_t value = 0) = 0; 45 46 // setter and getter for updatable driver path. 47 virtual void setUpdatableDriverPath(const std::string& driverPath) = 0; 48 virtual std::string getUpdatableDriverPath() = 0; 49 }; 50 51 class BnGpuService : public BnInterface<IGpuService> { 52 public: 53 enum IGpuServiceTag { 54 SET_GPU_STATS = IBinder::FIRST_CALL_TRANSACTION, 55 SET_TARGET_STATS, 56 SET_UPDATABLE_DRIVER_PATH, 57 GET_UPDATABLE_DRIVER_PATH, 58 // Always append new enum to the end. 59 }; 60 61 status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply, 62 uint32_t flags = 0) override; 63 64 protected: 65 virtual status_t shellCommand(int in, int out, int err, std::vector<String16>& args) = 0; 66 }; 67 68 } // namespace android 69