summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/LayerBase.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2012-08-31 17:51:25 -0700
committer Mathias Agopian <mathias@google.com> 2012-08-31 18:41:22 -0700
commitc39736088398a9b4367b30fc307ed7de96ac342e (patch)
tree64f2bd31272f323ede649a37e7e7dbcc04dd84c9 /services/surfaceflinger/LayerBase.cpp
parent50f262fe569b52bb4d44c96de0d296188ce3885e (diff)
the visible region sent to HWC was garbage
we used to have a visibleRegion object per layer, but now it's per screen; so at somepoint the code got changed to calculate the per-screen visible region on the stack and that's what got passed to HWC. we're now setting the visibleRegionScreen at each frame and freeing at after the HWC set() call. We use the underlaying SharedBuffer so that in most cases we don't have to allocate, free or copy memory around. Bug: 7089478 Change-Id: I24fa556c76613a225d9fe7a6c6b727bb476144d8
Diffstat (limited to 'services/surfaceflinger/LayerBase.cpp')
-rw-r--r--services/surfaceflinger/LayerBase.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index a2513a2c0c..87dc572aad 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -288,12 +288,16 @@ void LayerBase::setGeometry(
// scaling is already applied in transformedBounds
layer.setFrame(transformedBounds);
layer.setCrop(transformedBounds.getBounds());
- layer.setVisibleRegionScreen(tr.transform(visibleRegion));
}
void LayerBase::setPerFrameData(const sp<const DisplayDevice>& hw,
HWComposer::HWCLayerInterface& layer) {
layer.setBuffer(0);
+ // we have to set the visible region on every frame because
+ // we currently free it during onLayerDisplayed(), which is called
+ // after HWComposer::commit() -- every frame.
+ const Transform& tr = hw->getTransform();
+ layer.setVisibleRegionScreen(tr.transform(visibleRegion));
}
void LayerBase::setAcquireFence(const sp<const DisplayDevice>& hw,
@@ -301,6 +305,13 @@ void LayerBase::setAcquireFence(const sp<const DisplayDevice>& hw,
layer.setAcquireFenceFd(-1);
}
+void LayerBase::onLayerDisplayed(const sp<const DisplayDevice>& hw,
+ HWComposer::HWCLayerInterface* layer) {
+ if (layer) {
+ layer->onDisplayed();
+ }
+}
+
void LayerBase::setFiltering(bool filtering)
{
mFiltering = filtering;