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:
David 'Digit' Turner
2011-09-19 18:47:26 +02:00
parent e72ed049a8
commit 5d7f0875e9
11 changed files with 302 additions and 109 deletions

View File

@@ -240,7 +240,7 @@ glTexEnvxv
glTexImage2D
dir pixels in
len pixels pixelDataSize(self, width, height, format, type, 0)
var_flag pixels nullAllowed
var_flag pixels nullAllowed isLarge
#void glTexParameteriv(GLenum target, GLenum pname, GLint *params)
glTexParameteriv
@@ -253,6 +253,7 @@ glTexParameterxv
#void glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
glTexSubImage2D
len pixels pixelDataSize(self, width, height, format, type, 0)
var_flag pixels isLarge
#void glVertexPointer(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
# we treat the pointer as an offset to a VBO