diff options
author | 2021-01-07 14:05:08 -0800 | |
---|---|---|
committer | 2021-01-07 14:05:08 -0800 | |
commit | adf632ba3a3298b4e66edfc468cf3888d5f2eac4 (patch) | |
tree | 68771f2b70feaa06419d6f5840e54a12969f3d5b /libs/gui/LayerMetadata.cpp | |
parent | 162b5e90f9760392cd881091cdbf9de4ea1eb889 (diff) |
BlastBufferQueue: Pass client dequeue times to SurfaceFlinger
SF keeps track of client dequeue, queue, acquire etc. timestamps to
construct frame rendering timelines for developers. With BBQ, SF no
longer has access to this data, so pass the dequeue time along with
the buffers.
Ideally this data should flow to the perfetto trace directly from the client
but this is a temp solution while some perf issues with client logging
is sorted out.
Bug: 176931912
Test: manual tests
Change-Id: Ic88170c1fb20850662cb99325ac42b7232a02817
Diffstat (limited to 'libs/gui/LayerMetadata.cpp')
-rw-r--r-- | libs/gui/LayerMetadata.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/gui/LayerMetadata.cpp b/libs/gui/LayerMetadata.cpp index 30c9b373ef..634d8b7df0 100644 --- a/libs/gui/LayerMetadata.cpp +++ b/libs/gui/LayerMetadata.cpp @@ -17,6 +17,7 @@ #include <android-base/stringprintf.h> #include <binder/Parcel.h> #include <gui/LayerMetadata.h> +#include <inttypes.h> #include "android/view/LayerMetadataKey.h" @@ -113,6 +114,15 @@ void LayerMetadata::setInt32(uint32_t key, int32_t value) { memcpy(data.data(), p.data(), p.dataSize()); } +std::optional<int64_t> LayerMetadata::getInt64(uint32_t key) const { + if (!has(key)) return std::nullopt; + const std::vector<uint8_t>& data = mMap.at(key); + if (data.size() < sizeof(int64_t)) return std::nullopt; + Parcel p; + p.setData(data.data(), data.size()); + return p.readInt64(); +} + std::string LayerMetadata::itemToString(uint32_t key, const char* separator) const { if (!has(key)) return std::string(); switch (static_cast<view::LayerMetadataKey>(key)) { @@ -124,6 +134,8 @@ std::string LayerMetadata::itemToString(uint32_t key, const char* separator) con return StringPrintf("taskId%s%d", separator, getInt32(key, 0)); case view::LayerMetadataKey::METADATA_OWNER_PID: return StringPrintf("ownerPID%s%d", separator, getInt32(key, 0)); + case view::LayerMetadataKey::METADATA_DEQUEUE_TIME: + return StringPrintf("dequeueTime%s%" PRId64, separator, *getInt64(key)); default: return StringPrintf("%d%s%dbytes", key, separator, static_cast<int>(mMap.at(key).size())); |