From 1b87456faa939b8a76a54336818131fb72b85ca6 Mon Sep 17 00:00:00 2001 From: Petar Jovanovic Date: Fri, 31 May 2013 18:40:19 +0200 Subject: 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 --- opengl/system/OpenglSystemCommon/QemuPipeStream.cpp | 1 + opengl/system/renderControl_enc/renderControl_enc.cpp | 2 ++ 2 files changed, 3 insertions(+) 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(int sock, size_t bufSize) : 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 @@ void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer) 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) -- cgit v1.2.3