summaryrefslogtreecommitdiff
path: root/libs/hwui/FrameInfo.cpp
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2023-08-10 11:45:58 -0700
committer Ady Abraham <adyabr@google.com> 2023-08-10 22:58:02 +0000
commite088dcdce8ac7a947c2a2e4cd2ba6cea7a28e21c (patch)
treeae30522dd57246a56251368789c8a6402f519ffd /libs/hwui/FrameInfo.cpp
parentafce62fb455d3790f328b3582e681c6e27e86224 (diff)
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
Diffstat (limited to 'libs/hwui/FrameInfo.cpp')
-rw-r--r--libs/hwui/FrameInfo.cpp26
1 files changed, 26 insertions, 0 deletions
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 <gui/TraceUtils.h>
+
#include <cstring>
namespace android {
@@ -51,6 +53,30 @@ static_assert(static_cast<int>(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 */