am c3973608
: the visible region sent to HWC was garbage
* commit 'c39736088398a9b4367b30fc307ed7de96ac342e': the visible region sent to HWC was garbage
This commit is contained in:
commit
caf2d84814
@ -573,9 +573,12 @@ public:
|
||||
reinterpret_cast<Rect&>(getLayer()->sourceCrop) = crop;
|
||||
}
|
||||
virtual void setVisibleRegionScreen(const Region& reg) {
|
||||
getLayer()->visibleRegionScreen.rects =
|
||||
reinterpret_cast<hwc_rect_t const *>(
|
||||
reg.getArray(&getLayer()->visibleRegionScreen.numRects));
|
||||
// Region::getSharedBuffer creates a reference to the underlying
|
||||
// SharedBuffer of this Region, this reference is freed
|
||||
// in onDisplayed()
|
||||
hwc_region_t& visibleRegion = getLayer()->visibleRegionScreen;
|
||||
SharedBuffer const* sb = reg.getSharedBuffer(&visibleRegion.numRects);
|
||||
visibleRegion.rects = reinterpret_cast<hwc_rect_t const *>(sb->data());
|
||||
}
|
||||
virtual void setBuffer(const sp<GraphicBuffer>& buffer) {
|
||||
if (buffer == 0 || buffer->handle == 0) {
|
||||
@ -586,6 +589,16 @@ public:
|
||||
getLayer()->handle = buffer->handle;
|
||||
}
|
||||
}
|
||||
virtual void onDisplayed() {
|
||||
hwc_region_t& visibleRegion = getLayer()->visibleRegionScreen;
|
||||
SharedBuffer const* sb = SharedBuffer::bufferFromData(visibleRegion.rects);
|
||||
if (sb) {
|
||||
sb->release();
|
||||
// not technically needed but safer
|
||||
visibleRegion.numRects = 0;
|
||||
visibleRegion.rects = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -130,6 +130,7 @@ public:
|
||||
virtual void setVisibleRegionScreen(const Region& reg) = 0;
|
||||
virtual void setBuffer(const sp<GraphicBuffer>& buffer) = 0;
|
||||
virtual void setAcquireFenceFd(int fenceFd) = 0;
|
||||
virtual void onDisplayed() = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -72,6 +72,7 @@ Layer::Layer(SurfaceFlinger* flinger, const sp<Client>& client)
|
||||
|
||||
void Layer::onLayerDisplayed(const sp<const DisplayDevice>& hw,
|
||||
HWComposer::HWCLayerInterface* layer) {
|
||||
LayerBaseClient::onLayerDisplayed(hw, layer);
|
||||
if (layer) {
|
||||
mSurfaceTexture->setReleaseFence(layer->getAndResetReleaseFenceFd());
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -218,7 +218,7 @@ public:
|
||||
/** called after page-flip
|
||||
*/
|
||||
virtual void onLayerDisplayed(const sp<const DisplayDevice>& hw,
|
||||
HWComposer::HWCLayerInterface* layer) { }
|
||||
HWComposer::HWCLayerInterface* layer);
|
||||
|
||||
/** called before composition.
|
||||
* returns true if the layer has pending updates.
|
||||
|
Loading…
Reference in New Issue
Block a user