Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit dcec0bca authored by Lloyd Pique's avatar Lloyd Pique
Browse files

SF: Clear mCompositionInfo before recomputing visible layers

Both SurfaceFlingerBE::mCompositionInfo and LayerBE::HWCInfo can hold a
shared_ptr to the same HWC2::Layer.

However the lifetime of the HWC2::Layer is only really expected to last
as long as the Layer is referenced by the visible layer list for a
display. This list might be the last thing keeping a sp<Layer> alive,
and when it is removed from the list, cleanup occurs.

The Layer dtor invokes Layer::destroyAllLayers(), which asserts that
cleanup completes succesfully. Effectively it requires that the
HWC2::Layer instance it holds is destroyed, as when it does so the
HWC2::Layer dtor invokes a callback to remove the entry from
LayerBE::HWCInfo for the display.

This fails to happen if the reference count for the shared_ptr does not
drop to zero. Clearing out mCompositionInfo before the visible layers
are recomputed fixes this.

Bug: 119629556
Test: atest CtsViewTestCases
Change-Id: I9b0ea0389fc1ba22a2a230f165689b5ee2f474ce
parent 3e7cf730
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment