diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-15 20:35:15 -0400 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-15 20:35:15 -0400 |
commit | 8fb866366967618d249b01ef6cea2ff5d8247e28 (patch) | |
tree | cf2dfc2b32234209839362abdf5f2cdf526a1cfb | |
parent | 6dfc42c04cc7c7a3e33d9d58e7743755d00f7109 (diff) | |
parent | d18afab9d6a89d14c5c583a7d976665af4765a6b (diff) | |
download | frameworks_native-8fb866366967618d249b01ef6cea2ff5d8247e28.zip frameworks_native-8fb866366967618d249b01ef6cea2ff5d8247e28.tar.gz frameworks_native-8fb866366967618d249b01ef6cea2ff5d8247e28.tar.bz2 |
Merge change 25176 into eclair
* changes:
fix [2122448] android_native_window_t::setUsage() only reallocates the first buffer
-rw-r--r-- | include/ui/Surface.h | 3 | ||||
-rw-r--r-- | libs/ui/Surface.cpp | 26 |
2 files changed, 9 insertions, 20 deletions
diff --git a/include/ui/Surface.h b/include/ui/Surface.h index 118fb83..2cedeb6 100644 --- a/include/ui/Surface.h +++ b/include/ui/Surface.h @@ -212,7 +212,7 @@ private: void setUsage(uint32_t reqUsage); - bool getUsage(uint32_t* usage); + uint32_t getUsage() const; // constants sp<SurfaceComposerClient> mClient; @@ -227,7 +227,6 @@ private: // protected by mSurfaceLock Rect mSwapRectangle; uint32_t mUsage; - int32_t mUsageChanged; // protected by mSurfaceLock. These are also used from lock/unlock // but in that case, they must be called form the same thread. diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index c3fbea2..4dab3a2 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -361,7 +361,6 @@ void Surface::init() const_cast<uint32_t&>(android_native_window_t::flags) = 0; // be default we request a hardware surface mUsage = GRALLOC_USAGE_HW_RENDER; - mUsageChanged = true; mNeedFullUpdate = false; } @@ -499,13 +498,12 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer) return bufIdx; } - // FIXME: in case of failure below, we need to undo the dequeue - - uint32_t usage; - const bool usageChanged = getUsage(&usage); + const uint32_t usage(getUsage()); const sp<SurfaceBuffer>& backBuffer(mBuffers[bufIdx]); - if ((backBuffer == 0) || usageChanged || - mSharedBufferClient->needNewBuffer(bufIdx)) { + if (backBuffer == 0 || + uint32_t(backBuffer->usage) != usage || + mSharedBufferClient->needNewBuffer(bufIdx)) + { err = getBufferLocked(bufIdx, usage); LOGE_IF(err, "getBufferLocked(%ld, %08x) failed (%s)", bufIdx, usage, strerror(-err)); @@ -600,21 +598,13 @@ int Surface::perform(int operation, va_list args) void Surface::setUsage(uint32_t reqUsage) { Mutex::Autolock _l(mSurfaceLock); - if (mUsage != reqUsage) { - mUsageChanged = true; - mUsage = reqUsage; - } + mUsage = reqUsage; } -bool Surface::getUsage(uint32_t* usage) +uint32_t Surface::getUsage() const { Mutex::Autolock _l(mSurfaceLock); - *usage = mUsage; - if (mUsageChanged) { - mUsageChanged = false; - return true; - } - return false; + return mUsage; } // ---------------------------------------------------------------------------- |