Loading libs/binder/rust/src/parcel.rs +1 −1 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ impl<'a> BorrowedParcel<'a> { { let start = self.get_data_position(); let parcelable_size: i32 = self.read()?; if parcelable_size < 0 { if parcelable_size < 4 { return Err(StatusCode::BAD_VALUE); } Loading services/gpuservice/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ cc_defaults { "libcutils", "libgfxstats", "libgpumem", "libgpuwork", "libgpumemtracer", "libgraphicsenv", "liblog", Loading services/gpuservice/GpuService.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <binder/PermissionCache.h> #include <cutils/properties.h> #include <gpumem/GpuMem.h> #include <gpuwork/GpuWork.h> #include <gpustats/GpuStats.h> #include <private/android_filesystem_config.h> #include <tracing/GpuMemTracer.h> Loading @@ -50,13 +51,20 @@ const char* const GpuService::SERVICE_NAME = "gpu"; GpuService::GpuService() : mGpuMem(std::make_shared<GpuMem>()), mGpuWork(std::make_shared<gpuwork::GpuWork>()), mGpuStats(std::make_unique<GpuStats>()), mGpuMemTracer(std::make_unique<GpuMemTracer>()) { std::thread asyncInitThread([this]() { std::thread gpuMemAsyncInitThread([this]() { mGpuMem->initialize(); mGpuMemTracer->initialize(mGpuMem); }); asyncInitThread.detach(); gpuMemAsyncInitThread.detach(); std::thread gpuWorkAsyncInitThread([this]() { mGpuWork->initialize(); }); gpuWorkAsyncInitThread.detach(); }; void GpuService::setGpuStats(const std::string& driverPackageName, Loading Loading @@ -124,6 +132,7 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto bool dumpDriverInfo = false; bool dumpMem = false; bool dumpStats = false; bool dumpWork = false; size_t numArgs = args.size(); if (numArgs) { Loading @@ -134,9 +143,11 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto dumpDriverInfo = true; } else if (args[index] == String16("--gpumem")) { dumpMem = true; } else if (args[index] == String16("--gpuwork")) { dumpWork = true; } } dumpAll = !(dumpDriverInfo || dumpMem || dumpStats); dumpAll = !(dumpDriverInfo || dumpMem || dumpStats || dumpWork); } if (dumpAll || dumpDriverInfo) { Loading @@ -151,6 +162,10 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto mGpuStats->dump(args, &result); result.append("\n"); } if (dumpAll || dumpWork) { mGpuWork->dump(args, &result); result.append("\n"); } } write(fd, result.c_str(), result.size()); Loading services/gpuservice/GpuService.h +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ namespace android { namespace gpuwork { class GpuWork; } class GpuMem; class GpuStats; class GpuMemTracer; Loading Loading @@ -77,6 +81,7 @@ private: * Attributes */ std::shared_ptr<GpuMem> mGpuMem; std::shared_ptr<gpuwork::GpuWork> mGpuWork; std::unique_ptr<GpuStats> mGpuStats; std::unique_ptr<GpuMemTracer> mGpuMemTracer; std::mutex mLock; Loading services/gpuservice/gpuwork/Android.bp 0 → 100644 +61 −0 Original line number Diff line number Diff line // Copyright 2022 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["frameworks_native_license"], } cc_library_shared { name: "libgpuwork", srcs: [ "GpuWork.cpp", ], header_libs: [ "gpu_work_structs", ], shared_libs: [ "libbase", "libbinder", "libbpf_bcc", "libbpf_android", "libcutils", "liblog", "libstatslog", "libstatspull", "libutils", ], export_include_dirs: [ "include", ], export_header_lib_headers: [ "gpu_work_structs", ], export_shared_lib_headers: [ "libbase", "libbpf_android", "libstatspull", ], cppflags: [ "-Wall", "-Werror", "-Wformat", "-Wthread-safety", "-Wunused", "-Wunreachable-code", ], required: [ "bpfloader", "gpu_work.o", ], } Loading
libs/binder/rust/src/parcel.rs +1 −1 Original line number Diff line number Diff line Loading @@ -496,7 +496,7 @@ impl<'a> BorrowedParcel<'a> { { let start = self.get_data_position(); let parcelable_size: i32 = self.read()?; if parcelable_size < 0 { if parcelable_size < 4 { return Err(StatusCode::BAD_VALUE); } Loading
services/gpuservice/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ cc_defaults { "libcutils", "libgfxstats", "libgpumem", "libgpuwork", "libgpumemtracer", "libgraphicsenv", "liblog", Loading
services/gpuservice/GpuService.cpp +18 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ #include <binder/PermissionCache.h> #include <cutils/properties.h> #include <gpumem/GpuMem.h> #include <gpuwork/GpuWork.h> #include <gpustats/GpuStats.h> #include <private/android_filesystem_config.h> #include <tracing/GpuMemTracer.h> Loading @@ -50,13 +51,20 @@ const char* const GpuService::SERVICE_NAME = "gpu"; GpuService::GpuService() : mGpuMem(std::make_shared<GpuMem>()), mGpuWork(std::make_shared<gpuwork::GpuWork>()), mGpuStats(std::make_unique<GpuStats>()), mGpuMemTracer(std::make_unique<GpuMemTracer>()) { std::thread asyncInitThread([this]() { std::thread gpuMemAsyncInitThread([this]() { mGpuMem->initialize(); mGpuMemTracer->initialize(mGpuMem); }); asyncInitThread.detach(); gpuMemAsyncInitThread.detach(); std::thread gpuWorkAsyncInitThread([this]() { mGpuWork->initialize(); }); gpuWorkAsyncInitThread.detach(); }; void GpuService::setGpuStats(const std::string& driverPackageName, Loading Loading @@ -124,6 +132,7 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto bool dumpDriverInfo = false; bool dumpMem = false; bool dumpStats = false; bool dumpWork = false; size_t numArgs = args.size(); if (numArgs) { Loading @@ -134,9 +143,11 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto dumpDriverInfo = true; } else if (args[index] == String16("--gpumem")) { dumpMem = true; } else if (args[index] == String16("--gpuwork")) { dumpWork = true; } } dumpAll = !(dumpDriverInfo || dumpMem || dumpStats); dumpAll = !(dumpDriverInfo || dumpMem || dumpStats || dumpWork); } if (dumpAll || dumpDriverInfo) { Loading @@ -151,6 +162,10 @@ status_t GpuService::doDump(int fd, const Vector<String16>& args, bool /*asProto mGpuStats->dump(args, &result); result.append("\n"); } if (dumpAll || dumpWork) { mGpuWork->dump(args, &result); result.append("\n"); } } write(fd, result.c_str(), result.size()); Loading
services/gpuservice/GpuService.h +5 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,10 @@ namespace android { namespace gpuwork { class GpuWork; } class GpuMem; class GpuStats; class GpuMemTracer; Loading Loading @@ -77,6 +81,7 @@ private: * Attributes */ std::shared_ptr<GpuMem> mGpuMem; std::shared_ptr<gpuwork::GpuWork> mGpuWork; std::unique_ptr<GpuStats> mGpuStats; std::unique_ptr<GpuMemTracer> mGpuMemTracer; std::mutex mLock; Loading
services/gpuservice/gpuwork/Android.bp 0 → 100644 +61 −0 Original line number Diff line number Diff line // Copyright 2022 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package { default_applicable_licenses: ["frameworks_native_license"], } cc_library_shared { name: "libgpuwork", srcs: [ "GpuWork.cpp", ], header_libs: [ "gpu_work_structs", ], shared_libs: [ "libbase", "libbinder", "libbpf_bcc", "libbpf_android", "libcutils", "liblog", "libstatslog", "libstatspull", "libutils", ], export_include_dirs: [ "include", ], export_header_lib_headers: [ "gpu_work_structs", ], export_shared_lib_headers: [ "libbase", "libbpf_android", "libstatspull", ], cppflags: [ "-Wall", "-Werror", "-Wformat", "-Wthread-safety", "-Wunused", "-Wunreachable-code", ], required: [ "bpfloader", "gpu_work.o", ], }