summaryrefslogtreecommitdiff
path: root/libs/gui/LayerState.cpp
diff options
context:
space:
mode:
author Patrick Williams <pdwilliams@google.com> 2024-08-02 09:55:23 -0500
committer Patrick Williams <pdwilliams@google.com> 2024-08-06 09:58:17 -0500
commitf693bcf2ee13391f99b8ede5562047981e1f5968 (patch)
tree4a543a7b58d2dcff1c728f3af5e00be4f016bc34 /libs/gui/LayerState.cpp
parentf5b42de949b928d5b08854a592c2af0600bbca7b (diff)
Add BufferReleaseChannel
BufferReleaseChannel will be used to communicate buffer releases from SurfaceFlinger to BLASTBufferQueue. Bug: 294133380 Flag: com.android.graphics.libgui.flags.buffer_release_channel Test: BufferReleaseChannelTest Change-Id: Ic38e8eefc96abc0b2bbe780115b7628413e8b829
Diffstat (limited to 'libs/gui/LayerState.cpp')
-rw-r--r--libs/gui/LayerState.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index 307ae3990e..0714fd9501 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -17,7 +17,6 @@
#define LOG_TAG "LayerState"
#include <cinttypes>
-#include <cmath>
#include <android/gui/ISurfaceComposerClient.h>
#include <android/native_window.h>
@@ -194,6 +193,13 @@ status_t layer_state_t::write(Parcel& output) const
SAFE_PARCEL(output.writeFloat, currentHdrSdrRatio);
SAFE_PARCEL(output.writeFloat, desiredHdrSdrRatio);
SAFE_PARCEL(output.writeInt32, static_cast<int32_t>(cachingHint));
+
+ const bool hasBufferReleaseChannel = (bufferReleaseChannel != nullptr);
+ SAFE_PARCEL(output.writeBool, hasBufferReleaseChannel);
+ if (hasBufferReleaseChannel) {
+ SAFE_PARCEL(output.writeParcelable, *bufferReleaseChannel);
+ }
+
return NO_ERROR;
}
@@ -339,6 +345,13 @@ status_t layer_state_t::read(const Parcel& input)
SAFE_PARCEL(input.readInt32, &tmpInt32);
cachingHint = static_cast<gui::CachingHint>(tmpInt32);
+ bool hasBufferReleaseChannel;
+ SAFE_PARCEL(input.readBool, &hasBufferReleaseChannel);
+ if (hasBufferReleaseChannel) {
+ bufferReleaseChannel = std::make_shared<gui::BufferReleaseChannel::ProducerEndpoint>();
+ SAFE_PARCEL(input.readParcelable, bufferReleaseChannel.get());
+ }
+
return NO_ERROR;
}
@@ -718,6 +731,10 @@ void layer_state_t::merge(const layer_state_t& other) {
if (other.what & eFlushJankData) {
what |= eFlushJankData;
}
+ if (other.what & eBufferReleaseChannelChanged) {
+ what |= eBufferReleaseChannelChanged;
+ bufferReleaseChannel = other.bufferReleaseChannel;
+ }
if ((other.what & what) != other.what) {
ALOGE("Unmerged SurfaceComposer Transaction properties. LayerState::merge needs updating? "
"other.what=0x%" PRIX64 " what=0x%" PRIX64 " unmerged flags=0x%" PRIX64,
@@ -797,6 +814,7 @@ uint64_t layer_state_t::diff(const layer_state_t& other) const {
CHECK_DIFF(diff, eColorChanged, other, color.rgb);
CHECK_DIFF(diff, eColorSpaceAgnosticChanged, other, colorSpaceAgnostic);
CHECK_DIFF(diff, eDimmingEnabledChanged, other, dimmingEnabled);
+ if (other.what & eBufferReleaseChannelChanged) diff |= eBufferReleaseChannelChanged;
return diff;
}