Skip to content

Commit 4c54b76

Browse files
PierreBdR-googleAndroid (Google) Code Review
authored andcommitted
Merge "Print display ids of Virtual Displays too" into main
2 parents bb68497 + bbf76c3 commit 4c54b76

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

services/surfaceflinger/Display/VirtualDisplaySnapshot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class VirtualDisplaySnapshot {
3535

3636
VirtualDisplayId displayId() const { return mVirtualId; }
3737
bool isGpu() const { return mIsGpu; }
38+
const std::string& uniqueId() const { return mUniqueId; }
3839

3940
void dump(utils::Dumper& dumper) const {
4041
using namespace std::string_view_literals;

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6123,9 +6123,8 @@ void SurfaceFlinger::dumpDisplays(std::string& result) const {
61236123
display->dump(dumper);
61246124

61256125
std::lock_guard lock(mVirtualDisplaysMutex);
6126-
const auto virtualSnapshotIt = mVirtualDisplays.find(virtualId);
6127-
if (virtualSnapshotIt != mVirtualDisplays.end()) {
6128-
virtualSnapshotIt->second.dump(dumper);
6126+
if (const auto snapshotOpt = mVirtualDisplays.get(virtualId)) {
6127+
snapshotOpt->get().dump(dumper);
61296128
}
61306129
}
61316130
}
@@ -6137,6 +6136,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
61376136
if (!displayId) {
61386137
continue;
61396138
}
6139+
61406140
const auto hwcDisplayId = getHwComposer().fromPhysicalDisplayId(*displayId);
61416141
if (!hwcDisplayId) {
61426142
continue;
@@ -6145,6 +6145,7 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
61456145
StringAppendF(&result,
61466146
"Display %s (HWC display %" PRIu64 "): ", to_string(*displayId).c_str(),
61476147
*hwcDisplayId);
6148+
61486149
uint8_t port;
61496150
DisplayIdentificationData data;
61506151
if (!getHwComposer().getDisplayIdentificationData(*hwcDisplayId, &port, &data)) {
@@ -6172,6 +6173,19 @@ void SurfaceFlinger::dumpDisplayIdentificationData(std::string& result) const {
61726173
result.append(edid->displayName.data(), edid->displayName.length());
61736174
result.append("\"\n");
61746175
}
6176+
6177+
for (const auto& [token, display] : mDisplays) {
6178+
const auto virtualDisplayId = asVirtualDisplayId(display->getDisplayIdVariant());
6179+
if (virtualDisplayId) {
6180+
StringAppendF(&result, "Display %s (Virtual display): displayName=\"%s\"",
6181+
to_string(*virtualDisplayId).c_str(), display->getDisplayName().c_str());
6182+
std::lock_guard lock(mVirtualDisplaysMutex);
6183+
if (const auto snapshotOpt = mVirtualDisplays.get(*virtualDisplayId)) {
6184+
StringAppendF(&result, " uniqueId=\"%s\"", snapshotOpt->get().uniqueId().c_str());
6185+
}
6186+
result.append("\n");
6187+
}
6188+
}
61756189
}
61766190

61776191
void SurfaceFlinger::dumpRawDisplayIdentificationData(const DumpArgs& args,

0 commit comments

Comments
 (0)