summaryrefslogtreecommitdiff
path: root/libs/gui/SurfaceComposerClient.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2020-05-08 17:42:25 -0700
committer Vishnu Nair <vishnun@google.com> 2020-05-08 17:44:10 -0700
commit6213bd900145b9189c7d87aec8a2714a66c8d057 (patch)
treeece6beaecbdb66c70ff022b843c55837747e0589 /libs/gui/SurfaceComposerClient.cpp
parent58dc474b3d5fbc5a34388789bc79b39254f84d73 (diff)
Provide a fixed transform hint if the layer is in a fixed orientation 1/2
The transform hint is used to prevent allocating a buffer of a different size when a layer is rotated. The producer can choose to consume the hint and allocate the buffer with the same size. Provide the graphic producer a transform hint if the layer and its children are in an orientation different from the display's orientation. The caller is responsible for clearing this transform hint if the layer is no longer in a fixed orientation. Bug: 152919661 Test: atest VulkanPreTransformTest Test: confirm with winscope trace, buffers are allocated taking into account the transform hint in fixed orientation scenarios Test: go/wm-smoke Change-Id: Iea9dcf909921802a5be5c44dd61be3274f36bbd8
Diffstat (limited to 'libs/gui/SurfaceComposerClient.cpp')
-rw-r--r--libs/gui/SurfaceComposerClient.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index a52f298e77..5922f3a876 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -1437,6 +1437,22 @@ SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFrame
return *this;
}
+SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::setFixedTransformHint(
+ const sp<SurfaceControl>& sc, int32_t fixedTransformHint) {
+ layer_state_t* s = getLayerState(sc);
+ if (!s) {
+ mStatus = BAD_INDEX;
+ return *this;
+ }
+
+ const ui::Transform::RotationFlags transform = fixedTransformHint == -1
+ ? ui::Transform::ROT_INVALID
+ : ui::Transform::toRotationFlags(static_cast<ui::Rotation>(fixedTransformHint));
+ s->what |= layer_state_t::eFixedTransformHintChanged;
+ s->fixedTransformHint = transform;
+ return *this;
+}
+
// ---------------------------------------------------------------------------
DisplayState& SurfaceComposerClient::Transaction::getDisplayState(const sp<IBinder>& token) {