diff options
| author | David 'Digit' Turner <digit@google.com> | 2011-09-19 18:47:26 +0200 |
|---|---|---|
| committer | David 'Digit' Turner <digit@google.com> | 2011-09-20 15:58:54 +0200 |
| commit | 5d7f0875e9cda2d6ab37b49f0b6ceed8f0d16f45 (patch) | |
| tree | 20aa7f60766145820ac821bbc0ec142f66cf37d2 /tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp | |
| parent | e72ed049a890da6883b0de09a2263b88b648391a (diff) | |
emulator: opengl: 'large' buffer optimization
This patch modifies the guest encoding libraries to avoid
un-necessary copies when sending large buffers (e.g. pixels)
to the host. Instead, the data is sent directly through a
new IOStream method (writeFully()).
On my machine, this improves the NenaMark2 benchmark
(from 50.8 to 57.1 fps). More importantly, this speeds up
the display of non-GL surfaces too, which are sent through
the special rcUpdateColorBuffer() function in gralloc_goldfish.
This is noticeable in many parts of the UI (e.g. when scrolling
through lists).
To tag a given parameter, use the new 'isLarge' variable flag
in the protocol .attrib file.
Implemented for the following encoding functions:
rcUpdateColorBuffer
glTexSubImage2D
glTexImage2Di
glBufferData
glBufferSubData
glCompressedTexImage2D
glCompressedTexSubImage2D
glTexImage3DOES
glTexSubImage3DOES
glCompressedTexImage3DOES
glCompressedTexSubImage3DOES
+ Optimize the auto-generated encoder functions to avoid
repeated function calls (for size computations).
Change-Id: I13a02607b606c40cd05984cd2051b1f3424bc2d0
Diffstat (limited to 'tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp')
| -rw-r--r-- | tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp index 244cfbb20..ddc56d0e3 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp @@ -85,13 +85,18 @@ void *SocketStream::allocBuffer(size_t minSize) int SocketStream::commitBuffer(size_t size) { + return writeFully(m_buf, size); +} + +int SocketStream::writeFully(const void* buffer, size_t size) +{ if (!valid()) return -1; size_t res = size; int retval = 0; while (res > 0) { - ssize_t stat = ::send(m_sock, (const char *)(m_buf) + (size - res), res, 0); + ssize_t stat = ::send(m_sock, (const char *)buffer + (size - res), res, 0); if (stat < 0) { if (errno != EINTR) { retval = stat; |
