From c4acf5130b3b226e66d2d9b7dd70d42c8244b6fa Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Fri, 18 Feb 2022 17:11:59 -0800 Subject: SF: remove IComposer.dumpDebugInfo aidl already have a dump funciton, so there is no need to expose a custom dumpDebugInfo from IComposer. Bug: 220171623 Test: atest VtsHalGraphicsComposer3_TargetTest Test: adb shell dumpsys SurfaceFlinger Test: adb shell dumpsys android.hardware.graphics.composer3.IComposer/default Change-Id: Ifaf91e74b01230c5926fc43619cada80deaa1630 --- .../DisplayHardware/AidlComposerHal.cpp | 25 +++++++++++++++++----- services/surfaceflinger/SurfaceFlinger.cpp | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp index 8d679540e8..b2d7a7a47d 100644 --- a/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp +++ b/services/surfaceflinger/DisplayHardware/AidlComposerHal.cpp @@ -20,6 +20,7 @@ #include "AidlComposerHal.h" +#include #include #include #include @@ -262,13 +263,27 @@ std::vector AidlComposer::getCapabilities() { } std::string AidlComposer::dumpDebugInfo() { - std::string info; - const auto status = mAidlComposer->dumpDebugInfo(&info); - if (!status.isOk()) { - ALOGE("dumpDebugInfo failed %s", status.getDescription().c_str()); + int pipefds[2]; + int result = pipe(pipefds); + if (result < 0) { + ALOGE("dumpDebugInfo: pipe failed: %s", strerror(errno)); return {}; } - return info; + + std::string str; + const auto status = mAidlComposer->dump(pipefds[1], /*args*/ nullptr, /*numArgs*/ 0); + // Close the write-end of the pipe to make sure that when reading from the + // read-end we will get eof instead of blocking forever + close(pipefds[1]); + + if (status == STATUS_OK) { + base::ReadFdToString(pipefds[0], &str); + } else { + ALOGE("dumpDebugInfo: dump failed: %d", status); + } + + close(pipefds[0]); + return str; } void AidlComposer::registerCallback(HWC2::ComposerCallback& callback) { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 59c07b6db1..4e5e6aaa3d 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -5341,7 +5341,7 @@ void SurfaceFlinger::dumpAllLocked(const DumpArgs& args, std::string& result) co colorizer.reset(result); const bool hwcDisabled = mDebugDisableHWC || mDebugFlashDelay; StringAppendF(&result, " h/w composer %s\n", hwcDisabled ? "disabled" : "enabled"); - getHwComposer().dump(result); + dumpHwc(result); /* * Dump gralloc state -- cgit v1.2.3-59-g8ed1b