diff options
author | Guy Zadickario <guy@graphtech.co.il> | 2011-07-08 22:25:44 +0300 |
---|---|---|
committer | Guy Zadickario <guy@graphtech.co.il> | 2011-07-08 22:25:44 +0300 |
commit | e2790e0d387de88c7ff5e3c42229c659dbe34524 (patch) | |
tree | 460d0c725e73e05d2367077894b6de7d21146320 /android | |
parent | 44ce50f294d25e15a7b26bbca96d0540724abd9b (diff) | |
download | external_qemu-e2790e0d387de88c7ff5e3c42229c659dbe34524.zip external_qemu-e2790e0d387de88c7ff5e3c42229c659dbe34524.tar.gz external_qemu-e2790e0d387de88c7ff5e3c42229c659dbe34524.tar.bz2 |
opengles qemu-pipe perforance on windows
Set the socket send buffer size to 128k on windows
to allow higher throuput when sending large blocks
over the pipe. On Linux the default value is already
128k. Might want to enable this for all 'tcp" pipes,
currently it is only for the opengles pipe.
Change-Id: I0c6868b6af54b4df1a0257bfe591baab6f76e14a
Diffstat (limited to 'android')
-rw-r--r-- | android/hw-pipe-net.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/android/hw-pipe-net.c b/android/hw-pipe-net.c index 951b4d3..dade446 100644 --- a/android/hw-pipe-net.c +++ b/android/hw-pipe-net.c @@ -68,7 +68,7 @@ typedef struct { int wakeWanted; LoopIo io[1]; AsyncConnector connector[1]; - + int shouldSetSocketOpt; } NetPipe; static void @@ -192,6 +192,7 @@ netPipe_initFromAddress( void* hwpipe, const SockAddress* address, Looper* loop pipe->hwpipe = hwpipe; pipe->state = STATE_INIT; + pipe->shouldSetSocketOpt = 0; { AsyncStatus status; @@ -245,6 +246,19 @@ netPipe_sendBuffers( void* opaque, const GoldfishPipeBuffer* buffers, int numBuf const GoldfishPipeBuffer* buff = buffers; const GoldfishPipeBuffer* buffEnd = buff + numBuffers; +#ifdef _WIN32 + if (pipe->shouldSetSocketOpt == 1) { + int sndbuf = 128 * 1024; + int len = sizeof(sndbuf); + if (setsockopt(pipe->io->fd, SOL_SOCKET, SO_SNDBUF, + (char*)&sndbuf, len) == SOCKET_ERROR) { + D("Failed to set SO_SNDBUF to %d error=0x%x\n", + sndbuf, WSAGetLastError()); + } + pipe->shouldSetSocketOpt = 0; + } +#endif + for (; buff < buffEnd; buff++) count += buff->size; @@ -461,10 +475,14 @@ static void* openglesPipe_init( void* hwpipe, void* _looper, const char* args ) { char temp[32]; + NetPipe *pipe; /* For now, simply connect through tcp */ snprintf(temp, sizeof temp, "%d", DEFAULT_OPENGLES_PORT); - return netPipe_initTcp(hwpipe, _looper, temp); + pipe = (NetPipe *)netPipe_initTcp(hwpipe, _looper, temp); + pipe->shouldSetSocketOpt = 1; + + return pipe; } static const GoldfishPipeFuncs openglesPipe_funcs = { |