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();
mVisibleRegionsDirty = false;
invalidateHwcGeometry();
const LayerVector& currentLayers(mDrawingState.layersSortedByZ);
for (size_t dpy=0 ; dpy<mDisplays.size() ; dpy++) {
Region opaqueRegion;
Region dirtyRegion;
Vector< sp<LayerBase> > layersSortedByZ;
const sp<DisplayDevice>& 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<LayerBase> > layersSortedByZ;
const size_t count = currentLayers.size();
for (size_t i=0 ; i<count ; i++) {
const sp<LayerBase>& 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<count ; i++) {
const sp<LayerBase>& 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
}
}

View File

@ -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();