[RenderEngine] Rebind output texture when unbinding framebuffer

Without this patch, once drawLayers() completes we'd hold onto the
backing image data longer than intended since it's bound to sibling
texture. This would cause screenshot buffers to be live for longer than
intended. This patch rebinds the framebuffer's output texture to a dummy
buffer so that we can free memory sooner.

We perform this rebind on the main thread in
SurfaceFlinger::postComposition, to minimize the amount of expected time
we steal for composition due to this cleanup. We also only do this
cleanup if the most recent draw fence had fired, since the driver will
need to wait for GPU work to complete before freeing resources which can
kill performance.

Bug: 140158384
Test: screencap and check dumpsys
Test: systrace when during screen rotation
Test: systrace when toggling GPU composition on and off
Test: librenderengine_test, libcompositionengine_test
Change-Id: I0aa39e62f03a09f6db000c2abdbb1d0711127fc3
Merged-In: I0aa39e62f03a09f6db000c2abdbb1d0711127fc3
8 files changed