summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-07-30 16:00:11 -0700
committerJamie Gennis <jgennis@google.com>2011-07-30 16:00:11 -0700
commitd995b08353a7e912fee6397710262bee7671ad38 (patch)
tree374c1afc36123966e00e4635666b90e84caf82b3 /libs/gui
parente8f1cbae4400e8b046b405f205dffe0417826fb3 (diff)
downloadframeworks_base-d995b08353a7e912fee6397710262bee7671ad38.zip
frameworks_base-d995b08353a7e912fee6397710262bee7671ad38.tar.gz
frameworks_base-d995b08353a7e912fee6397710262bee7671ad38.tar.bz2
SurfaceTexture: allow set_buffer_count(2)
This change relaxes an error check in SurfaceTexture::setBufferCount to allow clients to explicitly set a buffer count of 2. The clients that will do this are camera and video decode. Previously it was thought that for those clients we would always use async mode, which requires a minimum of 3 buffers. However, we now believe that for some devices it may make sense to use synchronous mode (with 2 buffers) to reduce memory usage. Bug: 5088418 Change-Id: I620a0ef75075745be9d6c8219e0246aaf33ba950
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/SurfaceTexture.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 16755ad..4f51f03 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -168,18 +168,18 @@ status_t SurfaceTexture::setBufferCount(int bufferCount) {
}
}
+ const int minBufferSlots = mSynchronousMode ?
+ MIN_SYNC_BUFFER_SLOTS : MIN_ASYNC_BUFFER_SLOTS;
if (bufferCount == 0) {
- const int minBufferSlots = mSynchronousMode ?
- MIN_SYNC_BUFFER_SLOTS : MIN_ASYNC_BUFFER_SLOTS;
mClientBufferCount = 0;
bufferCount = (mServerBufferCount >= minBufferSlots) ?
mServerBufferCount : minBufferSlots;
return setBufferCountServerLocked(bufferCount);
}
- // We don't allow the client to set a buffer-count less than
- // MIN_ASYNC_BUFFER_SLOTS (3), there is no reason for it.
- if (bufferCount < MIN_ASYNC_BUFFER_SLOTS) {
+ if (bufferCount < minBufferSlots) {
+ LOGE("setBufferCount: requested buffer count (%d) is less than "
+ "minimum (%d)", bufferCount, minBufferSlots);
return BAD_VALUE;
}