aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-07-21 16:22:38 +0000
committerandroid-build-merger <android-build-merger@google.com>2014-07-21 16:22:38 +0000
commitc245592b0d472437ade15a22076c2193441f0eea (patch)
tree889f16f76567054ea5fc085f274ceade0a09bd81 /emulator/opengl/host
parent245fae139423eb268ecb3eaa06f6ce8c7044c4f4 (diff)
parent4e4233679d4ef4e25d13fe3b56bd8cdaa3b822cc (diff)
downloadsdk-c245592b0d472437ade15a22076c2193441f0eea.zip
sdk-c245592b0d472437ade15a22076c2193441f0eea.tar.gz
sdk-c245592b0d472437ade15a22076c2193441f0eea.tar.bz2
Merge changes I551e0f3d,I26d84cf5,I27c993d1 into idea133
automerge: 4e42336 * commit '4e4233679d4ef4e25d13fe3b56bd8cdaa3b822cc': emulator/opengl: Remove out-of-process handling code. emulator/opengl: refactor Thread class. emulator/opengl: refactor shared library handling.
Diffstat (limited to 'emulator/opengl/host')
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/Android.mk4
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp2
-rw-r--r--emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h4
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/Android.mk4
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp2
-rw-r--r--emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h5
-rw-r--r--emulator/opengl/host/libs/Translator/EGL/EglImp.cpp4
-rw-r--r--emulator/opengl/host/libs/Translator/GLcommon/Android.mk2
-rw-r--r--emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp8
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/Android.mk6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp5
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp7
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp7
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp5
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.h6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp4
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.h6
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/render_api.cpp127
-rw-r--r--emulator/opengl/host/renderer/Android.mk6
-rw-r--r--emulator/opengl/host/renderer/main.cpp2
20 files changed, 47 insertions, 169 deletions
diff --git a/emulator/opengl/host/libs/GLESv1_dec/Android.mk b/emulator/opengl/host/libs/GLESv1_dec/Android.mk
index 7ab3f0a..e0eca6e 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/Android.mk
+++ b/emulator/opengl/host/libs/GLESv1_dec/Android.mk
@@ -10,7 +10,7 @@ host_common_debug_CFLAGS :=
### host library #########################################
$(call emugl-begin-host-static-library,libGLESv1_dec)
-$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
+$(call emugl-import, libOpenglCodecCommon)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-gen-decoder,$(LOCAL_PATH),gl)
@@ -27,7 +27,7 @@ $(call emugl-end-module)
ifdef EMUGL_BUILD_64BITS
$(call emugl-begin-host64-static-library,lib64GLESv1_dec)
- $(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
+ $(call emugl-import, lib64OpenglCodecCommon)
$(call emugl-export,C_INCLUDES,$(LOCAL_PATH))
$(call emugl-gen-decoder,$(LOCAL_PATH),gl)
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
index 3c5bd70..7aa6ede 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
+++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
@@ -47,7 +47,7 @@ int GLDecoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
libname = getenv(GLES_LIBNAME_VAR);
}
- m_glesDso = osUtils::dynLibrary::open(libname);
+ m_glesDso = emugl::SharedLibrary::open(libname);
if (m_glesDso == NULL) {
fprintf(stderr, "Couldn't find %s \n", GLES_LIBNAME);
return -1;
diff --git a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
index 14ca222..0d26090 100644
--- a/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
+++ b/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
@@ -19,7 +19,7 @@
#include "gl_dec.h"
#include "FixedBuffer.h"
#include "GLDecoderContextData.h"
-#include <osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#define GLES_LIBNAME_VAR "ANDROID_GLESv1_LIB"
#define GLES_LIBNAME "libGLES_CM.so"
@@ -65,7 +65,7 @@ private:
static void * s_getProc(const char *name, void *userData);
GLDecoderContextData *m_contextData;
- osUtils::dynLibrary* m_glesDso;
+ emugl::SharedLibrary* m_glesDso;
};
#endif
diff --git a/emulator/opengl/host/libs/GLESv2_dec/Android.mk b/emulator/opengl/host/libs/GLESv2_dec/Android.mk
index bc04c25..f658f11 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/Android.mk
+++ b/emulator/opengl/host/libs/GLESv2_dec/Android.mk
@@ -9,7 +9,7 @@ host_common_debug_CFLAGS :=
### host library ##########################################
$(call emugl-begin-host-static-library,libGLESv2_dec)
-$(call emugl-import, libOpenglCodecCommon libOpenglOsUtils)
+$(call emugl-import, libOpenglCodecCommon)
$(call emugl-gen-decoder,$(LOCAL_PATH),gl2)
# For gl2_types.h !
@@ -24,7 +24,7 @@ $(call emugl-end-module)
### host library, 64-bit ####################################
ifdef EMUGL_BUILD_64BITS
$(call emugl-begin-host64-static-library,lib64GLESv2_dec)
- $(call emugl-import, lib64OpenglCodecCommon lib64OpenglOsUtils)
+ $(call emugl-import, lib64OpenglCodecCommon)
$(call emugl-gen-decoder,$(LOCAL_PATH),gl2)
# For gl2_types.h !
diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
index ccf2f06..2ef306e 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
+++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.cpp
@@ -60,7 +60,7 @@ int GL2Decoder::initGL(get_proc_func_t getProcFunc, void *getProcFuncData)
libname = getenv(GLES2_LIBNAME_VAR);
}
- m_GL2library = osUtils::dynLibrary::open(libname);
+ m_GL2library = emugl::SharedLibrary::open(libname);
if (m_GL2library == NULL) {
fprintf(stderr, "%s: Couldn't find %s \n", __FUNCTION__, libname);
return -1;
diff --git a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
index dcf2c07..8910da9 100644
--- a/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
+++ b/emulator/opengl/host/libs/GLESv2_dec/GL2Decoder.h
@@ -21,9 +21,8 @@
#define GLES2_LIBNAME "libGLESv2.so"
#include "gl2_dec.h"
-#include "osDynLibrary.h"
#include "GLDecoderContextData.h"
-
+#include "emugl/common/shared_library.h"
class GL2Decoder : public gl2_decoder_context_t
{
@@ -35,7 +34,7 @@ public:
void setContextData(GLDecoderContextData *contextData) { m_contextData = contextData; }
private:
GLDecoderContextData *m_contextData;
- osUtils::dynLibrary * m_GL2library;
+ emugl::SharedLibrary* m_GL2library;
static void *s_getProc(const char *name, void *userData);
static void gl2_APIENTRY s_glGetCompressedTextureFormats(void *self, int count, GLint *formats);
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
index 06dcf67..30d358f 100644
--- a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp
@@ -24,7 +24,7 @@
#include <stdio.h>
#include "ThreadInfo.h"
#include <GLcommon/TranslatorIfaces.h>
-#include <OpenglOsUtils/osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#include "EglWindowSurface.h"
#include "EglPbufferSurface.h"
@@ -175,7 +175,7 @@ EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) {
#define TRANSLATOR_GETIFACE_NAME "__translator_getIfaces"
static __translator_getGLESIfaceFunc loadIfaces(const char* libName){
- osUtils::dynLibrary* libGLES = osUtils::dynLibrary::open(libName);
+ emugl::SharedLibrary* libGLES = emugl::SharedLibrary::open(libName);
if(!libGLES) return NULL;
__translator_getGLESIfaceFunc func = (__translator_getGLESIfaceFunc)libGLES->findSymbol(TRANSLATOR_GETIFACE_NAME);
diff --git a/emulator/opengl/host/libs/Translator/GLcommon/Android.mk b/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
index b215329..fdbedad 100644
--- a/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
+++ b/emulator/opengl/host/libs/Translator/GLcommon/Android.mk
@@ -35,7 +35,6 @@ endif
$(call emugl-begin-host-static-library,libGLcommon)
-$(call emugl-import,libOpenglOsUtils)
translator_path := $(LOCAL_PATH)/..
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
$(call emugl-export,LDLIBS,$(host_common_LDLIBS))
@@ -50,7 +49,6 @@ $(call emugl-end-module)
ifdef EMUGL_BUILD_64BITS
$(call emugl-begin-host64-static-library,lib64GLcommon)
- $(call emugl-import,lib64OpenglOsUtils)
translator_path := $(LOCAL_PATH)/..
LOCAL_SRC_FILES := $(host_common_SRC_FILES)
LOCAL_CFLAGS += -fPIC
diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
index 7b217fd..5da7247 100644
--- a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
+++ b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp
@@ -16,7 +16,7 @@
#include <GLcommon/GLDispatch.h>
#include <stdio.h>
-#include <OpenglOsUtils/osDynLibrary.h>
+#include "emugl/common/shared_library.h"
#ifdef __linux__
#include <GL/glx.h>
@@ -31,13 +31,13 @@ typedef void (*GL_FUNC_PTR)();
static GL_FUNC_PTR getGLFuncAddress(const char *funcName) {
GL_FUNC_PTR ret = NULL;
#ifdef __linux__
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("libGL.so");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("libGL");
ret = (GL_FUNC_PTR)glXGetProcAddress((const GLubyte*)funcName);
#elif defined(WIN32)
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("opengl32");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("opengl32");
ret = (GL_FUNC_PTR)wglGetProcAddress(funcName);
#elif defined(__APPLE__)
- static osUtils::dynLibrary* libGL = osUtils::dynLibrary::open("/System/Library/Frameworks/OpenGL.framework/OpenGL");
+ static emugl::SharedLibrary* libGL = emugl::SharedLibrary::open("/System/Library/Frameworks/OpenGL.framework/OpenGL");
#endif
if(!ret && libGL){
ret = libGL->findSymbol(funcName);
diff --git a/emulator/opengl/host/libs/libOpenglRender/Android.mk b/emulator/opengl/host/libs/libOpenglRender/Android.mk
index 787ae83..ca5a08a 100644
--- a/emulator/opengl/host/libs/libOpenglRender/Android.mk
+++ b/emulator/opengl/host/libs/libOpenglRender/Android.mk
@@ -5,7 +5,7 @@ host_common_LDLIBS :=
ifeq ($(HOST_OS),linux)
host_OS_SRCS = NativeLinuxSubWindow.cpp
- host_common_LDLIBS += -lX11
+ host_common_LDLIBS += -lX11 -lrt
endif
ifeq ($(HOST_OS),darwin)
@@ -43,7 +43,7 @@ host_common_CFLAGS :=
### host libOpenglRender #################################################
$(call emugl-begin-host-shared-library,libOpenglRender)
-$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon libOpenglOsUtils)
+$(call emugl-import,libGLESv1_dec libGLESv2_dec lib_renderControl_dec libOpenglCodecCommon)
LOCAL_LDLIBS += $(host_common_LDLIBS)
@@ -65,7 +65,7 @@ $(call emugl-end-module)
ifdef EMUGL_BUILD_64BITS
$(call emugl-begin-host64-shared-library,lib64OpenglRender)
- $(call emugl-import,lib64GLESv1_dec lib64GLESv2_dec lib64_renderControl_dec lib64OpenglCodecCommon lib64OpenglOsUtils)
+ $(call emugl-import,lib64GLESv1_dec lib64GLESv2_dec lib64_renderControl_dec lib64OpenglCodecCommon)
#LOCAL_LDFLAGS += -m64 # adding -m64 here doesn't work, because it somehow appear BEFORE -m32 in command-line.
LOCAL_LDLIBS += $(host_common_LDLIBS) -m64 # Put -m64 it in LOCAL_LDLIBS instead.
diff --git a/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
index 3cf5dbc..7d514e8 100644
--- a/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/EGLDispatch.cpp
@@ -16,7 +16,8 @@
#include "EGLDispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
EGLDispatch s_egl;
@@ -28,7 +29,7 @@ bool init_egl_dispatch()
const char *libName = getenv("ANDROID_EGL_LIB");
if (!libName) libName = DEFAULT_EGL_LIB;
- osUtils::dynLibrary *lib = osUtils::dynLibrary::open(libName);
+ emugl::SharedLibrary *lib = emugl::SharedLibrary::open(libName);
if (!lib) {
printf("Failed to open %s\n", libName);
return NULL;
diff --git a/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
index cda205f..8c51a4e 100644
--- a/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/GL2Dispatch.cpp
@@ -17,12 +17,13 @@
#include "GL2Dispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
gl2_decoder_context_t s_gl2;
int s_gl2_enabled;
-static osUtils::dynLibrary *s_gles2_lib = NULL;
+static emugl::SharedLibrary *s_gles2_lib = NULL;
#define DEFAULT_GLES_V2_LIB EMUGL_LIBNAME("GLES_V2_translator")
@@ -38,7 +39,7 @@ bool init_gl2_dispatch()
//
// Load the GLES library
//
- s_gles2_lib = osUtils::dynLibrary::open(libName);
+ s_gles2_lib = emugl::SharedLibrary::open(libName);
if (!s_gles2_lib) return false;
//
diff --git a/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp b/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
index 089512a..c127dc3 100644
--- a/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/GLDispatch.cpp
@@ -16,11 +16,12 @@
#include "GLDispatch.h"
#include <stdio.h>
#include <stdlib.h>
-#include "osDynLibrary.h"
+
+#include "emugl/common/shared_library.h"
GLDispatch s_gl;
-static osUtils::dynLibrary *s_gles_lib = NULL;
+static emugl::SharedLibrary *s_gles_lib = NULL;
//
// This function is called only once during initialiation before
@@ -34,7 +35,7 @@ bool init_gl_dispatch()
const char *libName = getenv("ANDROID_GLESv1_LIB");
if (!libName) libName = DEFAULT_GLES_CM_LIB;
- s_gles_lib = osUtils::dynLibrary::open(libName);
+ s_gles_lib = emugl::SharedLibrary::open(libName);
if (!s_gles_lib) return false;
s_gl.glAlphaFunc = (glAlphaFunc_t) s_gles_lib->findSymbol("glAlphaFunc");
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
index de28f8f..53c65ee 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
@@ -77,7 +77,7 @@ RenderServer *RenderServer::create(char* addr, size_t addrLen)
return server;
}
-int RenderServer::Main()
+intptr_t RenderServer::main()
{
RenderThreadsSet threads;
@@ -146,8 +146,7 @@ int RenderServer::Main()
for (RenderThreadsSet::iterator t = threads.begin();
t != threads.end();
t++) {
- int exitStatus;
- (*t)->wait(&exitStatus);
+ (*t)->wait(NULL);
delete (*t);
}
threads.clear();
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
index ff63c94..8be8a17 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.h
@@ -18,15 +18,15 @@
#include "SocketStream.h"
#include "emugl/common/mutex.h"
-#include "osThread.h"
+#include "emugl/common/thread.h"
-class RenderServer : public osUtils::Thread
+class RenderServer : public emugl::Thread
{
public:
static RenderServer *create(char* addr, size_t addrLen);
virtual ~RenderServer();
- virtual int Main();
+ virtual intptr_t main();
bool isExiting() const { return m_exiting; }
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
index 19d6c1f..3dcfdb5 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
@@ -26,7 +26,7 @@
#define STREAM_BUFFER_SIZE 4*1024*1024
RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock) :
- osUtils::Thread(),
+ emugl::Thread(),
m_lock(lock),
m_stream(stream),
m_finished(false)
@@ -43,7 +43,7 @@ RenderThread *RenderThread::create(IOStream *p_stream, emugl::Mutex *lock)
return new RenderThread(p_stream, lock);
}
-int RenderThread::Main()
+intptr_t RenderThread::main()
{
RenderThreadInfo tInfo;
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
index e94d782..c1f919a 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
@@ -21,9 +21,9 @@
#include "renderControl_dec.h"
#include "emugl/common/mutex.h"
-#include "osThread.h"
+#include "emugl/common/thread.h"
-class RenderThread : public osUtils::Thread
+class RenderThread : public emugl::Thread
{
public:
static RenderThread* create(IOStream* p_stream, emugl::Mutex* mutex);
@@ -32,7 +32,7 @@ public:
private:
RenderThread(IOStream* p_stream, emugl::Mutex* mutex);
- virtual int Main();
+ virtual intptr_t main();
private:
emugl::Mutex *m_lock;
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
index 5c9ffb1..9586091 100644
--- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
@@ -17,7 +17,6 @@
#include "IOStream.h"
#include "FrameBuffer.h"
#include "RenderServer.h"
-#include "osProcess.h"
#include "TimeUtils.h"
#include "TcpStream.h"
@@ -31,25 +30,12 @@
#include "GLDispatch.h"
#include "GL2Dispatch.h"
-static osUtils::childProcess *s_renderProc = NULL;
static RenderServer *s_renderThread = NULL;
static char s_renderAddr[256];
static IOStream *createRenderThread(int p_stream_buffer_size,
unsigned int clientFlags);
-//
-// For now run the renderer as a thread inside the calling
-// process instead as running it in a separate process for all
-// platforms.
-// at the future we want it to run as a seperate process except for
-// Mac OS X since it is imposibble on this platform to make one process
-// render to a window created by another process.
-//
-//#ifdef __APPLE__
-#define RENDER_API_USE_THREAD
-//#endif
-
int initLibrary(void)
{
//
@@ -82,11 +68,10 @@ int initOpenGLRenderer(int width, int height, char* addr, size_t addrLen)
//
// Fail if renderer is already initialized
//
- if (s_renderProc || s_renderThread) {
+ if (s_renderThread) {
return false;
}
-#ifdef RENDER_API_USE_THREAD // should be defined for mac
//
// initialize the renderer and listen to connections
// on a thread in the current process.
@@ -104,110 +89,15 @@ int initOpenGLRenderer(int width, int height, char* addr, size_t addrLen)
s_renderThread->start();
-#else
- if (onPost) {
- // onPost callback not supported with separate renderer process.
- //
- // If we ever revive separate process support, we could make the choice
- // between thread and process at runtime instead of compile time, and
- // choose the thread path if an onPost callback is requested. Or, the
- // callback could be supported with a separate process using shmem or
- // other IPC mechanism.
- return false;
- }
-
- //
- // Launch emulator_renderer
- //
- char cmdLine[128];
- snprintf(cmdLine, 128, "emulator_renderer -windowid %d -port %d -x %d -y %d -width %d -height %d",
- (int)window, portNum, x, y, width, height);
-
- s_renderProc = osUtils::childProcess::create(cmdLine, NULL);
- if (!s_renderProc) {
- return false;
- }
-
- //
- // try to connect to the renderer in order to check it
- // was successfully initialized.
- //
- int nTrys = 0;
- IOStream *dummy = NULL;
- do {
- ++nTrys;
-
- //
- // Wait a bit to make the renderer process a chance to be
- // initialized.
- // On Windows we need during this time to handle windows
- // events since the renderer generates a subwindow of this
- // process's window, we need to be responsive for windows
- // during this time to let the renderer generates this subwindow.
- //
-#ifndef _WIN32
- TimeSleepMS(300);
-#else
- long long t0 = GetCurrentTimeMS();
- while( (GetCurrentTimeMS() - t0) < 300 ) {
- MSG msg;
- int n = 0;
- while( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
- {
- n++;
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
- if (n == 0) TimeSleepMS(10);
- }
-#endif
-
- dummy = createRenderThread(8, 0);
-
- if (!dummy) {
- // stop if the process is no longer running
- if (!osUtils::isProcessRunning(s_renderProc->getPID())) {
- break;
- }
- }
- } while(!dummy && nTrys < 10); // give up after 3 seconds, XXX: ???
-
- if (!dummy) {
- //
- // Failed - make sure the process is killed
- //
- osUtils::KillProcess(s_renderProc->getPID(), true);
- delete s_renderProc;
- s_renderProc = NULL;
- return false;
- }
-
- // destroy the dummy connection
- delete dummy;
-#endif
-
return true;
}
void setPostCallback(OnPostFn onPost, void* onPostContext)
{
-#ifdef RENDER_API_USE_THREAD // should be defined for mac
FrameBuffer* fb = FrameBuffer::getFB();
if (fb) {
fb->setPostCallback(onPost, onPostContext);
}
-#else
- if (onPost) {
- // onPost callback not supported with separate renderer process.
- //
- // If we ever revive separate process support, we could make the choice
- // between thread and process at runtime instead of compile time, and
- // choose the thread path if an onPost callback is requested. Or, the
- // callback could be supported with a separate process using shmem or
- // other IPC mechanism.
- return false;
- }
-#endif
}
void getHardwareStrings(const char** vendor, const char** renderer, const char** version)
@@ -230,21 +120,10 @@ int stopOpenGLRenderer(void)
IOStream *dummy = createRenderThread(8, IOSTREAM_CLIENT_EXIT_SERVER);
if (!dummy) return false;
- if (s_renderProc) {
- //
- // wait for the process to exit
- //
- int exitStatus;
- ret = s_renderProc->wait(&exitStatus);
-
- delete s_renderProc;
- s_renderProc = NULL;
- }
- else if (s_renderThread) {
+ if (s_renderThread) {
// wait for the thread to exit
- int status;
- ret = s_renderThread->wait(&status);
+ ret = s_renderThread->wait(NULL);
delete s_renderThread;
s_renderThread = NULL;
diff --git a/emulator/opengl/host/renderer/Android.mk b/emulator/opengl/host/renderer/Android.mk
index 55fcb80..81dcaf7 100644
--- a/emulator/opengl/host/renderer/Android.mk
+++ b/emulator/opengl/host/renderer/Android.mk
@@ -6,9 +6,9 @@ $(call emugl-import,libOpenglRender)
LOCAL_SRC_FILES := main.cpp
LOCAL_CFLAGS += -O0 -g
-#ifeq ($(HOST_OS),windows)
-#LOCAL_LDLIBS += -lws2_32
-#endif
+ifeq ($(HOST_OS),linux)
+LOCAL_LDLIBS += -lX11
+endif
$(call emugl-end-module)
diff --git a/emulator/opengl/host/renderer/main.cpp b/emulator/opengl/host/renderer/main.cpp
index 2c3f8e2..470e692 100644
--- a/emulator/opengl/host/renderer/main.cpp
+++ b/emulator/opengl/host/renderer/main.cpp
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
//
// run the server listener loop
//
- server->Main();
+ server->main();
#else
//
// on windows we need to handle messages for the