Fix RenderThreadInfo lifetime and cleanup

Instead of using a TLS destructor, RenderThreadInfo is now an automatic
variable of RenderThread::Main(), so is automatically destroyed on thread exit.
RenderThread::Main() now explicitly unbinds the thread's context and surfaces
from the FrameBuffer, ensuring that the thread has released all references
before it exits.

This fixes a bug where RenderThreadInfo's destructor was releasing the
references in the TLS destructor, which caused ColorBuffer's destructor to call
FrameBuffer::bind_locked() when the FrameBuffer lock wasn't held. By clearing
the references in FrameBuffer::bindContext(), locking around destruction
happens correctly.

Change-Id: I617cea838d5f352a597ccc6d3dbd8f9c08cb91bd
6 files changed