Remove internal display related methods
SurfaceFlinger and SurfaceComposerClient simply return the first
connected display as internal display, which is not really correct.
In particular,in the case of dual display for foldable devices, both
displays are marked as Internal determined by calling into HWC2
IComposerClient::getDisplayConnectionType().
Therefore, the concept of internal/external/primary displays is removed
from SurfaceFlinger, and the display manager is the better place to
handle the logics.
flatland is modified to take an extra argument to specify display id,
and error occurs if no display is specified in case of multi-display.
Bug: 241285477
Bug: 242763577
Bug: 74619554
Test: atest libgui_test libsurfaceflinger_unittest SurfaceFlinger_test
Change-Id: Ib6c7e502ef3269c2c60a4e5388e5ac75275f87ed
diff --git a/libs/renderengine/benchmark/RenderEngineBench.cpp b/libs/renderengine/benchmark/RenderEngineBench.cpp
index 739f3fa..d44eb46 100644
--- a/libs/renderengine/benchmark/RenderEngineBench.cpp
+++ b/libs/renderengine/benchmark/RenderEngineBench.cpp
@@ -80,16 +80,26 @@
std::once_flag once;
std::call_once(once, []() {
auto surfaceComposerClient = SurfaceComposerClient::getDefault();
- auto displayToken = surfaceComposerClient->getInternalDisplayToken();
- ui::DisplayMode displayMode;
- if (surfaceComposerClient->getActiveDisplayMode(displayToken, &displayMode) < 0) {
- LOG_ALWAYS_FATAL("Failed to get active display mode!");
+ auto ids = SurfaceComposerClient::getPhysicalDisplayIds();
+ LOG_ALWAYS_FATAL_IF(ids.empty(), "Failed to get any display!");
+ ui::Size resolution = ui::kEmptySize;
+ // find the largest display resolution
+ for (auto id : ids) {
+ auto displayToken = surfaceComposerClient->getPhysicalDisplayToken(id);
+ ui::DisplayMode displayMode;
+ if (surfaceComposerClient->getActiveDisplayMode(displayToken, &displayMode) < 0) {
+ LOG_ALWAYS_FATAL("Failed to get active display mode!");
+ }
+ auto tw = displayMode.resolution.width;
+ auto th = displayMode.resolution.height;
+ LOG_ALWAYS_FATAL_IF(tw <= 0 || th <= 0, "Invalid display size!");
+ if (resolution.width * resolution.height <
+ displayMode.resolution.width * displayMode.resolution.height) {
+ resolution = displayMode.resolution;
+ }
}
- auto w = displayMode.resolution.width;
- auto h = displayMode.resolution.height;
- LOG_ALWAYS_FATAL_IF(w <= 0 || h <= 0, "Invalid display size!");
- width = static_cast<uint32_t>(w);
- height = static_cast<uint32_t>(h);
+ width = static_cast<uint32_t>(resolution.width);
+ height = static_cast<uint32_t>(resolution.height);
});
return std::pair<uint32_t, uint32_t>(width, height);
}