diff options
author | 2022-03-17 17:23:49 -0400 | |
---|---|---|
committer | 2022-03-18 10:50:58 -0400 | |
commit | 57f748c78d326521fc50d2336373117bb819764b (patch) | |
tree | cd8de23f037cfe0740e231485ad3c9fe2376e04e /libs/gui/SurfaceControl.cpp | |
parent | 0af0bba332d95574f4ecc574efcf66d6cd65814a (diff) |
Support setBuffer w/ release callback
Allow setBuffer to take a release callback without
passing a frame number. A fallback frame number on
the target SurfaceControl is used instead.
Bug: 220897032
Test: SurfaceControlTest CTS
Change-Id: Ib110755e2887396d41a5d52af1305ccc2bf0e9bd
Diffstat (limited to 'libs/gui/SurfaceControl.cpp')
-rw-r--r-- | libs/gui/SurfaceControl.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp index 6529a4e51c..063dda5153 100644 --- a/libs/gui/SurfaceControl.cpp +++ b/libs/gui/SurfaceControl.cpp @@ -280,5 +280,18 @@ sp<SurfaceControl> SurfaceControl::getParentingLayer() { return this; } +uint64_t SurfaceControl::resolveFrameNumber(const std::optional<uint64_t>& frameNumber) { + if (frameNumber.has_value()) { + auto ret = frameNumber.value(); + // Set the fallback to something far enough ahead that in the unlikely event of mixed + // "real" frame numbers and fallback frame numbers, we still won't collide in any + // meaningful capacity + mFallbackFrameNumber = ret + 100; + return ret; + } else { + return mFallbackFrameNumber++; + } +} + // ---------------------------------------------------------------------------- }; // namespace android |