summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Adithya Srinivasan <adsrini@google.com> 2019-10-09 11:43:01 -0700
committer Adithya Srinivasan <adsrini@google.com> 2019-10-23 11:43:11 -0700
commit2e43438757b21add0fd12feaa4a41926aab13c1a (patch)
treee8b5c1eb38a2e4e8a403294a1924795fb8498518 /libs/gui/ConsumerBase.cpp
parent10d01dba75b64190628af247d5b312cf9ea9c74d (diff)
Add tracing for dequeueBuffer, detachBuffer and cancelBuffer
The FrameTracer prototype currently doesn't have some of the events traced. This change adds the plumbing required to emit dequeueBuffer, detachBuffer and cancelBuffer. Only the dequeueBuffer is made to emit the event in this CL while enabling detach and cancel to have a place if emitting is required. Test: Build and trace with GAPID and FrameTracer perfetto changes. Bug: 142502670 Change-Id: I2ba90b32d7b309a7c8145f75387c8e6f8f6bd0fb
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
-rw-r--r--libs/gui/ConsumerBase.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index abd9921fa9..9f91d9d3aa 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -101,6 +101,48 @@ void ConsumerBase::freeBufferLocked(int slotIndex) {
mSlots[slotIndex].mFrameNumber = 0;
}
+void ConsumerBase::onFrameDequeued(const uint64_t bufferId) {
+ CB_LOGV("onFrameDequeued");
+
+ sp<FrameAvailableListener> listener;
+ {
+ Mutex::Autolock lock(mFrameAvailableMutex);
+ listener = mFrameAvailableListener.promote();
+ }
+
+ if (listener != nullptr) {
+ listener->onFrameDequeued(bufferId);
+ }
+}
+
+void ConsumerBase::onFrameCancelled(const uint64_t bufferId) {
+ CB_LOGV("onFrameCancelled");
+
+ sp<FrameAvailableListener> listener;
+ {
+ Mutex::Autolock lock(mFrameAvailableMutex);
+ listener = mFrameAvailableListener.promote();
+ }
+
+ if (listener != nullptr) {
+ listener->onFrameCancelled(bufferId);
+ }
+}
+
+void ConsumerBase::onFrameDetached(const uint64_t bufferId) {
+ CB_LOGV("onFrameDetached");
+
+ sp<FrameAvailableListener> listener;
+ {
+ Mutex::Autolock lock(mFrameAvailableMutex);
+ listener = mFrameAvailableListener.promote();
+ }
+
+ if (listener != nullptr) {
+ listener->onFrameDetached(bufferId);
+ }
+}
+
void ConsumerBase::onFrameAvailable(const BufferItem& item) {
CB_LOGV("onFrameAvailable");