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
This commit is contained in:
@@ -84,6 +84,11 @@ 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;
|
||||
|
||||
@@ -91,7 +96,7 @@ int SocketStream::commitBuffer(size_t 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;
|
||||
|
||||
Reference in New Issue
Block a user