Tell HWComposer the dimensions of virtual displays
HWComposer queries the HWC for dimensions of physical displays, but
can't do that for virtual displays. The dimensions are used to set the
display frame of the framebuffer target layer passed to HWC, and
implicitly the dimensions of the virtual display.
Bug: 8316155
Change-Id: I9cbd2530d2fa878f86128a1472def520b5d694a5
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9102f5c..a4426cd 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1187,8 +1187,15 @@
state.viewport, state.frame);
hw->setDisplayName(state.displayName);
mDisplays.add(display, hw);
- if (state.type < DisplayDevice::NUM_DISPLAY_TYPES)
+ if (state.isVirtualDisplay()) {
+ if (hwcDisplayId >= 0) {
+ mHwc->setVirtualDisplayProperties(hwcDisplayId,
+ hw->getWidth(), hw->getHeight(),
+ hw->getFormat());
+ }
+ } else {
mEventThread->onHotplugReceived(state.type, true);
+ }
}
}
}