summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-01-09 13:25:39 -0800
committerJamie Gennis <jgennis@google.com>2011-01-09 16:40:06 -0800
commitd369dc42506ec003f1839bb9e27edada411324b5 (patch)
tree3b4f8881a614aa1e44ff337ee136b8eb8306ed2a
parent7dc00d5eb27de41f93a7e232b3cd374c84eb77d1 (diff)
downloadframeworks_base-d369dc42506ec003f1839bb9e27edada411324b5.zip
frameworks_base-d369dc42506ec003f1839bb9e27edada411324b5.tar.gz
frameworks_base-d369dc42506ec003f1839bb9e27edada411324b5.tar.bz2
Fix a bug in SurfaceTexture::setBufferCount.
We need to reset mCurrentTexture and mLastQueued in setBufferCount because it frees all of the buffers associated with the buffer slots. Change-Id: Ie2f834ec1c07ce7a4ab9b2b5fc5fe8c294010c60
-rw-r--r--include/gui/SurfaceTexture.h7
-rw-r--r--libs/gui/SurfaceTexture.cpp2
2 files changed, 7 insertions, 2 deletions
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index ff92e08..cbc15d8 100644
--- a/include/gui/SurfaceTexture.h
+++ b/include/gui/SurfaceTexture.h
@@ -113,8 +113,11 @@ private:
int mBufferCount;
// mCurrentTexture is the buffer slot index of the buffer that is currently
- // bound to the OpenGL texture. A value of INVALID_BUFFER_SLOT, indicating
- // that no buffer is currently bound to the texture.
+ // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT,
+ // indicating that no buffer slot is currently bound to the texture. Note,
+ // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean
+ // that no buffer is bound to the texture. A call to setBufferCount will
+ // reset mCurrentTexture to INVALID_BUFFER_SLOT.
int mCurrentTexture;
// mLastQueued is the buffer slot index of the most recently enqueued buffer.
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 10f309a..11a48d9 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -55,6 +55,8 @@ status_t SurfaceTexture::setBufferCount(int bufferCount) {
Mutex::Autolock lock(mMutex);
freeAllBuffers();
mBufferCount = bufferCount;
+ mCurrentTexture = INVALID_BUFFER_SLOT;
+ mLastQueued = INVALID_BUFFER_SLOT;
return OK;
}