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 | |
| 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')
| -rw-r--r-- | tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp | 7 | ||||
| -rw-r--r-- | tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h | 2 |
2 files changed, 7 insertions, 2 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; diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h index c54dea702..3a501b411 100644 --- a/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h +++ b/tools/emulator/opengl/shared/OpenglCodecCommon/SocketStream.h @@ -37,6 +37,7 @@ public: bool valid() { return m_sock >= 0; } virtual int recv(void *buf, size_t len); + virtual int writeFully(const void *buf, size_t len); protected: int m_sock; @@ -44,7 +45,6 @@ protected: unsigned char *m_buf; SocketStream(int sock, size_t bufSize); - int writeFully(const void *buf, size_t len); }; #endif /* __SOCKET_STREAM_H */ |
