diff options
author | 2021-06-18 17:45:42 +0000 | |
---|---|---|
committer | 2021-06-18 17:45:42 +0000 | |
commit | e31243e10cd00740edca5d771f5a06b7e14a6287 (patch) | |
tree | 89785b483c4b7dd8c8891e0784f810cd73fd65eb /services/surfaceflinger/BufferStateLayer.cpp | |
parent | 45ddb87d7e547af7bdf39c6cfe959e847b61e365 (diff) | |
parent | 19e047fb7c39fe52ab4bfbb02c09056b1b14d6f0 (diff) |
Merge changes from topic "sf_maxAcquiredBufferCount" into sc-dev am: a9e4e2fb7a am: 19e047fb7c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/14633449
Change-Id: Iae9b092dba5eedc8a83c6063e9d198bfa3804808
Diffstat (limited to 'services/surfaceflinger/BufferStateLayer.cpp')
-rw-r--r-- | services/surfaceflinger/BufferStateLayer.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp index 6213a8aff5..f8af908737 100644 --- a/services/surfaceflinger/BufferStateLayer.cpp +++ b/services/surfaceflinger/BufferStateLayer.cpp @@ -45,12 +45,12 @@ using PresentState = frametimeline::SurfaceFrame::PresentState; namespace { void callReleaseBufferCallback(const sp<ITransactionCompletedListener>& listener, const sp<GraphicBuffer>& buffer, const sp<Fence>& releaseFence, - uint32_t transformHint) { + uint32_t transformHint, uint32_t currentMaxAcquiredBufferCount) { if (!listener) { return; } listener->onReleaseBuffer(buffer->getId(), releaseFence ? releaseFence : Fence::NO_FENCE, - transformHint); + transformHint, currentMaxAcquiredBufferCount); } } // namespace @@ -76,7 +76,9 @@ BufferStateLayer::~BufferStateLayer() { if (mBufferInfo.mBuffer != nullptr && !isClone()) { callReleaseBufferCallback(mDrawingState.releaseBufferListener, mBufferInfo.mBuffer->getBuffer(), mBufferInfo.mFence, - mTransformHint); + mTransformHint, + mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate( + mOwnerUid)); } } @@ -200,6 +202,8 @@ void BufferStateLayer::releasePendingBuffer(nsecs_t dequeueReadyTime) { for (const auto& handle : mDrawingState.callbackHandles) { handle->transformHint = mTransformHint; handle->dequeueReadyTime = dequeueReadyTime; + handle->currentMaxAcquiredBufferCount = + mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate(mOwnerUid); } // If there are multiple transactions in this frame, set the previous id on the earliest @@ -430,9 +434,10 @@ bool BufferStateLayer::setBuffer(const std::shared_ptr<renderengine::ExternalTex // dropped and we should decrement the pending buffer count and // call any release buffer callbacks if set. callReleaseBufferCallback(mCurrentState.releaseBufferListener, - mCurrentState.buffer->getBuffer(), - mCurrentState.acquireFence, - mTransformHint); + mCurrentState.buffer->getBuffer(), mCurrentState.acquireFence, + mTransformHint, + mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate( + mOwnerUid)); decrementPendingBufferCount(); if (mCurrentState.bufferSurfaceFrameTX != nullptr) { addSurfaceFrameDroppedForBuffer(mCurrentState.bufferSurfaceFrameTX); @@ -952,7 +957,9 @@ void BufferStateLayer::bufferMayChange(const sp<GraphicBuffer>& newBuffer) { // call any release buffer callbacks if set. callReleaseBufferCallback(mDrawingState.releaseBufferListener, mDrawingState.buffer->getBuffer(), mDrawingState.acquireFence, - mTransformHint); + mTransformHint, + mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate( + mOwnerUid)); decrementPendingBufferCount(); } } |