Flush QemuPipeStream when needed
Under some circumstances, close color buffer messages in the command stream
do not reach the host as the size of the undelivered commands is small.
This results in refcounts of ColorBuffer never dropping to zero and color
buffers not being freed.
The patch calls flush at the end of rcCloseColorBuffer_enc().
In addition, the stream is flushed before it is deleted in the destructor of
QemuPipeStream, since it may also have important messages.
bug: 9278661
Change-Id: I46f20af8e0c272ec8d831d62f57cb2f22c7b28a7
diff --git a/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp b/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp
index 50c3d8b..a55dca0 100644
--- a/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp
+++ b/opengl/system/OpenglSystemCommon/QemuPipeStream.cpp
@@ -40,6 +40,7 @@
QemuPipeStream::~QemuPipeStream()
{
if (m_sock >= 0) {
+ flush();
::close(m_sock);
}
if (m_buf != NULL) {
diff --git a/opengl/system/renderControl_enc/renderControl_enc.cpp b/opengl/system/renderControl_enc/renderControl_enc.cpp
index 94e256a..41f59d0 100644
--- a/opengl/system/renderControl_enc/renderControl_enc.cpp
+++ b/opengl/system/renderControl_enc/renderControl_enc.cpp
@@ -311,6 +311,8 @@
memcpy(ptr, &packetSize, 4); ptr += 4;
memcpy(ptr, &colorbuffer, 4); ptr += 4;
+
+ stream->flush();
}
void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer)