aboutsummaryrefslogtreecommitdiffstats
path: root/android/opengles.c
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-07-11 16:48:28 -0700
committerJesse Hall <jessehall@google.com>2012-07-11 16:48:28 -0700
commit055adab0b70c70890634649a27c12b2c25afcaca (patch)
tree4338811f487cd81e377017016e3a1779bcd3a7e6 /android/opengles.c
parenta593847491224cfab9eb94b1e36c85333dc081da (diff)
downloadexternal_qemu-055adab0b70c70890634649a27c12b2c25afcaca.zip
external_qemu-055adab0b70c70890634649a27c12b2c25afcaca.tar.gz
external_qemu-055adab0b70c70890634649a27c12b2c25afcaca.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: I139d32615200b36b87f2d2ede4abb4060ec02776
Diffstat (limited to 'android/opengles.c')
-rw-r--r--android/opengles.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/android/opengles.c b/android/opengles.c
index 7405750..1fa6421 100644
--- a/android/opengles.c
+++ b/android/opengles.c
@@ -61,6 +61,7 @@ extern int android_init_opengles_pipes(void);
static ADynamicLibrary* rendererLib;
static int rendererStarted;
+static char rendererAddress[256];
/* Define the function pointers */
#define DYNLINK_FUNC(name) \
@@ -152,7 +153,7 @@ android_startOpenglesRenderer(int width, int height)
return 0;
}
- if (!initOpenGLRenderer(width, height, ANDROID_OPENGLES_BASE_PORT)) {
+ if (!initOpenGLRenderer(width, height, rendererAddress, sizeof(rendererAddress))) {
D("Can't start OpenGLES renderer?");
return -1;
}
@@ -177,7 +178,6 @@ static void strncpy_safe(char* dst, const char* src, size_t n)
static void extractBaseString(char* dst, const char* src, size_t dstSize)
{
- size_t len = strlen(src);
const char* begin = strchr(src, '(');
const char* end = strrchr(src, ')');
@@ -211,7 +211,7 @@ android_getOpenglesHardwareStrings(char* vendor, size_t vendorBufSize,
if (!rendererStarted) {
D("Can't get OpenGL ES hardware strings when renderer not started");
- vendor[0] = renderer[0] = version = '\0';
+ vendor[0] = renderer[0] = version[0] = '\0';
return;
}
@@ -274,18 +274,9 @@ android_redrawOpenglesWindow(void)
}
void
-android_gles_unix_path(char* buff, size_t buffsize, int port)
+android_gles_server_path(char* buff, size_t buffsize)
{
- const char* user = getenv("USER");
- char *p = buff, *end = buff + buffsize;
-
- /* The logic here must correspond to the one inside
- * development/tools/emulator/opengl/shared/libOpenglCodecCommon/UnixStream.cpp */
- p = bufprint(p, end, "/tmp/");
- if (user && user[0]) {
- p = bufprint(p, end, "android-%s/", user);
- }
- p = bufprint(p, end, "qemu-gles-%d", port);
+ strncpy_safe(buff, rendererAddress, buffsize);
}
#else // CONFIG_ANDROID_OPENGLES
@@ -330,7 +321,7 @@ int android_hideOpenglesWindow(void)
void android_redrawOpenglesWindow(void)
{}
-void android_gles_unix_path(char* buff, size_t buffsize, int port)
+void android_gles_server_path(char* buff, size_t buffsize)
{
buff[0] = '\0';
}