aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@google.com>2014-07-08 16:17:55 +0200
committerDavid 'Digit' Turner <digit@google.com>2014-07-08 16:17:55 +0200
commit312fcf92af876b0b2ca1f5458f298bce68a4706b (patch)
tree3025b4d90802d6047b3fb7e6a186c0dedd930c81 /emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
parent6d9e91d7edd66871fed9a9cf9ff6613b63427ed4 (diff)
downloadsdk-312fcf92af876b0b2ca1f5458f298bce68a4706b.zip
sdk-312fcf92af876b0b2ca1f5458f298bce68a4706b.tar.gz
sdk-312fcf92af876b0b2ca1f5458f298bce68a4706b.tar.bz2
emulator/opengl: Add global lock to libOpenglRender.
This patch ensures that all render threads use the same global lock to synchronize calls to the underlying GLES/EGL libraries. Original patch from Thomas Knych (thomaswk@google.com) BUG=9627179 Change-Id: I8ac9a43bc30bba8a9a06f832cf29e72263d946ce
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
index 9ae2a43..19d6c1f 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
@@ -25,9 +25,10 @@
#define STREAM_BUFFER_SIZE 4*1024*1024
-RenderThread::RenderThread() :
+RenderThread::RenderThread(IOStream *stream, emugl::Mutex *lock) :
osUtils::Thread(),
- m_stream(NULL),
+ m_lock(lock),
+ m_stream(stream),
m_finished(false)
{
}
@@ -37,16 +38,9 @@ RenderThread::~RenderThread()
delete m_stream;
}
-RenderThread *RenderThread::create(IOStream *p_stream)
+RenderThread *RenderThread::create(IOStream *p_stream, emugl::Mutex *lock)
{
- RenderThread *rt = new RenderThread();
- if (!rt) {
- return NULL;
- }
-
- rt->m_stream = p_stream;
-
- return rt;
+ return new RenderThread(p_stream, lock);
}
int RenderThread::Main()
@@ -113,6 +107,7 @@ int RenderThread::Main()
do {
progress = false;
+ m_lock->lock();
//
// try to process some of the command buffer using the GLESv1 decoder
//
@@ -141,6 +136,8 @@ int RenderThread::Main()
progress = true;
}
+ m_lock->unlock();
+
} while( progress );
}