diff options
author | David Turner <digit@android.com> | 2014-04-12 00:11:09 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-12 00:11:09 +0000 |
commit | bd93fee73b02d0b223b441c34a4f8e04eb57291d (patch) | |
tree | b04ffce23835167c8c8938e2e21565393ba4035e /opengl | |
parent | 4f94a5f8b13a5fdd80988e77dd5d468b958b0117 (diff) | |
parent | aedc716648071a1403f4ac92a380d1d4a5377052 (diff) | |
download | android_device_generic_goldfish-bd93fee73b02d0b223b441c34a4f8e04eb57291d.tar.gz android_device_generic_goldfish-bd93fee73b02d0b223b441c34a4f8e04eb57291d.tar.bz2 android_device_generic_goldfish-bd93fee73b02d0b223b441c34a4f8e04eb57291d.zip |
Merge "Support GLES acceleration in 64bit emulator on device side"
Diffstat (limited to 'opengl')
-rw-r--r-- | opengl/system/GLESv1_enc/GLEncoder.cpp | 20 | ||||
-rw-r--r-- | opengl/system/GLESv2_enc/GL2Encoder.cpp | 4 | ||||
-rw-r--r-- | opengl/system/OpenglSystemCommon/ThreadInfo.h | 4 | ||||
-rw-r--r-- | opengl/system/OpenglSystemCommon/gralloc_cb.h | 2 | ||||
-rw-r--r-- | opengl/system/egl/egl.cpp | 19 | ||||
-rw-r--r-- | opengl/system/egl/eglDisplay.cpp | 18 | ||||
-rw-r--r-- | opengl/system/gralloc/gralloc.cpp | 8 |
7 files changed, 47 insertions, 28 deletions
diff --git a/opengl/system/GLESv1_enc/GLEncoder.cpp b/opengl/system/GLESv1_enc/GLEncoder.cpp index 4414f24..989c26f 100644 --- a/opengl/system/GLESv1_enc/GLEncoder.cpp +++ b/opengl/system/GLESv1_enc/GLEncoder.cpp @@ -464,19 +464,19 @@ void GLEncoder::sendVertexData(unsigned int first, unsigned int count) switch(i) { case GLClientState::VERTEX_LOCATION: this->glVertexPointerOffset(this, state->size, state->type, state->stride, - (GLuint)state->data + firstIndex); + (uintptr_t)state->data + firstIndex); break; case GLClientState::NORMAL_LOCATION: this->glNormalPointerOffset(this, state->type, state->stride, - (GLuint) state->data + firstIndex); + (uintptr_t)state->data + firstIndex); break; case GLClientState::POINTSIZE_LOCATION: this->glPointSizePointerOffset(this, state->type, state->stride, - (GLuint) state->data + firstIndex); + (uintptr_t)state->data + firstIndex); break; case GLClientState::COLOR_LOCATION: this->glColorPointerOffset(this, state->size, state->type, state->stride, - (GLuint) state->data + firstIndex); + (uintptr_t)state->data + firstIndex); break; case GLClientState::TEXCOORD0_LOCATION: case GLClientState::TEXCOORD1_LOCATION: @@ -487,17 +487,17 @@ void GLEncoder::sendVertexData(unsigned int first, unsigned int count) case GLClientState::TEXCOORD6_LOCATION: case GLClientState::TEXCOORD7_LOCATION: this->glTexCoordPointerOffset(this, state->size, state->type, state->stride, - (GLuint) state->data + firstIndex); + (uintptr_t)state->data + firstIndex); break; case GLClientState::WEIGHT_LOCATION: this->glWeightPointerOffset(this,state->size,state->type,state->stride, - (GLuint)state->data+firstIndex); + (uintptr_t)state->data+firstIndex); break; case GLClientState::MATRIXINDEX_LOCATION: this->glMatrixIndexPointerOffset(this,state->size,state->type,state->stride, - (GLuint)state->data+firstIndex); + (uintptr_t)state->data+firstIndex); break; - } + } this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo()); } } else { @@ -545,14 +545,14 @@ void GLEncoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum if (!has_immediate_arrays) { ctx->sendVertexData(0, count); ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo()); - ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices); + ctx->glDrawElementsOffset(ctx, mode, count, type, (uintptr_t)indices); adjustIndices = false; } else { BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo()); ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, 0); indices = (void*)((GLintptr)buf->m_fixedBuffer.ptr() + (GLintptr)indices); } - } + } if (adjustIndices) { void *adjustedIndices = (void*)indices; int minIndex = 0, maxIndex = 0; diff --git a/opengl/system/GLESv2_enc/GL2Encoder.cpp b/opengl/system/GLESv2_enc/GL2Encoder.cpp index 7fc32b5..0f5abdd 100644 --- a/opengl/system/GLESv2_enc/GL2Encoder.cpp +++ b/opengl/system/GLESv2_enc/GL2Encoder.cpp @@ -430,7 +430,7 @@ void GL2Encoder::sendVertexAttributes(GLint first, GLsizei count) } else { this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, state->bufferObject); this->glVertexAttribPointerOffset(this, i, state->size, state->type, state->normalized, state->stride, - (GLuint) state->data + firstIndex); + (uintptr_t) state->data + firstIndex); this->m_glBindBuffer_enc(this, GL_ARRAY_BUFFER, m_state->currentArrayVbo()); } } else { @@ -479,7 +479,7 @@ void GL2Encoder::s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum if (!has_immediate_arrays) { ctx->sendVertexAttributes(0, count); ctx->m_glBindBuffer_enc(self, GL_ELEMENT_ARRAY_BUFFER, ctx->m_state->currentIndexVbo()); - ctx->glDrawElementsOffset(ctx, mode, count, type, (GLuint)indices); + ctx->glDrawElementsOffset(ctx, mode, count, type, (uintptr_t)indices); adjustIndices = false; } else { BufferData * buf = ctx->m_shared->getBufferData(ctx->m_state->currentIndexVbo()); diff --git a/opengl/system/OpenglSystemCommon/ThreadInfo.h b/opengl/system/OpenglSystemCommon/ThreadInfo.h index 0328733..f59ce2a 100644 --- a/opengl/system/OpenglSystemCommon/ThreadInfo.h +++ b/opengl/system/OpenglSystemCommon/ThreadInfo.h @@ -40,10 +40,10 @@ EGLThreadInfo *slow_getEGLThreadInfo(); // We have a dedicated TLS slot in bionic inline EGLThreadInfo* getEGLThreadInfo() { EGLThreadInfo *tInfo = - (EGLThreadInfo *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]); + (EGLThreadInfo *)(((uintptr_t *)__get_tls())[TLS_SLOT_OPENGL]); if (!tInfo) { tInfo = slow_getEGLThreadInfo(); - ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)tInfo; + ((uintptr_t *)__get_tls())[TLS_SLOT_OPENGL] = (uintptr_t)tInfo; } return tInfo; } diff --git a/opengl/system/OpenglSystemCommon/gralloc_cb.h b/opengl/system/OpenglSystemCommon/gralloc_cb.h index fd35473..c138964 100644 --- a/opengl/system/OpenglSystemCommon/gralloc_cb.h +++ b/opengl/system/OpenglSystemCommon/gralloc_cb.h @@ -96,7 +96,7 @@ struct cb_handle_t : public native_handle { int glType; // OpenGL type enum used when uploading to host int ashmemSize; // ashmem region size for the buffer (0 unless is HW_FB buffer or // s/w access is needed) - int ashmemBase; // CPU address of the mapped ashmem region + intptr_t ashmemBase; // CPU address of the mapped ashmem region int ashmemBasePid; // process id which mapped the ashmem region int mappedPid; // process id which succeeded gralloc_register call int lockedLeft; // region of buffer locked for s/w write diff --git a/opengl/system/egl/egl.cpp b/opengl/system/egl/egl.cpp index cf3df52..72e0037 100644 --- a/opengl/system/egl/egl.cpp +++ b/opengl/system/egl/egl.cpp @@ -86,7 +86,7 @@ const char * eglStrError(EGLint err) #endif //LOG_EGL_ERRORS #define VALIDATE_CONFIG(cfg,ret) \ - if(((int)cfg<0)||((int)cfg>s_display.getNumConfigs())) { \ + if(((intptr_t)cfg<0)||((intptr_t)cfg>s_display.getNumConfigs())) { \ RETURN_ERROR(ret,EGL_BAD_CONFIG); \ } @@ -268,7 +268,7 @@ EGLBoolean egl_window_surface_t::init() } DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, + rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uintptr_t)config, getWidth(), getHeight()); if (!rcSurface) { ALOGE("rcCreateWindowSurface returned 0"); @@ -371,7 +371,7 @@ EGLBoolean egl_pbuffer_surface_t::init(GLenum pixelFormat) { DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uint32_t)config, + rcSurface = rcEnc->rcCreateWindowSurface(rcEnc, (uintptr_t)config, getWidth(), getHeight()); if (!rcSurface) { ALOGE("rcCreateWindowSurface returned 0"); @@ -563,7 +563,7 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, return EGL_TRUE; } - int i=0; + uintptr_t i=0; for (i=0 ; i<numConfigs && i<config_size ; i++) { *configs++ = (EGLConfig)i; } @@ -585,8 +585,15 @@ EGLBoolean eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig attribs_size++; //for the terminating EGL_NONE } + uint32_t* tempConfigs[config_size]; DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE); - *num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)configs, config_size); + *num_config = rcEnc->rcChooseConfig(rcEnc, (EGLint*)attrib_list, attribs_size * sizeof(EGLint), (uint32_t*)tempConfigs, config_size); + if (configs!=NULL) { + EGLint i=0; + for (i=0;i<(*num_config);i++) { + *((uintptr_t*)configs+i) = *((uint32_t*)tempConfigs+i); + } + } if (*num_config <= 0) return EGL_FALSE; @@ -875,7 +882,7 @@ EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_c } DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_NO_CONTEXT); - uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uint32_t)config, rcShareCtx, version); + uint32_t rcContext = rcEnc->rcCreateContext(rcEnc, (uintptr_t)config, rcShareCtx, version); if (!rcContext) { ALOGE("rcCreateContext returned 0"); setErrorReturn(EGL_BAD_ALLOC, EGL_NO_CONTEXT); diff --git a/opengl/system/egl/eglDisplay.cpp b/opengl/system/egl/eglDisplay.cpp index bcb0d4b..96540aa 100644 --- a/opengl/system/egl/eglDisplay.cpp +++ b/opengl/system/egl/eglDisplay.cpp @@ -84,9 +84,15 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface) // // load GLES client API // +#if __LP64__ + m_gles_iface = loadGLESClientAPI("/system/lib64/egl/libGLESv1_CM_emulation.so", + eglIface, + &s_gles_lib); +#else m_gles_iface = loadGLESClientAPI("/system/lib/egl/libGLESv1_CM_emulation.so", eglIface, &s_gles_lib); +#endif if (!m_gles_iface) { pthread_mutex_unlock(&m_lock); ALOGE("Failed to load gles1 iface"); @@ -94,9 +100,15 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface) } #ifdef WITH_GLES2 +#if __LP64__ + m_gles2_iface = loadGLESClientAPI("/system/lib64/egl/libGLESv2_emulation.so", + eglIface, + &s_gles2_lib); +#else m_gles2_iface = loadGLESClientAPI("/system/lib/egl/libGLESv2_emulation.so", eglIface, &s_gles2_lib); +#endif // Note that if loading gles2 failed, we can still run with no // GLES2 support, having GLES2 is not mandatory. #endif @@ -189,7 +201,7 @@ bool eglDisplay::initialize(EGLClient_eglInterface *eglIface) void eglDisplay::processConfigs() { - for (int i=0; i<m_numConfigs; i++) { + for (intptr_t i=0; i<m_numConfigs; i++) { EGLConfig config = (EGLConfig)i; //Setup the EGL_NATIVE_VISUAL_ID attribute PixelFormat format; @@ -401,7 +413,7 @@ EGLBoolean eglDisplay::getAttribValue(EGLConfig config, EGLint attribIdx, EGLint ALOGE("[%s] Bad attribute idx\n", __FUNCTION__); return EGL_FALSE; } - *value = *(m_configs + (int)config*m_numConfigAttribs + attribIdx); + *value = *(m_configs + (intptr_t)config*m_numConfigAttribs + attribIdx); return EGL_TRUE; } @@ -434,7 +446,7 @@ EGLBoolean eglDisplay::setAttribValue(EGLConfig config, EGLint attribIdx, EGLint ALOGE("[%s] Bad attribute idx\n", __FUNCTION__); return EGL_FALSE; } - *(m_configs + (int)config*m_numConfigAttribs + attribIdx) = value; + *(m_configs + (intptr_t)config*m_numConfigAttribs + attribIdx) = value; return EGL_TRUE; } diff --git a/opengl/system/gralloc/gralloc.cpp b/opengl/system/gralloc/gralloc.cpp index 75909bd..2bdf8da 100644 --- a/opengl/system/gralloc/gralloc.cpp +++ b/opengl/system/gralloc/gralloc.cpp @@ -446,7 +446,7 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) DEFINE_AND_VALIDATE_HOST_CONNECTION; // increment the post count of the buffer - uint32_t *postCountPtr = (uint32_t *)cb->ashmemBase; + intptr_t *postCountPtr = (intptr_t *)cb->ashmemBase; if (!postCountPtr) { // This should not happen return -EINVAL; @@ -638,7 +638,7 @@ static int gralloc_lock(gralloc_module_t const* module, return -EINVAL; } - EGLint postCount = 0; + intptr_t postCount = 0; void *cpu_addr = NULL; // @@ -652,8 +652,8 @@ static int gralloc_lock(gralloc_module_t const* module, } if (cb->canBePosted()) { - postCount = *((int *)cb->ashmemBase); - cpu_addr = (void *)(cb->ashmemBase + sizeof(int)); + postCount = *((intptr_t *)cb->ashmemBase); + cpu_addr = (void *)(cb->ashmemBase + sizeof(intptr_t)); } else { cpu_addr = (void *)(cb->ashmemBase); |