diff options
| author | 2020-12-04 22:31:00 +0000 | |
|---|---|---|
| committer | 2020-12-04 22:31:00 +0000 | |
| commit | f22c4c072cec6bec83ac08cecfb55e953ff21ea5 (patch) | |
| tree | 917874aba6d5253205b1889686f8bc26bdcc0448 /libs/gui/BLASTBufferQueue.cpp | |
| parent | 3acd4b31106afdbe25ae54ffc1e8bff674de1222 (diff) | |
| parent | 53c936ca72e18579f446a59765bc99770a49dd20 (diff) | |
Merge "BlastBufferQueue: Update layer size immediately if the buffer can scale"
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 13 | 
1 files changed, 12 insertions, 1 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index 3a3a96fc32..b9ab5613c6 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -150,6 +150,16 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width,      if (mRequestedSize != newSize) {          mRequestedSize.set(newSize);          mBufferItemConsumer->setDefaultBufferSize(mRequestedSize.width, mRequestedSize.height); +        if (mLastBufferScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE) { +            // If the buffer supports scaling, update the frame immediately since the client may +            // want to scale the existing buffer to the new size. +            mSize = mRequestedSize; +            SurfaceComposerClient::Transaction t; +            t.setFrame(mSurfaceControl, +                       {0, 0, static_cast<int32_t>(mSize.width), +                        static_cast<int32_t>(mSize.height)}); +            t.apply(); +        }      }  } @@ -276,6 +286,8 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) {      // Ensure BLASTBufferQueue stays alive until we receive the transaction complete callback.      incStrong((void*)transactionCallbackThunk); +    mLastBufferScalingMode = bufferItem.mScalingMode; +      t->setBuffer(mSurfaceControl, buffer);      t->setAcquireFence(mSurfaceControl,                         bufferItem.mFence ? new Fence(bufferItem.mFence->dup()) : Fence::NO_FENCE); @@ -348,7 +360,6 @@ void BLASTBufferQueue::setNextTransaction(SurfaceComposerClient::Transaction* t)  bool BLASTBufferQueue::rejectBuffer(const BufferItem& item) {      if (item.mScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE) { -        mSize = mRequestedSize;          // Only reject buffers if scaling mode is freeze.          return false;      }  |