diff options
| author | 2021-08-02 23:54:34 +0000 | |
|---|---|---|
| committer | 2021-08-02 23:54:34 +0000 | |
| commit | a83715172074b019a53a9875a8393b3e71dcdfa0 (patch) | |
| tree | 698e343be8d6fcc439d785a7cf3f3c318b6a836d /libs/gui/BLASTBufferQueue.cpp | |
| parent | ad494f0ac5c6413131ef09691ad4e2aebda06a20 (diff) | |
| parent | edec715c764be0e173056d9211fa079cdcb0cb98 (diff) | |
Merge "SurfaceView: Synchronize destframe updates with SurfaceView size changes" into sc-dev am: edec715c76
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15363852
Change-Id: I08339d2d02565741a30ba70b4de44026d871e2c8
Diffstat (limited to 'libs/gui/BLASTBufferQueue.cpp')
| -rw-r--r-- | libs/gui/BLASTBufferQueue.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp index d9024fa672..70f2ae770b 100644 --- a/libs/gui/BLASTBufferQueue.cpp +++ b/libs/gui/BLASTBufferQueue.cpp @@ -166,9 +166,10 @@ BLASTBufferQueue::BLASTBufferQueue(const std::string& name, const sp<SurfaceCont mTransformHint = mSurfaceControl->getTransformHint(); mBufferItemConsumer->setTransformHint(mTransformHint); SurfaceComposerClient::Transaction() - .setFlags(surface, layer_state_t::eEnableBackpressure, - layer_state_t::eEnableBackpressure) - .apply(); + .setFlags(surface, layer_state_t::eEnableBackpressure, + layer_state_t::eEnableBackpressure) + .setApplyToken(mApplyToken) + .apply(); mNumAcquired = 0; mNumFrameAvailable = 0; BQA_LOGV("BLASTBufferQueue created width=%d height=%d format=%d mTransformHint=%d", width, @@ -190,7 +191,7 @@ BLASTBufferQueue::~BLASTBufferQueue() { } void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, uint32_t height, - int32_t format) { + int32_t format, SurfaceComposerClient::Transaction* outTransaction) { std::unique_lock _lock{mMutex}; if (mFormat != format) { mFormat = format; @@ -227,15 +228,18 @@ void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, // We only need to update the scale if we've received at least one buffer. The reason // for this is the scale is calculated based on the requested size and buffer size. // If there's no buffer, the scale will always be 1. + SurfaceComposerClient::Transaction* destFrameTransaction = + (outTransaction) ? outTransaction : &t; if (mSurfaceControl != nullptr && mLastBufferInfo.hasBuffer) { - t.setDestinationFrame(mSurfaceControl, - Rect(0, 0, newSize.getWidth(), newSize.getHeight())); + destFrameTransaction->setDestinationFrame(mSurfaceControl, + Rect(0, 0, newSize.getWidth(), + newSize.getHeight())); } applyTransaction = true; } } if (applyTransaction) { - t.apply(); + t.setApplyToken(mApplyToken).apply(); } } @@ -453,6 +457,9 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { incStrong((void*)transactionCallbackThunk); Rect crop = computeCrop(bufferItem); + const bool updateDestinationFrame = + bufferItem.mScalingMode == NATIVE_WINDOW_SCALING_MODE_FREEZE || + !mLastBufferInfo.hasBuffer; mLastBufferInfo.update(true /* hasBuffer */, bufferItem.mGraphicBuffer->getWidth(), bufferItem.mGraphicBuffer->getHeight(), bufferItem.mTransform, bufferItem.mScalingMode, crop); @@ -470,7 +477,9 @@ void BLASTBufferQueue::processNextBufferLocked(bool useNextTransaction) { t->addTransactionCompletedCallback(transactionCallbackThunk, static_cast<void*>(this)); mSurfaceControlsWithPendingCallback.push(mSurfaceControl); - t->setDestinationFrame(mSurfaceControl, Rect(0, 0, mSize.getWidth(), mSize.getHeight())); + if (updateDestinationFrame) { + t->setDestinationFrame(mSurfaceControl, Rect(0, 0, mSize.getWidth(), mSize.getHeight())); + } t->setBufferCrop(mSurfaceControl, crop); t->setTransform(mSurfaceControl, bufferItem.mTransform); t->setTransformToDisplayInverse(mSurfaceControl, bufferItem.mTransformToDisplayInverse); |