aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
index cfadf12..e7a7960 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,32 +541,35 @@ 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)
+int 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
- return;
+ ERR("FB: openColorBuffer cb handle %#x not found\n", p_colorbuffer);
+ return -1;
}
(*c).second.refcount++;
+ return 0;
}
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()) {
+ ERR("FB: closeColorBuffer cb handle %#x not found\n", p_colorbuffer);
// bad colorbuffer handle
return;
}
@@ -577,10 +580,11 @@ 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()) {
+ ERR("FB::flushWindowSurfaceColorBuffer: window handle %#x not found\n", p_surface);
// bad surface handle
return false;
}
@@ -591,16 +595,18 @@ 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()) {
// bad surface handle
+ ERR("%s: bad window surface handle %#x\n", __FUNCTION__, p_surface);
return false;
}
ColorBufferMap::iterator c( m_colorbuffers.find(p_colorbuffer) );
if (c == m_colorbuffers.end()) {
+ ERR("%s: bad color buffer handle %#x\n", __FUNCTION__, p_colorbuffer);
// bad colorbuffer handle
return false;
}
@@ -614,7 +620,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 +635,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 +648,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 +663,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);