| // Generated Code - DO NOT EDIT !! |
| // generated by 'emugen' |
| |
| |
| #include <string.h> |
| #include "renderControl_opcodes.h" |
| |
| #include "renderControl_enc.h" |
| |
| |
| #include <vector> |
| |
| #include <stdio.h> |
| |
| #include "aemu/base/Tracing.h" |
| |
| #include "EncoderDebug.h" |
| |
| namespace { |
| |
| void enc_unsupported() |
| { |
| ALOGE("Function is unsupported\n"); |
| } |
| |
| GLint rcGetRendererVersion_enc(void *self ) |
| { |
| ENCODER_DEBUG_LOG("rcGetRendererVersion()"); |
| AEMU_SCOPED_TRACE("rcGetRendererVersion encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetRendererVersion;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetRendererVersion: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcGetEGLVersion_enc(void *self , EGLint* major, EGLint* minor) |
| { |
| ENCODER_DEBUG_LOG("rcGetEGLVersion(major:0x%08x, minor:0x%08x)", major, minor); |
| AEMU_SCOPED_TRACE("rcGetEGLVersion encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_major = sizeof(EGLint); |
| const unsigned int __size_minor = sizeof(EGLint); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 0 + 0 + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetEGLVersion;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_major, 4); ptr += 4; |
| memcpy(ptr, &__size_minor, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(major, __size_major); |
| if (useChecksum) checksumCalculator->addBuffer(major, __size_major); |
| stream->readback(minor, __size_minor); |
| if (useChecksum) checksumCalculator->addBuffer(minor, __size_minor); |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetEGLVersion: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcQueryEGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) |
| { |
| ENCODER_DEBUG_LOG("rcQueryEGLString(name:0x%08x, buffer:0x%08x, bufferSize:0x%08x)", name, buffer, bufferSize); |
| AEMU_SCOPED_TRACE("rcQueryEGLString encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffer = bufferSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcQueryEGLString;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &name, 4); ptr += 4; |
| memcpy(ptr, &__size_buffer, 4); ptr += 4; |
| memcpy(ptr, &bufferSize, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(buffer, __size_buffer); |
| if (useChecksum) checksumCalculator->addBuffer(buffer, __size_buffer); |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcQueryEGLString: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcGetGLString_enc(void *self , EGLenum name, void* buffer, EGLint bufferSize) |
| { |
| ENCODER_DEBUG_LOG("rcGetGLString(name:0x%08x, buffer:0x%08x, bufferSize:0x%08x)", name, buffer, bufferSize); |
| AEMU_SCOPED_TRACE("rcGetGLString encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffer = bufferSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetGLString;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &name, 4); ptr += 4; |
| memcpy(ptr, &__size_buffer, 4); ptr += 4; |
| memcpy(ptr, &bufferSize, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(buffer, __size_buffer); |
| if (useChecksum) checksumCalculator->addBuffer(buffer, __size_buffer); |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetGLString: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcGetNumConfigs_enc(void *self , uint32_t* numAttribs) |
| { |
| ENCODER_DEBUG_LOG("rcGetNumConfigs(numAttribs:0x%08x)", numAttribs); |
| AEMU_SCOPED_TRACE("rcGetNumConfigs encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_numAttribs = sizeof(uint32_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetNumConfigs;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_numAttribs, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(numAttribs, __size_numAttribs); |
| if (useChecksum) checksumCalculator->addBuffer(numAttribs, __size_numAttribs); |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetNumConfigs: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcGetConfigs_enc(void *self , uint32_t bufSize, GLuint* buffer) |
| { |
| ENCODER_DEBUG_LOG("rcGetConfigs(bufSize:0x%08x, buffer:0x%08x)", bufSize, buffer); |
| AEMU_SCOPED_TRACE("rcGetConfigs encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffer = bufSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetConfigs;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bufSize, 4); ptr += 4; |
| memcpy(ptr, &__size_buffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(buffer, __size_buffer); |
| if (useChecksum) checksumCalculator->addBuffer(buffer, __size_buffer); |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetConfigs: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcChooseConfig_enc(void *self , EGLint* attribs, uint32_t attribs_size, uint32_t* configs, uint32_t configs_size) |
| { |
| ENCODER_DEBUG_LOG("rcChooseConfig(attribs:0x%08x, attribs_size:0x%08x, configs:0x%08x, configs_size:0x%08x)", attribs, attribs_size, configs, configs_size); |
| AEMU_SCOPED_TRACE("rcChooseConfig encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_attribs = attribs_size; |
| const unsigned int __size_configs = ((configs != NULL) ? configs_size*sizeof(uint32_t) : 0); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + __size_attribs + 4 + 0 + 4 + 2*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcChooseConfig;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_attribs, 4); ptr += 4; |
| memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs; |
| memcpy(ptr, &attribs_size, 4); ptr += 4; |
| memcpy(ptr, &__size_configs, 4); ptr += 4; |
| memcpy(ptr, &configs_size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| if (configs != NULL) { |
| stream->readback(configs, __size_configs); |
| if (useChecksum) checksumCalculator->addBuffer(configs, __size_configs); |
| } |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcChooseConfig: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcGetFBParam_enc(void *self , EGLint param) |
| { |
| ENCODER_DEBUG_LOG("rcGetFBParam(param:0x%08x)", param); |
| AEMU_SCOPED_TRACE("rcGetFBParam encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetFBParam;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, ¶m, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetFBParam: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| uint32_t rcCreateContext_enc(void *self , uint32_t config, uint32_t share, uint32_t glVersion) |
| { |
| ENCODER_DEBUG_LOG("rcCreateContext(config:0x%08x, share:0x%08x, glVersion:0x%08x)", config, share, glVersion); |
| AEMU_SCOPED_TRACE("rcCreateContext encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateContext;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &config, 4); ptr += 4; |
| memcpy(ptr, &share, 4); ptr += 4; |
| memcpy(ptr, &glVersion, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateContext: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcDestroyContext_enc(void *self , uint32_t context) |
| { |
| ENCODER_DEBUG_LOG("rcDestroyContext(context:0x%08x)", context); |
| AEMU_SCOPED_TRACE("rcDestroyContext encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcDestroyContext;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &context, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| uint32_t rcCreateWindowSurface_enc(void *self , uint32_t config, uint32_t width, uint32_t height) |
| { |
| ENCODER_DEBUG_LOG("rcCreateWindowSurface(config:0x%08x, width:0x%08x, height:0x%08x)", config, width, height); |
| AEMU_SCOPED_TRACE("rcCreateWindowSurface encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &config, 4); ptr += 4; |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateWindowSurface: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcDestroyWindowSurface_enc(void *self , uint32_t windowSurface) |
| { |
| ENCODER_DEBUG_LOG("rcDestroyWindowSurface(windowSurface:0x%08x)", windowSurface); |
| AEMU_SCOPED_TRACE("rcDestroyWindowSurface encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcDestroyWindowSurface;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &windowSurface, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| uint32_t rcCreateColorBuffer_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat) |
| { |
| ENCODER_DEBUG_LOG("rcCreateColorBuffer(width:0x%08x, height:0x%08x, internalFormat:0x%08x)", width, height, internalFormat); |
| AEMU_SCOPED_TRACE("rcCreateColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcOpenColorBuffer_enc(void *self , uint32_t colorbuffer) |
| { |
| ENCODER_DEBUG_LOG("rcOpenColorBuffer(colorbuffer:0x%08x)", colorbuffer); |
| AEMU_SCOPED_TRACE("rcOpenColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcOpenColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorbuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcCloseColorBuffer_enc(void *self , uint32_t colorbuffer) |
| { |
| ENCODER_DEBUG_LOG("rcCloseColorBuffer(colorbuffer:0x%08x)", colorbuffer); |
| AEMU_SCOPED_TRACE("rcCloseColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCloseColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorbuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->flush(); |
| } |
| |
| void rcSetWindowColorBuffer_enc(void *self , uint32_t windowSurface, uint32_t colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcSetWindowColorBuffer(windowSurface:0x%08x, colorBuffer:0x%08x)", windowSurface, colorBuffer); |
| AEMU_SCOPED_TRACE("rcSetWindowColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &windowSurface, 4); ptr += 4; |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| int rcFlushWindowColorBuffer_enc(void *self , uint32_t windowSurface) |
| { |
| ENCODER_DEBUG_LOG("rcFlushWindowColorBuffer(windowSurface:0x%08x)", windowSurface); |
| AEMU_SCOPED_TRACE("rcFlushWindowColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcFlushWindowColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &windowSurface, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcFlushWindowColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| EGLint rcMakeCurrent_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf) |
| { |
| ENCODER_DEBUG_LOG("rcMakeCurrent(context:0x%08x, drawSurf:0x%08x, readSurf:0x%08x)", context, drawSurf, readSurf); |
| AEMU_SCOPED_TRACE("rcMakeCurrent encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcMakeCurrent;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &context, 4); ptr += 4; |
| memcpy(ptr, &drawSurf, 4); ptr += 4; |
| memcpy(ptr, &readSurf, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcMakeCurrent: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcFBPost_enc(void *self , uint32_t colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcFBPost(colorBuffer:0x%08x)", colorBuffer); |
| AEMU_SCOPED_TRACE("rcFBPost encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcFBPost;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcFBSetSwapInterval_enc(void *self , EGLint interval) |
| { |
| ENCODER_DEBUG_LOG("rcFBSetSwapInterval(interval:0x%08x)", interval); |
| AEMU_SCOPED_TRACE("rcFBSetSwapInterval encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcFBSetSwapInterval;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &interval, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcBindTexture_enc(void *self , uint32_t colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcBindTexture(colorBuffer:0x%08x)", colorBuffer); |
| AEMU_SCOPED_TRACE("rcBindTexture encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcBindTexture;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcBindRenderbuffer_enc(void *self , uint32_t colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcBindRenderbuffer(colorBuffer:0x%08x)", colorBuffer); |
| AEMU_SCOPED_TRACE("rcBindRenderbuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcBindRenderbuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| EGLint rcColorBufferCacheFlush_enc(void *self , uint32_t colorbuffer, EGLint postCount, int forRead) |
| { |
| ENCODER_DEBUG_LOG("rcColorBufferCacheFlush(colorbuffer:0x%08x, postCount:0x%08x, forRead:%d)", colorbuffer, postCount, forRead); |
| AEMU_SCOPED_TRACE("rcColorBufferCacheFlush encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcColorBufferCacheFlush;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorbuffer, 4); ptr += 4; |
| memcpy(ptr, &postCount, 4); ptr += 4; |
| memcpy(ptr, &forRead, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcColorBufferCacheFlush: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcReadColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) |
| { |
| ENCODER_DEBUG_LOG("rcReadColorBuffer(colorbuffer:0x%08x, x:0x%08x, y:0x%08x, width:0x%08x, height:0x%08x, format:0x%08x, type:0x%08x, pixels:0x%08x)", colorbuffer, x, y, width, height, format, type, pixels); |
| AEMU_SCOPED_TRACE("rcReadColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcReadColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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; |
| memcpy(ptr, &__size_pixels, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(pixels, __size_pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcReadColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| int rcUpdateColorBuffer_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels) |
| { |
| ENCODER_DEBUG_LOG("rcUpdateColorBuffer(colorbuffer:0x%08x, x:0x%08x, y:0x%08x, width:0x%08x, height:0x%08x, format:0x%08x, type:0x%08x, pixels:0x%08x)", colorbuffer, x, y, width, height, format, type, pixels); |
| AEMU_SCOPED_TRACE("rcUpdateColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = (((glUtilsPixelBitSize(format, type) * width) >> 3) * height); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + __size_pixels + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(8 + 4 + 4 + 4 + 4 + 4 + 4 + 4); |
| ptr = buf; |
| int tmp = OP_rcUpdateColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| stream->flush(); |
| stream->writeFully(&__size_pixels,4); |
| if (useChecksum) checksumCalculator->addBuffer(&__size_pixels,4); |
| stream->writeFully(pixels, __size_pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| buf = stream->alloc(checksumSize); |
| if (useChecksum) checksumCalculator->writeChecksum(buf, checksumSize); |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcUpdateColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcOpenColorBuffer2_enc(void *self , uint32_t colorbuffer) |
| { |
| ENCODER_DEBUG_LOG("rcOpenColorBuffer2(colorbuffer:0x%08x)", colorbuffer); |
| AEMU_SCOPED_TRACE("rcOpenColorBuffer2 encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcOpenColorBuffer2;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorbuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcOpenColorBuffer2: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| uint32_t rcCreateClientImage_enc(void *self , uint32_t context, EGLenum target, GLuint buffer) |
| { |
| ENCODER_DEBUG_LOG("rcCreateClientImage(context:0x%08x, target:0x%08x, buffer:0x%08x)", context, target, buffer); |
| AEMU_SCOPED_TRACE("rcCreateClientImage encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateClientImage;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &context, 4); ptr += 4; |
| memcpy(ptr, &target, 4); ptr += 4; |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateClientImage: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcDestroyClientImage_enc(void *self , uint32_t image) |
| { |
| ENCODER_DEBUG_LOG("rcDestroyClientImage(image:0x%08x)", image); |
| AEMU_SCOPED_TRACE("rcDestroyClientImage encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcDestroyClientImage;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &image, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcDestroyClientImage: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcSelectChecksumHelper_enc(void *self , uint32_t newProtocol, uint32_t reserved) |
| { |
| ENCODER_DEBUG_LOG("rcSelectChecksumHelper(newProtocol:0x%08x, reserved:0x%08x)", newProtocol, reserved); |
| AEMU_SCOPED_TRACE("rcSelectChecksumHelper encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSelectChecksumHelper;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &newProtocol, 4); ptr += 4; |
| memcpy(ptr, &reserved, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcCreateSyncKHR_enc(void *self , EGLenum type, EGLint* attribs, uint32_t num_attribs, int destroy_when_signaled, uint64_t* glsync_out, uint64_t* syncthread_out) |
| { |
| ENCODER_DEBUG_LOG("rcCreateSyncKHR(type:0x%08x, attribs:0x%08x, num_attribs:0x%08x, destroy_when_signaled:%d, glsync_out:0x%08x, syncthread_out:0x%08x)", type, attribs, num_attribs, destroy_when_signaled, glsync_out, syncthread_out); |
| AEMU_SCOPED_TRACE("rcCreateSyncKHR encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_attribs = num_attribs; |
| const unsigned int __size_glsync_out = sizeof(uint64_t); |
| const unsigned int __size_syncthread_out = sizeof(uint64_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_attribs + 4 + 4 + 0 + 0 + 3*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateSyncKHR;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &type, 4); ptr += 4; |
| memcpy(ptr, &__size_attribs, 4); ptr += 4; |
| memcpy(ptr, attribs, __size_attribs);ptr += __size_attribs; |
| memcpy(ptr, &num_attribs, 4); ptr += 4; |
| memcpy(ptr, &destroy_when_signaled, 4); ptr += 4; |
| memcpy(ptr, &__size_glsync_out, 4); ptr += 4; |
| memcpy(ptr, &__size_syncthread_out, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(glsync_out, __size_glsync_out); |
| if (useChecksum) checksumCalculator->addBuffer(glsync_out, __size_glsync_out); |
| stream->readback(syncthread_out, __size_syncthread_out); |
| if (useChecksum) checksumCalculator->addBuffer(syncthread_out, __size_syncthread_out); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateSyncKHR: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| EGLint rcClientWaitSyncKHR_enc(void *self , uint64_t sync, EGLint flags, uint64_t timeout) |
| { |
| ENCODER_DEBUG_LOG("rcClientWaitSyncKHR(sync:0x%016lx, flags:0x%08x, timeout:0x%016lx)", sync, flags, timeout); |
| AEMU_SCOPED_TRACE("rcClientWaitSyncKHR encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcClientWaitSyncKHR;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| memcpy(ptr, &flags, 4); ptr += 4; |
| memcpy(ptr, &timeout, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| EGLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcClientWaitSyncKHR: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcFlushWindowColorBufferAsync_enc(void *self , uint32_t windowSurface) |
| { |
| ENCODER_DEBUG_LOG("rcFlushWindowColorBufferAsync(windowSurface:0x%08x)", windowSurface); |
| AEMU_SCOPED_TRACE("rcFlushWindowColorBufferAsync encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcFlushWindowColorBufferAsync;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &windowSurface, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| int rcDestroySyncKHR_enc(void *self , uint64_t sync) |
| { |
| ENCODER_DEBUG_LOG("rcDestroySyncKHR(sync:0x%016lx)", sync); |
| AEMU_SCOPED_TRACE("rcDestroySyncKHR encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcDestroySyncKHR;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcDestroySyncKHR: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcSetPuid_enc(void *self , uint64_t puid) |
| { |
| ENCODER_DEBUG_LOG("rcSetPuid(puid:0x%016lx)", puid); |
| AEMU_SCOPED_TRACE("rcSetPuid encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetPuid;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &puid, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| int rcUpdateColorBufferDMA_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void* pixels, uint32_t pixels_size) |
| { |
| ENCODER_DEBUG_LOG("rcUpdateColorBufferDMA(colorbuffer:0x%08x, x:0x%08x, y:0x%08x, width:0x%08x, height:0x%08x, format:0x%08x, type:0x%08x, pixels:0x%08x, pixels_size:0x%08x)", colorbuffer, x, y, width, height, format, type, pixels, pixels_size); |
| AEMU_SCOPED_TRACE("rcUpdateColorBufferDMA encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = pixels_size; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 4 + 4 + 8 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcUpdateColorBufferDMA;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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; |
| *(uint64_t *)(ptr) = ctx->lockAndWriteDma(pixels, __size_pixels); ptr += 8; |
| memcpy(ptr, &pixels_size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcUpdateColorBufferDMA: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| uint32_t rcCreateColorBufferDMA_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat, int frameworkFormat) |
| { |
| ENCODER_DEBUG_LOG("rcCreateColorBufferDMA(width:0x%08x, height:0x%08x, internalFormat:0x%08x, frameworkFormat:%d)", width, height, internalFormat, frameworkFormat); |
| AEMU_SCOPED_TRACE("rcCreateColorBufferDMA encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateColorBufferDMA;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 4); ptr += 4; |
| memcpy(ptr, &frameworkFormat, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateColorBufferDMA: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcWaitSyncKHR_enc(void *self , uint64_t sync, EGLint flags) |
| { |
| ENCODER_DEBUG_LOG("rcWaitSyncKHR(sync:0x%016lx, flags:0x%08x)", sync, flags); |
| AEMU_SCOPED_TRACE("rcWaitSyncKHR encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcWaitSyncKHR;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| memcpy(ptr, &flags, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLint rcCompose_enc(void *self , uint32_t bufferSize, void* buffer) |
| { |
| ENCODER_DEBUG_LOG("rcCompose(bufferSize:0x%08x, buffer:0x%08x)", bufferSize, buffer); |
| AEMU_SCOPED_TRACE("rcCompose encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffer = bufferSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_buffer + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCompose;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bufferSize, 4); ptr += 4; |
| memcpy(ptr, &__size_buffer, 4); ptr += 4; |
| memcpy(ptr, buffer, __size_buffer);ptr += __size_buffer; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCompose: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcCreateDisplay_enc(void *self , uint32_t* displayId) |
| { |
| ENCODER_DEBUG_LOG("rcCreateDisplay(displayId:0x%08x)", displayId); |
| AEMU_SCOPED_TRACE("rcCreateDisplay encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_displayId = sizeof(uint32_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateDisplay;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &__size_displayId, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(displayId, __size_displayId); |
| if (useChecksum) checksumCalculator->addBuffer(displayId, __size_displayId); |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateDisplay: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcDestroyDisplay_enc(void *self , uint32_t displayId) |
| { |
| ENCODER_DEBUG_LOG("rcDestroyDisplay(displayId:0x%08x)", displayId); |
| AEMU_SCOPED_TRACE("rcDestroyDisplay encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcDestroyDisplay;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &displayId, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcDestroyDisplay: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcSetDisplayColorBuffer_enc(void *self , uint32_t displayId, uint32_t colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcSetDisplayColorBuffer(displayId:0x%08x, colorBuffer:0x%08x)", displayId, colorBuffer); |
| AEMU_SCOPED_TRACE("rcSetDisplayColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetDisplayColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &displayId, 4); ptr += 4; |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcSetDisplayColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcGetDisplayColorBuffer_enc(void *self , uint32_t displayId, uint32_t* colorBuffer) |
| { |
| ENCODER_DEBUG_LOG("rcGetDisplayColorBuffer(displayId:0x%08x, colorBuffer:0x%08x)", displayId, colorBuffer); |
| AEMU_SCOPED_TRACE("rcGetDisplayColorBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_colorBuffer = sizeof(uint32_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetDisplayColorBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &displayId, 4); ptr += 4; |
| memcpy(ptr, &__size_colorBuffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(colorBuffer, __size_colorBuffer); |
| if (useChecksum) checksumCalculator->addBuffer(colorBuffer, __size_colorBuffer); |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetDisplayColorBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcGetColorBufferDisplay_enc(void *self , uint32_t colorBuffer, uint32_t* displayId) |
| { |
| ENCODER_DEBUG_LOG("rcGetColorBufferDisplay(colorBuffer:0x%08x, displayId:0x%08x)", colorBuffer, displayId); |
| AEMU_SCOPED_TRACE("rcGetColorBufferDisplay encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_displayId = sizeof(uint32_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetColorBufferDisplay;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| memcpy(ptr, &__size_displayId, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(displayId, __size_displayId); |
| if (useChecksum) checksumCalculator->addBuffer(displayId, __size_displayId); |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetColorBufferDisplay: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcGetDisplayPose_enc(void *self , uint32_t displayId, GLint* x, GLint* y, uint32_t* w, uint32_t* h) |
| { |
| ENCODER_DEBUG_LOG("rcGetDisplayPose(displayId:0x%08x, x:0x%08x, y:0x%08x, w:0x%08x, h:0x%08x)", displayId, x, y, w, h); |
| AEMU_SCOPED_TRACE("rcGetDisplayPose encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_x = sizeof(int32_t); |
| const unsigned int __size_y = sizeof(int32_t); |
| const unsigned int __size_w = sizeof(uint32_t); |
| const unsigned int __size_h = sizeof(uint32_t); |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 0 + 0 + 0 + 0 + 4*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcGetDisplayPose;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &displayId, 4); ptr += 4; |
| memcpy(ptr, &__size_x, 4); ptr += 4; |
| memcpy(ptr, &__size_y, 4); ptr += 4; |
| memcpy(ptr, &__size_w, 4); ptr += 4; |
| memcpy(ptr, &__size_h, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(x, __size_x); |
| if (useChecksum) checksumCalculator->addBuffer(x, __size_x); |
| stream->readback(y, __size_y); |
| if (useChecksum) checksumCalculator->addBuffer(y, __size_y); |
| stream->readback(w, __size_w); |
| if (useChecksum) checksumCalculator->addBuffer(w, __size_w); |
| stream->readback(h, __size_h); |
| if (useChecksum) checksumCalculator->addBuffer(h, __size_h); |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcGetDisplayPose: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcSetDisplayPose_enc(void *self , uint32_t displayId, GLint x, GLint y, uint32_t w, uint32_t h) |
| { |
| ENCODER_DEBUG_LOG("rcSetDisplayPose(displayId:0x%08x, x:0x%08x, y:0x%08x, w:0x%08x, h:0x%08x)", displayId, x, y, w, h); |
| AEMU_SCOPED_TRACE("rcSetDisplayPose encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetDisplayPose;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &displayId, 4); ptr += 4; |
| memcpy(ptr, &x, 4); ptr += 4; |
| memcpy(ptr, &y, 4); ptr += 4; |
| memcpy(ptr, &w, 4); ptr += 4; |
| memcpy(ptr, &h, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcSetDisplayPose: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| GLint rcSetColorBufferVulkanMode_enc(void *self , uint32_t colorBuffer, uint32_t mode) |
| { |
| ENCODER_DEBUG_LOG("rcSetColorBufferVulkanMode(colorBuffer:0x%08x, mode:0x%08x)", colorBuffer, mode); |
| AEMU_SCOPED_TRACE("rcSetColorBufferVulkanMode encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetColorBufferVulkanMode;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| memcpy(ptr, &mode, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcSetColorBufferVulkanMode: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcReadColorBufferYUV_enc(void *self , uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, void* pixels, uint32_t pixels_size) |
| { |
| ENCODER_DEBUG_LOG("rcReadColorBufferYUV(colorbuffer:0x%08x, x:0x%08x, y:0x%08x, width:0x%08x, height:0x%08x, pixels:0x%08x, pixels_size:0x%08x)", colorbuffer, x, y, width, height, pixels, pixels_size); |
| AEMU_SCOPED_TRACE("rcReadColorBufferYUV encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_pixels = pixels_size; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4 + 4 + 0 + 4 + 1*4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcReadColorBufferYUV;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 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, &__size_pixels, 4); ptr += 4; |
| memcpy(ptr, &pixels_size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->readback(pixels, __size_pixels); |
| if (useChecksum) checksumCalculator->addBuffer(pixels, __size_pixels); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcReadColorBufferYUV: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| } |
| |
| int rcIsSyncSignaled_enc(void *self , uint64_t sync) |
| { |
| ENCODER_DEBUG_LOG("rcIsSyncSignaled(sync:0x%016lx)", sync); |
| AEMU_SCOPED_TRACE("rcIsSyncSignaled encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcIsSyncSignaled;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &sync, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcIsSyncSignaled: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcCreateColorBufferWithHandle_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat, uint32_t handle) |
| { |
| ENCODER_DEBUG_LOG("rcCreateColorBufferWithHandle(width:0x%08x, height:0x%08x, internalFormat:0x%08x, handle:0x%08x)", width, height, internalFormat, handle); |
| AEMU_SCOPED_TRACE("rcCreateColorBufferWithHandle encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateColorBufferWithHandle;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &width, 4); ptr += 4; |
| memcpy(ptr, &height, 4); ptr += 4; |
| memcpy(ptr, &internalFormat, 4); ptr += 4; |
| memcpy(ptr, &handle, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| uint32_t rcCreateBuffer_enc(void *self , uint32_t size) |
| { |
| ENCODER_DEBUG_LOG("rcCreateBuffer(size:0x%08x)", size); |
| AEMU_SCOPED_TRACE("rcCreateBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &size, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateBuffer: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcCloseBuffer_enc(void *self , uint32_t buffer) |
| { |
| ENCODER_DEBUG_LOG("rcCloseBuffer(buffer:0x%08x)", buffer); |
| AEMU_SCOPED_TRACE("rcCloseBuffer encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCloseBuffer;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &buffer, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| GLint rcSetColorBufferVulkanMode2_enc(void *self , uint32_t colorBuffer, uint32_t mode, uint32_t memoryProperty) |
| { |
| ENCODER_DEBUG_LOG("rcSetColorBufferVulkanMode2(colorBuffer:0x%08x, mode:0x%08x, memoryProperty:0x%08x)", colorBuffer, mode, memoryProperty); |
| AEMU_SCOPED_TRACE("rcSetColorBufferVulkanMode2 encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetColorBufferVulkanMode2;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &colorBuffer, 4); ptr += 4; |
| memcpy(ptr, &mode, 4); ptr += 4; |
| memcpy(ptr, &memoryProperty, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| GLint retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcSetColorBufferVulkanMode2: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcMapGpaToBufferHandle_enc(void *self , uint32_t bufferHandle, uint64_t gpa) |
| { |
| ENCODER_DEBUG_LOG("rcMapGpaToBufferHandle(bufferHandle:0x%08x, gpa:0x%016lx)", bufferHandle, gpa); |
| AEMU_SCOPED_TRACE("rcMapGpaToBufferHandle encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcMapGpaToBufferHandle;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bufferHandle, 4); ptr += 4; |
| memcpy(ptr, &gpa, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcMapGpaToBufferHandle: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| uint32_t rcCreateBuffer2_enc(void *self , uint64_t size, uint32_t memoryProperty) |
| { |
| ENCODER_DEBUG_LOG("rcCreateBuffer2(size:0x%016lx, memoryProperty:0x%08x)", size, memoryProperty); |
| AEMU_SCOPED_TRACE("rcCreateBuffer2 encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcCreateBuffer2;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &size, 8); ptr += 8; |
| memcpy(ptr, &memoryProperty, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| uint32_t retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcCreateBuffer2: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| int rcMapGpaToBufferHandle2_enc(void *self , uint32_t bufferHandle, uint64_t gpa, uint64_t size) |
| { |
| ENCODER_DEBUG_LOG("rcMapGpaToBufferHandle2(bufferHandle:0x%08x, gpa:0x%016lx, size:0x%016lx)", bufferHandle, gpa, size); |
| AEMU_SCOPED_TRACE("rcMapGpaToBufferHandle2 encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 8 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcMapGpaToBufferHandle2;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &bufferHandle, 4); ptr += 4; |
| memcpy(ptr, &gpa, 8); ptr += 8; |
| memcpy(ptr, &size, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| |
| int retval; |
| stream->readback(&retval, 4); |
| if (useChecksum) checksumCalculator->addBuffer(&retval, 4); |
| if (useChecksum) { |
| unsigned char *checksumBufPtr = NULL; |
| unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize]; |
| if (checksumSize > 0) checksumBufPtr = &checksumBuf[0]; |
| stream->readback(checksumBufPtr, checksumSize); |
| if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) { |
| ALOGE("rcMapGpaToBufferHandle2: GL communication error, please report this issue to b.android.com.\n"); |
| abort(); |
| } |
| } |
| return retval; |
| } |
| |
| void rcFlushWindowColorBufferAsyncWithFrameNumber_enc(void *self , uint32_t windowSurface, uint32_t frameNumber) |
| { |
| ENCODER_DEBUG_LOG("rcFlushWindowColorBufferAsyncWithFrameNumber(windowSurface:0x%08x, frameNumber:0x%08x)", windowSurface, frameNumber); |
| AEMU_SCOPED_TRACE("rcFlushWindowColorBufferAsyncWithFrameNumber encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcFlushWindowColorBufferAsyncWithFrameNumber;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &windowSurface, 4); ptr += 4; |
| memcpy(ptr, &frameNumber, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcSetTracingForPuid_enc(void *self , uint64_t puid, uint32_t enable, uint64_t guestTime) |
| { |
| ENCODER_DEBUG_LOG("rcSetTracingForPuid(puid:0x%016lx, enable:0x%08x, guestTime:0x%016lx)", puid, enable, guestTime); |
| AEMU_SCOPED_TRACE("rcSetTracingForPuid encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 8 + 4 + 8; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcSetTracingForPuid;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &puid, 8); ptr += 8; |
| memcpy(ptr, &enable, 4); ptr += 4; |
| memcpy(ptr, &guestTime, 8); ptr += 8; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| } |
| |
| void rcMakeCurrentAsync_enc(void *self , uint32_t context, uint32_t drawSurf, uint32_t readSurf) |
| { |
| ENCODER_DEBUG_LOG("rcMakeCurrentAsync(context:0x%08x, drawSurf:0x%08x, readSurf:0x%08x)", context, drawSurf, readSurf); |
| AEMU_SCOPED_TRACE("rcMakeCurrentAsync encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4; |
| const size_t checksumSize = checksumCalculator->checksumByteSize(); |
| const size_t totalSize = sizeWithoutChecksum + checksumSize; |
| buf = stream->alloc(totalSize); |
| ptr = buf; |
| int tmp = OP_rcMakeCurrentAsync;memcpy(ptr, &tmp, 4); ptr += 4; |
| memcpy(ptr, &totalSize, 4); ptr += 4; |
| |
| memcpy(ptr, &context, 4); ptr += 4; |
| memcpy(ptr, &drawSurf, 4); ptr += 4; |
| memcpy(ptr, &readSurf, 4); ptr += 4; |
| |
| if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf); |
| if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize; |
| |
| stream->flush(); |
| } |
| |
| void rcComposeAsync_enc(void *self , uint32_t bufferSize, void* buffer) |
| { |
| ENCODER_DEBUG_LOG("rcComposeAsync(bufferSize:0x%08x, buffer:0x%08x)", bufferSize, buffer); |
| AEMU_SCOPED_TRACE("rcComposeAsync encode"); |
| |
| renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self; |
| IOStream *stream = ctx->m_stream; |
| ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator; |
| bool useChecksum = checksumCalculator->getVersion() > 0; |
| |
| const unsigned int __size_buffer = bufferSize; |
| unsigned char *ptr; |
| unsigned char *buf; |
| const size_t sizeWithoutChecksum = 8 + 4 + __size_
|