summaryrefslogtreecommitdiff
path: root/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2011-09-07 14:48:42 +0200
committerDavid 'Digit' Turner <digit@google.com>2011-09-13 14:03:32 +0200
commit3d76ec1e3cc6a77f0b5f858c839aef27945dd081 (patch)
treedb4cafdf00360bd2248b1ad5462521ab796f9cbe /tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
parent455e444a1fea7e54086d410c1ba5a40ba2693613 (diff)
emulator: opengl: Add support for unix sockets.
This patch allows the OpenGLES rendering library to use Unix sockets instead of TCP ones when communicating with its clients. On certain benchmarks (e.g. 0xBench teapot), this provides a noticeable improvement (x1.05 fps) without any other changes. On practice, Unix sockets are faster than TCP sockets, even local ones. Also, this introduces a moderate amount of abstraction that will allow us to use Win32 named pipes on Windows (where TCP sockets are much slower than they are on Unix). Note that by default, TCP streams are still used. The client (emulator) must call the new API 'setStreamMode' to change it to STREAM_MODE_UNIX between 'initLibrary' and 'startOpenglRenderer' calls. + Adjust callers / user appropriately. Change-Id: I4105bbf07541f3146b50a58d1a5b51e8cf044fab
Diffstat (limited to 'tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp')
-rw-r--r--tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
index c967b4f58..29273416c 100644
--- a/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
+++ b/tools/emulator/opengl/system/OpenglSystemCommon/HostConnection.cpp
@@ -60,22 +60,6 @@ HostConnection *HostConnection::get()
return NULL;
}
-#if 0
- TcpStream *stream = new TcpStream(STREAM_BUFFER_SIZE);
- if (stream) {
- if (stream->connect("10.0.2.2", STREAM_PORT_NUM) < 0) {
- LOGE("Failed to connect to host (TcpStream)!!!\n");
- delete stream;
- stream = NULL;
- }
- else {
- con->m_stream = stream;
- LOGE("Established TCP connection with HOST\n");
- }
- }
- if (!stream)
-#endif
-
if (useQemuPipe) {
QemuPipeStream *stream = new QemuPipeStream(STREAM_BUFFER_SIZE);
if (!stream) {
@@ -108,11 +92,11 @@ HostConnection *HostConnection::get()
}
// send zero 'clientFlags' to the host.
- unsigned int *pClientFlags =
+ unsigned int *pClientFlags =
(unsigned int *)con->m_stream->allocBuffer(sizeof(unsigned int));
*pClientFlags = 0;
con->m_stream->commitBuffer(sizeof(unsigned int));
-
+
LOGD("HostConnection::get() New Host Connection established %p, tid %d\n", con, gettid());
tinfo->hostConn = con;
}