From 91d25932b6651b20159a737da6140cf8a6aaaf08 Mon Sep 17 00:00:00 2001 From: Chet Haase Date: Thu, 11 Apr 2013 15:24:55 -0700 Subject: [PATCH] DO NOT MERGE Make sure surfaces always have latest orientation info When the screen is turned off, the current stack is set to -1. This causes logic in iSurfaceFlinger's handleTransactionLocked() function to fail to match the current stack, and the latest orientation is not set into the layer. This causes BufferQueue, later, to potentially set an obsolete transformHint on a created surface (such as in the case with ImageWallpaper's Egl surface, in the bug below). The fix is to note this situation and use a default value for the DisplayDevice, which should have the current orientation information. Issue #8508397 ImageWallpaper sometimes rendered in wrong orientation causing a ~30-40% drop in graphics performance Change-Id: Ibae15d73b289a8343c67f4f6bb77fdf11dd95ee7 --- services/surfaceflinger/SurfaceFlinger.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index a4426cde1..262890743 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1242,17 +1242,22 @@ void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) if (disp == NULL) { disp = hw; } else { - disp = getDefaultDisplayDevice(); + disp = NULL; break; } } } } - if (disp != NULL) { - // presumably this means this layer is using a layerStack - // that is not visible on any display - layer->updateTransformHint(disp); + if (disp == NULL) { + // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to + // redraw after transform hint changes. See bug 8508397. + + // could be null when this layer is using a layerStack + // that is not visible on any display. Also can occur at + // screen off/on times. + disp = getDefaultDisplayDevice(); } + layer->updateTransformHint(disp); } }