diff options
author | Mathias Agopian <mathias@google.com> | 2011-07-19 17:10:10 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-19 17:10:10 -0700 |
commit | 9ec1f1d259f9dfc4a9359739e4711ba1a99375b2 (patch) | |
tree | 98e541782c4f0f6d9de2c92e59ebcb7d52283e83 /libs | |
parent | 6461c97331e9e672e2abd6a46eaaa7b948974484 (diff) | |
parent | f07b8a3f691be39083fb5163f9456bcfa566f93f (diff) | |
download | frameworks_base-9ec1f1d259f9dfc4a9359739e4711ba1a99375b2.zip frameworks_base-9ec1f1d259f9dfc4a9359739e4711ba1a99375b2.tar.gz frameworks_base-9ec1f1d259f9dfc4a9359739e4711ba1a99375b2.tar.bz2 |
Merge "implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation""
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/ISurfaceTexture.cpp | 13 | ||||
-rw-r--r-- | libs/gui/SurfaceTexture.cpp | 8 | ||||
-rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 40 | ||||
-rw-r--r-- | libs/ui/FramebufferNativeWindow.cpp | 12 |
4 files changed, 56 insertions, 17 deletions
diff --git a/libs/gui/ISurfaceTexture.cpp b/libs/gui/ISurfaceTexture.cpp index b4b7492..be90e2e 100644 --- a/libs/gui/ISurfaceTexture.cpp +++ b/libs/gui/ISurfaceTexture.cpp @@ -93,12 +93,16 @@ public: return result; } - virtual status_t queueBuffer(int buf, int64_t timestamp) { + virtual status_t queueBuffer(int buf, int64_t timestamp, + uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) { Parcel data, reply; data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); data.writeInt32(buf); data.writeInt64(timestamp); remote()->transact(QUEUE_BUFFER, data, &reply); + *outWidth = reply.readInt32(); + *outHeight = reply.readInt32(); + *outTransform = reply.readInt32(); status_t result = reply.readInt32(); return result; } @@ -226,7 +230,12 @@ status_t BnSurfaceTexture::onTransact( CHECK_INTERFACE(ISurfaceTexture, data, reply); int buf = data.readInt32(); int64_t timestamp = data.readInt64(); - status_t result = queueBuffer(buf, timestamp); + uint32_t outWidth, outHeight, outTransform; + status_t result = queueBuffer(buf, timestamp, + &outWidth, &outHeight, &outTransform); + reply->writeInt32(outWidth); + reply->writeInt32(outHeight); + reply->writeInt32(outTransform); reply->writeInt32(result); return NO_ERROR; } break; diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp index 3ab6c79..0f08570 100644 --- a/libs/gui/SurfaceTexture.cpp +++ b/libs/gui/SurfaceTexture.cpp @@ -402,7 +402,8 @@ status_t SurfaceTexture::setSynchronousMode(bool enabled) { return err; } -status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) { +status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp, + uint32_t* outWidth, uint32_t* outHeight, uint32_t* outTransform) { LOGV("SurfaceTexture::queueBuffer"); sp<FrameAvailableListener> listener; @@ -463,6 +464,11 @@ status_t SurfaceTexture::queueBuffer(int buf, int64_t timestamp) { if (listener != 0) { listener->onFrameAvailable(); } + + *outWidth = mDefaultWidth; + *outHeight = mDefaultHeight; + *outTransform = 0; + return OK; } diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 68475e9..1dc6cd2 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -222,26 +222,38 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { if (i < 0) { return i; } - mSurfaceTexture->queueBuffer(i, timestamp); + mSurfaceTexture->queueBuffer(i, timestamp, + &mDefaultWidth, &mDefaultHeight, &mTransformHint); return OK; } int SurfaceTextureClient::query(int what, int* value) const { LOGV("SurfaceTextureClient::query"); - switch (what) { - case NATIVE_WINDOW_FORMAT: - if (mReqFormat) { - *value = mReqFormat; - return NO_ERROR; + { // scope for the lock + Mutex::Autolock lock(mMutex); + switch (what) { + case NATIVE_WINDOW_FORMAT: + if (mReqFormat) { + *value = mReqFormat; + return NO_ERROR; + } + break; + case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: + *value = 0; + return NO_ERROR; + case NATIVE_WINDOW_CONCRETE_TYPE: + *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_WIDTH: + *value = mDefaultWidth; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_HEIGHT: + *value = mDefaultHeight; + return NO_ERROR; + case NATIVE_WINDOW_TRANSFORM_HINT: + *value = mTransformHint; + return NO_ERROR; } - break; - case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: - // TODO: this is not needed anymore - *value = 0; - return NO_ERROR; - case NATIVE_WINDOW_CONCRETE_TYPE: - *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT; - return NO_ERROR; } return mSurfaceTexture->query(what, value); } diff --git a/libs/ui/FramebufferNativeWindow.cpp b/libs/ui/FramebufferNativeWindow.cpp index e2772a7..412552e 100644 --- a/libs/ui/FramebufferNativeWindow.cpp +++ b/libs/ui/FramebufferNativeWindow.cpp @@ -289,6 +289,18 @@ int FramebufferNativeWindow::query(const ANativeWindow* window, case NATIVE_WINDOW_CONCRETE_TYPE: *value = NATIVE_WINDOW_FRAMEBUFFER; return NO_ERROR; + case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: + *value = 0; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_WIDTH: + *value = fb->width; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_HEIGHT: + *value = fb->height; + return NO_ERROR; + case NATIVE_WINDOW_TRANSFORM_HINT: + *value = 0; + return NO_ERROR; } *value = 0; return BAD_VALUE; |