GpuService.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  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. #ifndef ANDROID_GPUSERVICE_H
  17. #define ANDROID_GPUSERVICE_H
  18. #include <binder/IInterface.h>
  19. #include <cutils/compiler.h>
  20. #include <graphicsenv/GpuStatsInfo.h>
  21. #include <graphicsenv/IGpuService.h>
  22. #include <serviceutils/PriorityDumper.h>
  23. #include <mutex>
  24. #include <vector>
  25. namespace android {
  26. class GpuStats;
  27. class GpuService : public BnGpuService, public PriorityDumper {
  28. public:
  29. static const char* const SERVICE_NAME ANDROID_API;
  30. GpuService() ANDROID_API;
  31. protected:
  32. status_t shellCommand(int in, int out, int err, std::vector<String16>& args) override;
  33. private:
  34. /*
  35. * IGpuService interface
  36. */
  37. void setGpuStats(const std::string& driverPackageName, const std::string& driverVersionName,
  38. uint64_t driverVersionCode, int64_t driverBuildTime,
  39. const std::string& appPackageName, const int32_t vulkanVersion,
  40. GraphicsEnv::Driver driver, bool isDriverLoaded,
  41. int64_t driverLoadingTime) override;
  42. status_t getGpuStatsGlobalInfo(std::vector<GpuStatsGlobalInfo>* outStats) const override;
  43. status_t getGpuStatsAppInfo(std::vector<GpuStatsAppInfo>* outStats) const override;
  44. void setTargetStats(const std::string& appPackageName, const uint64_t driverVersionCode,
  45. const GraphicsEnv::Stats stats, const uint64_t value) override;
  46. /*
  47. * IBinder interface
  48. */
  49. status_t dump(int fd, const Vector<String16>& args) override { return priorityDump(fd, args); }
  50. /*
  51. * Debugging & dumpsys
  52. */
  53. status_t dumpCritical(int fd, const Vector<String16>& /*args*/, bool asProto) override {
  54. return doDump(fd, Vector<String16>(), asProto);
  55. }
  56. status_t dumpAll(int fd, const Vector<String16>& args, bool asProto) override {
  57. return doDump(fd, args, asProto);
  58. }
  59. status_t doDump(int fd, const Vector<String16>& args, bool asProto);
  60. /*
  61. * Attributes
  62. */
  63. std::unique_ptr<GpuStats> mGpuStats;
  64. };
  65. } // namespace android
  66. #endif // ANDROID_GPUSERVICE_H