summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pierre Barbier de Reuille <pbdr@google.com> 2025-03-14 18:46:53 +0000
committer Pierre Barbier de Reuille <pbdr@google.com> 2025-03-17 15:22:57 +0000
commitbbf76c3ef97cb87b927c0ecb3417aa34534131ce (patch)
tree98324305e17fade3b480f82ea31038ada53c4e1d
parente70697374929b68afcd14561a0b2a3290050bd0d (diff)
Print display ids of Virtual Displays too
This impact the output of `dumpsys SurfaceFlinger --display-id`. Note: this will output the ids of the same displays than `dumpsys SurfaceFlinger --displays`. Similar to that command, phyical displays will be enumerated first. Fix: 403588742 Flag: EXEMPT (small change in dumpsys) Test: build and run with an overlay Change-Id: I176b0894c3dd4fc2ecd30809ed117b87464f8d85
-rw-r--r--services/surfaceflinger/Display/VirtualDisplaySnapshot.h1
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp20
2 files changed, 18 insertions, 3 deletions
diff --git a/services/surfaceflinger/Display/VirtualDisplaySnapshot.h b/services/surfaceflinger/Display/VirtualDisplaySnapshot.h
index c68020ce51..71d9f2e468 100644
--- a/services/surfaceflinger/Display/VirtualDisplaySnapshot.h
+++ b/services/surfaceflinger/Display/VirtualDisplaySnapshot.h
@@ -35,6 +35,7 @@ public:
VirtualDisplayId displayId() const { return mVirtualId; }
bool isGpu() const { return mIsGpu; }
+ const std::string& uniqueId() const { return mUniqueId; }
void dump(utils::Dumper& dumper) const {
using namespace std::string_view_literals;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index aa933ee8a7..eeac8e1d2d 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6123,9 +6123,8 @@ void SurfaceFlinger::dumpDisplays(std::string& result) const {
display->dump(dumper);
std::lock_guard lock(mVirtualDisplaysMutex);
- const auto virtualSnapshotIt = mVirtualDisplays.find(virtualId);
- if (virtualSnapshotIt != mVirtualDisplays.end()) {
- virtualSnapshotIt->second.dump(dumper);
+ if (const auto snapshotOpt = mVirtualDisplays.get(virtualId)) {
+ snapshotOpt->get().dump(dumper);
}
}
}
@@ -6137,6 +6136,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
if (!displayId) {
continue;
}
+
const auto hwcDisplayId = getHwComposer().fromPhysicalDisplayId(*displayId);
if (!hwcDisplayId) {
continue;
@@ -6145,6 +6145,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
StringAppendF(&result,
"Display %s (HWC display %" PRIu64 "): ", to_string(*displayId).c_str(),
*hwcDisplayId);
+
uint8_t port;
DisplayIdentificationData data;
if (!getHwComposer().getDisplayIdentificationData(*hwcDisplayId, &port, &data)) {
@@ -6172,6 +6173,19 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
result.append(edid->displayName.data(), edid->displayName.length());
result.append("\"\n");
}
+
+ for (const auto& [token, display] : mDisplays) {
+ const auto virtualDisplayId = asVirtualDisplayId(display->getDisplayIdVariant());
+ if (virtualDisplayId) {
+ StringAppendF(&result, "Display %s (Virtual display): displayName=\"%s\"",
+ to_string(*virtualDisplayId).c_str(), display->getDisplayName().c_str());
+ std::lock_guard lock(mVirtualDisplaysMutex);
+ if (const auto snapshotOpt = mVirtualDisplays.get(*virtualDisplayId)) {
+ StringAppendF(&result, " uniqueId=\"%s\"", snapshotOpt->get().uniqueId().c_str());
+ }
+ result.append("\n");
+ }
+ }
}
void SurfaceFlinger::dumpRawDisplayIdentificationData(const DumpArgs& args,