diff options
author | Jamie Gennis <jgennis@google.com> | 2011-02-27 14:10:20 -0800 |
---|---|---|
committer | Jamie Gennis <jgennis@google.com> | 2011-02-28 12:24:40 -0800 |
commit | 96dcc978430f0daf6d73fee96a01779ed537a0ce (patch) | |
tree | 683c5986dd007030e5a98e57aa6c0764d19da51b /libs | |
parent | 8e79442c4fdabd2f82d0ed8e23d394816edee495 (diff) | |
download | frameworks_base-96dcc978430f0daf6d73fee96a01779ed537a0ce.zip frameworks_base-96dcc978430f0daf6d73fee96a01779ed537a0ce.tar.gz frameworks_base-96dcc978430f0daf6d73fee96a01779ed537a0ce.tar.bz2 |
Add the MIN_UNDEQUEUED_BUFFERS query to ANW.
This change adds a new query to ANativeWindow for getting the minimum
number of buffers that must be left un-dequeued during the steady-state
operation of the ANativeWindow.
Change-Id: Ie8c461fc26b02ecde02ddb4f95bf763662cf1551
Related-Bug: 3356050
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/SurfaceTexture.cpp | 5 | ||||
-rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 17 | ||||
-rw-r--r-- | libs/surfaceflinger_client/Surface.cpp | 3 |
3 files changed, 23 insertions, 2 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 223cf09..3bed959 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -96,6 +96,11 @@ SurfaceTexture::~SurfaceTexture() { status_t SurfaceTexture::setBufferCount(int bufferCount) { LOGV("SurfaceTexture::setBufferCount"); + + if (bufferCount < MIN_BUFFER_SLOTS) { + return BAD_VALUE; + } + Mutex::Autolock lock(mMutex); freeAllBuffers(); mBufferCount = bufferCount; diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index ee14ac9..43b330c 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -143,8 +143,21 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { int SurfaceTextureClient::query(int what, int* value) { LOGV("SurfaceTextureClient::query"); Mutex::Autolock lock(mMutex); - // XXX: Implement this! - return INVALID_OPERATION; + switch (what) { + case NATIVE_WINDOW_WIDTH: + case NATIVE_WINDOW_HEIGHT: + // XXX: How should SurfaceTexture behave if setBuffersGeometry didn't + // override the size? + *value = 0; + return NO_ERROR; + case NATIVE_WINDOW_FORMAT: + *value = DEFAULT_FORMAT; + return NO_ERROR; + case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: + *value = MIN_UNDEQUEUED_BUFFERS; + return NO_ERROR; + } + return BAD_VALUE; } int SurfaceTextureClient::perform(int operation, va_list args) diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp index 1e9bd74..2c77edf 100644 --- a/libs/surfaceflinger_client/Surface.cpp +++ b/libs/surfaceflinger_client/Surface.cpp @@ -709,6 +709,9 @@ int Surface::query(int what, int* value) case NATIVE_WINDOW_FORMAT: *value = int(mFormat); return NO_ERROR; + case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: + *value = MIN_UNDEQUEUED_BUFFERS; + return NO_ERROR; } return BAD_VALUE; } |