From e088dcdce8ac7a947c2a2e4cd2ba6cea7a28e21c Mon Sep 17 00:00:00 2001 From: Ady Abraham Date: Thu, 10 Aug 2023 11:45:58 -0700 Subject: hwui: add reason for skipped frames .. so we could report the unintentional skipped frames to Perfetto, rather than report undrawn frames as well. Test: manual Bug: 294884928 Change-Id: Ic49f4050cb3028d7adb5c930947ff6b72655d832 --- libs/hwui/FrameInfo.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'libs/hwui/FrameInfo.cpp') diff --git a/libs/hwui/FrameInfo.cpp b/libs/hwui/FrameInfo.cpp index 8191f5e6a83a..a958a091a830 100644 --- a/libs/hwui/FrameInfo.cpp +++ b/libs/hwui/FrameInfo.cpp @@ -15,6 +15,8 @@ */ #include "FrameInfo.h" +#include + #include namespace android { @@ -51,6 +53,30 @@ static_assert(static_cast(FrameInfoIndex::NumIndexes) == 23, void FrameInfo::importUiThreadInfo(int64_t* info) { memcpy(mFrameInfo, info, UI_THREAD_FRAME_INFO_SIZE * sizeof(int64_t)); + mSkippedFrameReason.reset(); +} + +const char* toString(SkippedFrameReason reason) { + switch (reason) { + case SkippedFrameReason::DrawingOff: + return "DrawingOff"; + case SkippedFrameReason::ContextIsStopped: + return "ContextIsStopped"; + case SkippedFrameReason::NothingToDraw: + return "NothingToDraw"; + case SkippedFrameReason::NoOutputTarget: + return "NoOutputTarget"; + case SkippedFrameReason::NoBuffer: + return "NoBuffer"; + case SkippedFrameReason::AlreadyDrawn: + return "AlreadyDrawn"; + } +} + +void FrameInfo::setSkippedFrameReason(android::uirenderer::SkippedFrameReason reason) { + ATRACE_FORMAT_INSTANT("Frame skipped: %s", toString(reason)); + addFlag(FrameInfoFlags::SkippedFrame); + mSkippedFrameReason = reason; } } /* namespace uirenderer */ -- cgit v1.2.3-59-g8ed1b