am ecd4dd7b: Merge "emulator opengl - ensure server connection for rendering thread"

* commit 'ecd4dd7b6a7ab9a88454ebef17a07a34f3ce966d':
  emulator opengl - ensure server connection for rendering thread
This commit is contained in:
David Turner
2011-05-03 12:54:40 -07:00
committed by Android Git Automerger

View File

@@ -406,7 +406,11 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
{ {
return getDispatch()->eglQuerySurface(dpy, surface, attribute, value); EGLBoolean res = getDispatch()->eglQuerySurface(dpy, surface, attribute, value);
if (res && attribute == EGL_RENDERABLE_TYPE) {
*value |= EGL_OPENGL_ES2_BIT;
}
return res;
} }
EGLBoolean eglBindAPI(EGLenum api) EGLBoolean eglBindAPI(EGLenum api)
@@ -508,8 +512,9 @@ EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
res = getDispatch()->eglDestroyContext(dpy, wctx->aglContext); res = getDispatch()->eglDestroyContext(dpy, wctx->aglContext);
if (res) { if (res) {
EGLThreadInfo *ti = getEGLThreadInfo(); EGLThreadInfo *ti = getEGLThreadInfo();
if (s_needEncode && ti->serverConn) { ServerConnection *server;
ti->serverConn->utEnc()->destroyContext(ti->serverConn->utEnc(), getpid(), (uint32_t)ctx); if (s_needEncode && (server = ServerConnection::s_getServerConnection())) {
server->utEnc()->destroyContext(ti->serverConn->utEnc(), getpid(), (uint32_t)ctx);
} }
if (ti->currentContext == wctx) ti->currentContext = NULL; if (ti->currentContext == wctx) ti->currentContext = NULL;
delete wctx; delete wctx;
@@ -526,14 +531,17 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
EGLThreadInfo *ti = getEGLThreadInfo(); EGLThreadInfo *ti = getEGLThreadInfo();
EGLBoolean res = getDispatch()->eglMakeCurrent(dpy, draw, read, aglContext); EGLBoolean res = getDispatch()->eglMakeCurrent(dpy, draw, read, aglContext);
if (res ) { if (res ) {
// NOTE - we do get a pointer to the server connection, (rather then using ti->serverConn)
// for cases that this is the first egl call of the current thread.
ServerConnection *server; ServerConnection *server;
if (s_needEncode && ti->serverConn) { if (s_needEncode && (server = ServerConnection::s_getServerConnection())) {
ti->serverConn->utEnc()->makeCurrentContext(ti->serverConn->utEnc(), getpid(), server->utEnc()->makeCurrentContext(server->utEnc(), getpid(),
(uint32_t) (draw == EGL_NO_SURFACE ? 0 : draw), (uint32_t) (draw == EGL_NO_SURFACE ? 0 : draw),
(uint32_t) (read == EGL_NO_SURFACE ? 0 : read), (uint32_t) (read == EGL_NO_SURFACE ? 0 : read),
(uint32_t) (ctx == EGL_NO_CONTEXT ? 0 : ctx)); (uint32_t) (ctx == EGL_NO_CONTEXT ? 0 : ctx));
ti->serverConn->glEncoder()->setClientState( wctx ? wctx->clientState : NULL ); server->glEncoder()->setClientState( wctx ? wctx->clientState : NULL );
ti->serverConn->gl2Encoder()->setClientState( wctx ? wctx->clientState : NULL ); server->gl2Encoder()->setClientState( wctx ? wctx->clientState : NULL );
} }
// set current context in our thread info // set current context in our thread info