diff options
author | David 'Digit' Turner <digit@google.com> | 2014-03-10 15:16:30 +0100 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-03-11 10:24:51 +0100 |
commit | aac93f1585bc9bdf8a57b6ed3c47c24f56a3990a (patch) | |
tree | 27409568ac69f1efca05cbe75bc10883088db5c2 /emulator/opengl/host/libs/libOpenglRender | |
parent | fd8752eb6a438832e0ba9a19db896614403f8945 (diff) | |
download | sdk-aac93f1585bc9bdf8a57b6ed3c47c24f56a3990a.zip sdk-aac93f1585bc9bdf8a57b6ed3c47c24f56a3990a.tar.gz sdk-aac93f1585bc9bdf8a57b6ed3c47c24f56a3990a.tar.bz2 |
emulator/opengl: Remove android::Mutex.
This patch removes the dependency on android::Mutex from
<cutils/threads.h> by providing a custom implementation, which
is a simple wrapper around pthread_mutex_t / CriticalSection,
under shared/emugl/common/mutex.h
+ Provide unit tests.
Change-Id: I379ef0c480c478ab9ba5f2faaf8274267eff37ba
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender')
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp | 28 | ||||
-rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h | 5 |
2 files changed, 17 insertions, 16 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp index cfadf12..238f2c9 100644 --- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp @@ -393,7 +393,7 @@ FrameBuffer::~FrameBuffer() void FrameBuffer::setPostCallback(OnPostFn onPost, void* onPostContext) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); m_onPost = onPost; m_onPostContext = onPostContext; if (m_onPost && !m_fbImage) { @@ -490,7 +490,7 @@ HandleType FrameBuffer::genHandle() HandleType FrameBuffer::createColorBuffer(int p_width, int p_height, GLenum p_internalFormat) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); HandleType ret = 0; ColorBufferPtr cb( ColorBuffer::create(p_width, p_height, p_internalFormat) ); @@ -505,7 +505,7 @@ HandleType FrameBuffer::createColorBuffer(int p_width, int p_height, HandleType FrameBuffer::createRenderContext(int p_config, HandleType p_share, bool p_isGL2) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); HandleType ret = 0; RenderContextPtr share(NULL); @@ -527,7 +527,7 @@ HandleType FrameBuffer::createRenderContext(int p_config, HandleType p_share, HandleType FrameBuffer::createWindowSurface(int p_config, int p_width, int p_height) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); HandleType ret = 0; WindowSurfacePtr win( WindowSurface::create(p_config, p_width, p_height) ); @@ -541,19 +541,19 @@ HandleType FrameBuffer::createWindowSurface(int p_config, int p_width, int p_hei void FrameBuffer::DestroyRenderContext(HandleType p_context) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); m_contexts.erase(p_context); } void FrameBuffer::DestroyWindowSurface(HandleType p_surface) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); m_windows.erase(p_surface); } void FrameBuffer::openColorBuffer(HandleType p_colorbuffer) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer)); if (c == m_colorbuffers.end()) { // bad colorbuffer handle @@ -564,7 +564,7 @@ void FrameBuffer::openColorBuffer(HandleType p_colorbuffer) void FrameBuffer::closeColorBuffer(HandleType p_colorbuffer) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); ColorBufferMap::iterator c(m_colorbuffers.find(p_colorbuffer)); if (c == m_colorbuffers.end()) { // bad colorbuffer handle @@ -577,7 +577,7 @@ void FrameBuffer::closeColorBuffer(HandleType p_colorbuffer) bool FrameBuffer::flushWindowSurfaceColorBuffer(HandleType p_surface) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); WindowSurfaceMap::iterator w( m_windows.find(p_surface) ); if (w == m_windows.end()) { @@ -591,7 +591,7 @@ bool FrameBuffer::flushWindowSurfaceColorBuffer(HandleType p_surface) bool FrameBuffer::setWindowSurfaceColorBuffer(HandleType p_surface, HandleType p_colorbuffer) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); WindowSurfaceMap::iterator w( m_windows.find(p_surface) ); if (w == m_windows.end()) { @@ -614,7 +614,7 @@ bool FrameBuffer::updateColorBuffer(HandleType p_colorbuffer, int x, int y, int width, int height, GLenum format, GLenum type, void *pixels) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) ); if (c == m_colorbuffers.end()) { @@ -629,7 +629,7 @@ bool FrameBuffer::updateColorBuffer(HandleType p_colorbuffer, bool FrameBuffer::bindColorBufferToTexture(HandleType p_colorbuffer) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) ); if (c == m_colorbuffers.end()) { @@ -642,7 +642,7 @@ bool FrameBuffer::bindColorBufferToTexture(HandleType p_colorbuffer) bool FrameBuffer::bindColorBufferToRenderbuffer(HandleType p_colorbuffer) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) ); if (c == m_colorbuffers.end()) { @@ -657,7 +657,7 @@ bool FrameBuffer::bindContext(HandleType p_context, HandleType p_drawSurface, HandleType p_readSurface) { - android::Mutex::Autolock mutex(m_lock); + emugl::Mutex::AutoLock mutex(m_lock); WindowSurfacePtr draw(NULL), read(NULL); RenderContextPtr ctx(NULL); diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h index de0b71c..5b03624 100644 --- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h +++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h @@ -20,7 +20,8 @@ #include "ColorBuffer.h" #include "RenderContext.h" #include "WindowSurface.h" -#include <utils/threads.h> +#include "emugl/common/mutex.h" + #include <map> #include <EGL/egl.h> #include <stdint.h> @@ -111,7 +112,7 @@ private: int m_y; int m_width; int m_height; - android::Mutex m_lock; + emugl::Mutex m_lock; FBNativeWindowType m_nativeWindow; FrameBufferCaps m_caps; EGLDisplay m_eglDisplay; |