aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-07-11 16:25:37 -0700
committerJesse Hall <jessehall@google.com>2012-07-11 16:45:58 -0700
commitdca7f2a6ac56567850e0e03a063e1739e43c5ce2 (patch)
treedb0b5bd48d23a9bd1e03c23f1995802222516775 /emulator/opengl/host/libs/libOpenglRender/render_api.cpp
parent310777dae93bc4e402ec8a807ce3151271d1038b (diff)
downloadsdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.zip
sdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.tar.gz
sdk-dca7f2a6ac56567850e0e03a063e1739e43c5ce2.tar.bz2
Use a per-process server address for the GLES server
Previously we used a hardcoded address (tcp port, unix pipe path, etc.) for the OpenGLRender system. Multiple emulators would all try to listen on the same address, with the system non-deterministically (?) choosing which one accepted each new connection. This resulted in frames going to the wrong emulator window, one emulator shutting down another's OpenGL system, etc. Now the OpenGLRender server requests an unused tcp port or derives a path from the pid, and reports the address back to the emulator client to use for future connections from the guest. Change-Id: I6af2eac0c7f27670a3b6595772eebc7aa2b24688
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender/render_api.cpp')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/render_api.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
index 72cd9ba..5c9ffb1 100644
--- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
@@ -33,7 +33,7 @@
static osUtils::childProcess *s_renderProc = NULL;
static RenderServer *s_renderThread = NULL;
-static int s_renderPort = 0;
+static char s_renderAddr[256];
static IOStream *createRenderThread(int p_stream_buffer_size,
unsigned int clientFlags);
@@ -76,7 +76,7 @@ int initLibrary(void)
return true;
}
-int initOpenGLRenderer(int width, int height, int portNum)
+int initOpenGLRenderer(int width, int height, char* addr, size_t addrLen)
{
//
@@ -86,8 +86,6 @@ int initOpenGLRenderer(int width, int height, int portNum)
return false;
}
- s_renderPort = portNum;
-
#ifdef RENDER_API_USE_THREAD // should be defined for mac
//
// initialize the renderer and listen to connections
@@ -98,10 +96,11 @@ int initOpenGLRenderer(int width, int height, int portNum)
return false;
}
- s_renderThread = RenderServer::create(portNum);
+ s_renderThread = RenderServer::create(addr, addrLen);
if (!s_renderThread) {
return false;
}
+ strncpy(s_renderAddr, addr, sizeof(s_renderAddr));
s_renderThread->start();
@@ -345,7 +344,7 @@ IOStream *createRenderThread(int p_stream_buffer_size, unsigned int clientFlags)
ERR("createRenderThread failed to create stream\n");
return NULL;
}
- if (stream->connect(s_renderPort) < 0) {
+ if (stream->connect(s_renderAddr) < 0) {
ERR("createRenderThread failed to connect\n");
delete stream;
return NULL;