From ce3a0a541c3dde1330551bd7a048cd9d92335c00 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 12 Sep 2012 15:34:57 -0700 Subject: [PATCH] don't call hwc with non-empty layer lists for blanked displays we now make sure to take the blanked state of a display into account when we build its list of visible layers, this ensures that we won't call prepare/set with a non-empty list when the display is blanked. Possibly fixes 7075380, 7103553, 7130187, 7016215 Bug: 7075380 Change-Id: I9fdd2e73d1b7621eaeca3d4ac2ae60d9fb1b3631 --- services/surfaceflinger/SurfaceFlinger.cpp | 33 ++++++++++++---------- services/surfaceflinger/SurfaceFlinger.h | 4 +-- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 058ba45a4..6542acd29 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -753,27 +753,29 @@ void SurfaceFlinger::rebuildLayerStacks() { ATRACE_CALL(); mVisibleRegionsDirty = false; invalidateHwcGeometry(); + const LayerVector& currentLayers(mDrawingState.layersSortedByZ); for (size_t dpy=0 ; dpy > layersSortedByZ; const sp& hw(mDisplays[dpy]); const Transform& tr(hw->getTransform()); const Rect bounds(hw->getBounds()); + if (hw->canDraw()) { + SurfaceFlinger::computeVisibleRegions(currentLayers, + hw->getLayerStack(), dirtyRegion, opaqueRegion); - Region opaqueRegion; - Region dirtyRegion; - computeVisibleRegions(currentLayers, - hw->getLayerStack(), dirtyRegion, opaqueRegion); - - Vector< sp > layersSortedByZ; - const size_t count = currentLayers.size(); - for (size_t i=0 ; i& layer(currentLayers[i]); - const Layer::State& s(layer->drawingState()); - if (s.layerStack == hw->getLayerStack()) { - Region visibleRegion(tr.transform(layer->visibleRegion)); - visibleRegion.andSelf(bounds); - if (!visibleRegion.isEmpty()) { - layersSortedByZ.add(layer); + const size_t count = currentLayers.size(); + for (size_t i=0 ; i& layer(currentLayers[i]); + const Layer::State& s(layer->drawingState()); + if (s.layerStack == hw->getLayerStack()) { + Region visibleRegion(tr.transform(layer->visibleRegion)); + visibleRegion.andSelf(bounds); + if (!visibleRegion.isEmpty()) { + layersSortedByZ.add(layer); + } } } } @@ -1776,6 +1778,7 @@ void SurfaceFlinger::onScreenReleased() { mEventThread->onScreenReleased(); hw->releaseScreen(); getHwComposer().release(); + mVisibleRegionsDirty = true; // from this point on, SF will stop drawing } } diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index ea03e2dcb..ffe68c6d3 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -351,8 +351,8 @@ private: * Compositing */ void invalidateHwcGeometry(); - void computeVisibleRegions(const LayerVector& currentLayers, - uint32_t layerStack, + static void computeVisibleRegions( + const LayerVector& currentLayers, uint32_t layerStack, Region& dirtyRegion, Region& opaqueRegion); void preComposition();