diff options
| author | Jesse Hall <jessehall@google.com> | 2012-05-30 13:31:24 -0700 |
|---|---|---|
| committer | Jesse Hall <jessehall@google.com> | 2012-06-06 09:46:29 -0700 |
| commit | 56513f5ff4f3e851c5f0cb38dc8851d18616b3c0 (patch) | |
| tree | de30d64a128dee538e2a74adbe8f2fe4db78e15e /tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp | |
| parent | c424ad10606977edab8d81a39eca68ddf00ec686 (diff) | |
Move emugl system code to development.git
Because of the way the SDK and Android system images are branched,
host code that goes into the SDK tools can't live in the same
repository as code that goes into the system image. This change keeps
the emugl host code in sdk.git/emulator/opengl while moving the emugl
system code to development.git/tools/emulator/opengl.
A few changes were made beyond simply cloning the directories:
(a) Makefiles were modified to only build the relevant components. Not
doing so would break the build due to having multiple rule
definitions.
(b) Protocol spec files were moved from the guest encoder directories
to the host decoder directories. The decoder must support older
versions of the protocol, but not newer versions, so it makes
sense to keep the latest version of the protocol spec with the
decoder.
(c) Along with that, the encoder is now built from checked in
generated encoder source rather than directly from the protocol
spec. The generated code must be updated manually. This makes it
possible to freeze the system encoder version without freezing the
host decoder version, and also makes it very obvious when a
protocol changes is happening that will require special
backwards-compatibility support in the decoder/renderer.
(d) Host-only and system-only code were removed from the repository
where they aren't used.
(e) README and DESIGN documents were updated to reflect this split.
No actual source code was changed due to the above.
Change-Id: I2c936101ea0405b372750d36ba0f01e84d719c43
Diffstat (limited to 'tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp')
| -rw-r--r-- | tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp new file mode 100644 index 000000000..94e256ad3 --- /dev/null +++ b/tools/emulator/opengl/system/renderControl_enc/renderControl_enc.cpp @@ -0,0 +1,536 @@ +// Generated Code - DO NOT EDIT !! +// generated by 'emugen' + + +#include <string.h> +#include "renderControl_opcodes.h" + +#include "renderControl_enc.h" + + +#include <stdio.h> +static void enc_unsupported() +{ + ALOGE("Function is unsupported\n"); +} + +GLint rcGetRendererVersion_enc(void *self ) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetRendererVersion;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + + GLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_major = sizeof(EGLint); + const unsigned int __size_minor = sizeof(EGLint); + unsigned char *ptr; + const size_t packetSize = 8 + __size_major + __size_minor + 2*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetEGLVersion;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_major; ptr += 4; + *(unsigned int *)(ptr) = __size_minor; ptr += 4; + stream->readback(major, __size_major); + stream->readback(minor, __size_minor); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufferSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcQueryEGLString;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &name, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + memcpy(ptr, &bufferSize, 4); ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufferSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 4 + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetGLString;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &name, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + memcpy(ptr, &bufferSize, 4); ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_numAttribs = sizeof(uint32_t); + unsigned char *ptr; + const size_t packetSize = 8 + __size_numAttribs + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetNumConfigs;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_numAttribs; ptr += 4; + stream->readback(numAttribs, __size_numAttribs); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_buffer = bufSize; + unsigned char *ptr; + const size_t packetSize = 8 + 4 + __size_buffer + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetConfigs;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &bufSize, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_buffer; ptr += 4; + stream->readback(buffer, __size_buffer); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_attribs = attribs_size; + const unsigned int __size_configs = ((configs != NULL) ? configs_size*sizeof(uint32_t) : 0); + unsigned char *ptr; + const size_t packetSize = 8 + __size_attribs + 4 + __size_configs + 4 + 2*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcChooseConfig;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + *(unsigned int *)(ptr) = __size_attribs; ptr += 4; + memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs; + memcpy(ptr, &attribs_size, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_configs; ptr += 4; + memcpy(ptr, &configs_size, 4); ptr += 4; + if (configs != NULL) stream->readback(configs, __size_configs); + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcGetFBParam_enc(void *self , EGLint param) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcGetFBParam;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, ¶m, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateContext;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &config, 4); ptr += 4; + memcpy(ptr, &share, 4); ptr += 4; + memcpy(ptr, &glVersion, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcDestroyContext_enc(void *self , uint32_t context) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcDestroyContext;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &context, 4); ptr += 4; +} + +uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &config, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcDestroyWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; +} + +uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCreateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &internalFormat, 4); ptr += 4; + + uint32_t retval; + stream->readback(&retval, 4); + return retval; +} + +void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcOpenColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; +} + +void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; +} + +void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcSetWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFlushWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &windowSurface, 4); ptr += 4; + + int retval; + stream->readback(&retval, 4); + return retval; +} + +EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcMakeCurrent;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &context, 4); ptr += 4; + memcpy(ptr, &drawSurf, 4); ptr += 4; + memcpy(ptr, &readSurf, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +void rcFBPost_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFBPost;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +void rcFBSetSwapInterval_enc(void *self , EGLint interval) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcFBSetSwapInterval;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &interval, 4); ptr += 4; +} + +void rcBindTexture_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcBindTexture;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorBuffer, 4); ptr += 4; +} + +EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcColorBufferCacheFlush;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &postCount, 4); ptr += 4; + memcpy(ptr, &forRead, 4); ptr += 4; + + EGLint retval; + stream->readback(&retval, 4); + return retval; +} + +void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; + ptr = stream->alloc(packetSize); + int tmp = OP_rcReadColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &x, 4); ptr += 4; + memcpy(ptr, &y, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &format, 4); ptr += 4; + memcpy(ptr, &type, 4); ptr += 4; + *(unsigned int *)(ptr) = __size_pixels; ptr += 4; + stream->readback(pixels, __size_pixels); +} + +int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) +{ + + renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; + IOStream *stream = ctx->m_stream; + + const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); + unsigned char *ptr; + const size_t packetSize = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; + ptr = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4); + int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; + memcpy(ptr, &packetSize, 4); ptr += 4; + + memcpy(ptr, &colorbuffer, 4); ptr += 4; + memcpy(ptr, &x, 4); ptr += 4; + memcpy(ptr, &y, 4); ptr += 4; + memcpy(ptr, &width, 4); ptr += 4; + memcpy(ptr, &height, 4); ptr += 4; + memcpy(ptr, &format, 4); ptr += 4; + memcpy(ptr, &type, 4); ptr += 4; + stream->flush(); + stream->writeFully(&__size_pixels,4); + stream->writeFully(pixels, __size_pixels); + + int retval; + stream->readback(&retval, 4); + return retval; +} + +renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream) +{ + m_stream = stream; + + set_rcGetRendererVersion(rcGetRendererVersion_enc); + set_rcGetEGLVersion(rcGetEGLVersion_enc); + set_rcQueryEGLString(rcQueryEGLString_enc); + set_rcGetGLString(rcGetGLString_enc); + set_rcGetNumConfigs(rcGetNumConfigs_enc); + set_rcGetConfigs(rcGetConfigs_enc); + set_rcChooseConfig(rcChooseConfig_enc); + set_rcGetFBParam(rcGetFBParam_enc); + set_rcCreateContext(rcCreateContext_enc); + set_rcDestroyContext(rcDestroyContext_enc); + set_rcCreateWindowSurface(rcCreateWindowSurface_enc); + set_rcDestroyWindowSurface(rcDestroyWindowSurface_enc); + set_rcCreateColorBuffer(rcCreateColorBuffer_enc); + set_rcOpenColorBuffer(rcOpenColorBuffer_enc); + set_rcCloseColorBuffer(rcCloseColorBuffer_enc); + set_rcSetWindowColorBuffer(rcSetWindowColorBuffer_enc); + set_rcFlushWindowColorBuffer(rcFlushWindowColorBuffer_enc); + set_rcMakeCurrent(rcMakeCurrent_enc); + set_rcFBPost(rcFBPost_enc); + set_rcFBSetSwapInterval(rcFBSetSwapInterval_enc); + set_rcBindTexture(rcBindTexture_enc); + set_rcBindRenderbuffer(rcBindRenderbuffer_enc); + set_rcColorBufferCacheFlush(rcColorBufferCacheFlush_enc); + set_rcReadColorBuffer(rcReadColorBuffer_enc); + set_rcUpdateColorBuffer(rcUpdateColorBuffer_enc); +} + |
