summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/TransactionCallbackInvoker.cpp
diff options
context:
space:
mode:
author Patrick Williams <pdwilliams@google.com> 2024-07-09 17:11:28 -0500
committer Patrick Williams <pdwilliams@google.com> 2024-07-23 18:28:57 -0500
commitac70bc579028cdc00a2f14b77718080b26b93c7d (patch)
tree1e06098022d68cb8732669c63f0de4dcda01932f /services/surfaceflinger/TransactionCallbackInvoker.cpp
parent892e766d2aa2c961e506d27f045a75492320d64e (diff)
Optimize BLAST buffer releases via Unix sockets
Bug: 294133380 Flag: com.android.graphics.libgui.flags.buffer_release_channel Test: BLASTBufferQueueTest Change-Id: Ia183452198dadc7f8e540f7219bd44d8b5823458
Diffstat (limited to 'services/surfaceflinger/TransactionCallbackInvoker.cpp')
-rw-r--r--services/surfaceflinger/TransactionCallbackInvoker.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/services/surfaceflinger/TransactionCallbackInvoker.cpp b/services/surfaceflinger/TransactionCallbackInvoker.cpp
index 881bf35b58..9ea0f5f4ca 100644
--- a/services/surfaceflinger/TransactionCallbackInvoker.cpp
+++ b/services/surfaceflinger/TransactionCallbackInvoker.cpp
@@ -149,6 +149,12 @@ status_t TransactionCallbackInvoker::addCallbackHandle(const sp<CallbackHandle>&
handle->transformHint,
handle->currentMaxAcquiredBufferCount,
eventStats, handle->previousReleaseCallbackId);
+ if (handle->bufferReleaseChannel &&
+ handle->previousReleaseCallbackId != ReleaseCallbackId::INVALID_ID) {
+ mBufferReleases.emplace_back(handle->bufferReleaseChannel,
+ handle->previousReleaseCallbackId,
+ handle->previousReleaseFence);
+ }
}
return NO_ERROR;
}
@@ -158,6 +164,11 @@ void TransactionCallbackInvoker::addPresentFence(sp<Fence> presentFence) {
}
void TransactionCallbackInvoker::sendCallbacks(bool onCommitOnly) {
+ for (const auto& bufferRelease : mBufferReleases) {
+ bufferRelease.channel->writeReleaseFence(bufferRelease.callbackId, bufferRelease.fence);
+ }
+ mBufferReleases.clear();
+
// For each listener
auto completedTransactionsItr = mCompletedTransactions.begin();
ftl::SmallVector<ListenerStats, 10> listenerStatsToSend;