summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xservices/surfaceflinger/SurfaceFlinger.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index f08d8489cd..80b92b2aa5 100755
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3963,7 +3963,7 @@ void SurfaceFlinger::processDisplayChanged(const wp<IBinder>& displayToken,
if ((currentState.orientation != drawingState.orientation) ||
(currentState.layerStackSpaceRect != drawingState.layerStackSpaceRect) ||
(currentState.orientedDisplaySpaceRect != drawingState.orientedDisplaySpaceRect)) {
- if (mUseFbScaling && display->isPrimary()) {
+ if (mUseFbScaling && display->isPrimary() && display->isPoweredOn()) {
const ssize_t index = mCurrentState.displays.indexOfKey(displayToken);
DisplayDeviceState& curState = mCurrentState.displays.editValueAt(index);
setFrameBufferSizeForScaling(display, curState, drawingState);
@@ -4003,33 +4003,29 @@ void SurfaceFlinger::setFrameBufferSizeForScaling(sp<DisplayDevice> displayDevic
auto display = displayDevice->getCompositionDisplay();
int newWidth = currentState.layerStackSpaceRect.width();
int newHeight = currentState.layerStackSpaceRect.height();
- int currentWidth = drawingState.layerStackSpaceRect.width();
- int currentHeight = drawingState.layerStackSpaceRect.height();
int displayWidth = displayDevice->getWidth();
int displayHeight = displayDevice->getHeight();
- bool update_needed = false;
- if (newWidth != currentWidth || newHeight != currentHeight) {
- update_needed = true;
+ if (newWidth != displayWidth || newHeight != displayHeight) {
if (!((newWidth > newHeight && displayWidth > displayHeight) ||
(newWidth < newHeight && displayWidth < displayHeight))) {
std::swap(newWidth, newHeight);
}
}
- if (displayDevice->getWidth() == newWidth && displayDevice->getHeight() == newHeight &&
- !update_needed) {
- displayDevice->setProjection(currentState.orientation, currentState.layerStackSpaceRect,
- currentState.orientedDisplaySpaceRect);
- return;
- }
-
if (newWidth > 0 && newHeight > 0) {
currentState.width = newWidth;
currentState.height = newHeight;
}
+
currentState.orientedDisplaySpaceRect = currentState.layerStackSpaceRect;
+ if (displayWidth == newWidth && displayHeight == newHeight) {
+ displayDevice->setProjection(currentState.orientation, currentState.layerStackSpaceRect,
+ currentState.orientedDisplaySpaceRect);
+ return;
+ }
+
if (mBootStage == BootStage::FINISHED) {
displayDevice->setDisplaySize(currentState.width, currentState.height);
displayDevice->setProjection(currentState.orientation, currentState.layerStackSpaceRect,