From c39736088398a9b4367b30fc307ed7de96ac342e Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 31 Aug 2012 17:51:25 -0700 Subject: 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 --- services/surfaceflinger/LayerBase.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'services/surfaceflinger/LayerBase.cpp') 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& 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& hw, @@ -301,6 +305,13 @@ void LayerBase::setAcquireFence(const sp& hw, layer.setAcquireFenceFd(-1); } +void LayerBase::onLayerDisplayed(const sp& hw, + HWComposer::HWCLayerInterface* layer) { + if (layer) { + layer->onDisplayed(); + } +} + void LayerBase::setFiltering(bool filtering) { mFiltering = filtering; -- cgit v1.2.3-59-g8ed1b