Merge "don't call hwc with non-empty layer lists for blanked displays" into jb-mr1-dev

This commit is contained in:
Mathias Agopian 2012-09-12 19:10:03 -07:00 committed by Android (Google) Code Review
commit a5be0cd4f3
2 changed files with 20 additions and 17 deletions

View File

@ -753,27 +753,29 @@ void SurfaceFlinger::rebuildLayerStacks() {
ATRACE_CALL(); ATRACE_CALL();
mVisibleRegionsDirty = false; mVisibleRegionsDirty = false;
invalidateHwcGeometry(); invalidateHwcGeometry();
const LayerVector& currentLayers(mDrawingState.layersSortedByZ); const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) { for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
Region opaqueRegion;
Region dirtyRegion;
Vector< sp<LayerBase> > layersSortedByZ;
const sp<DisplayDevice>& hw(mDisplays[dpy]); const sp<DisplayDevice>& hw(mDisplays[dpy]);
const Transform& tr(hw->getTransform()); const Transform& tr(hw->getTransform());
const Rect bounds(hw->getBounds()); const Rect bounds(hw->getBounds());
if (hw->canDraw()) {
SurfaceFlinger::computeVisibleRegions(currentLayers,
hw->getLayerStack(), dirtyRegion, opaqueRegion);
Region opaqueRegion; const size_t count = currentLayers.size();
Region dirtyRegion; for (size_t i=0 ; i<count ; i++) {
computeVisibleRegions(currentLayers, const sp<LayerBase>& layer(currentLayers[i]);
hw->getLayerStack(), dirtyRegion, opaqueRegion); const Layer::State& s(layer->drawingState());
if (s.layerStack == hw->getLayerStack()) {
Vector< sp<LayerBase> > layersSortedByZ; Region visibleRegion(tr.transform(layer->visibleRegion));
const size_t count = currentLayers.size(); visibleRegion.andSelf(bounds);
for (size_t i=0 ; i<count ; i++) { if (!visibleRegion.isEmpty()) {
const sp<LayerBase>& layer(currentLayers[i]); layersSortedByZ.add(layer);
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(); mEventThread->onScreenReleased();
hw->releaseScreen(); hw->releaseScreen();
getHwComposer().release(); getHwComposer().release();
mVisibleRegionsDirty = true;
// from this point on, SF will stop drawing // from this point on, SF will stop drawing
} }
} }

View File

@ -351,8 +351,8 @@ private:
* Compositing * Compositing
*/ */
void invalidateHwcGeometry(); void invalidateHwcGeometry();
void computeVisibleRegions(const LayerVector& currentLayers, static void computeVisibleRegions(
uint32_t layerStack, const LayerVector& currentLayers, uint32_t layerStack,
Region& dirtyRegion, Region& opaqueRegion); Region& dirtyRegion, Region& opaqueRegion);
void preComposition(); void preComposition();