Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2deb82e authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Disable transform hint when the layer uses getTransformToDisplayInverse flag

In some cases such as camera viewfinder, the app always submits buffer in one orientation and
aligns with the device orientation with by setting the getTransformToDisplayInverse flag. If
the device rotates, SF will send a transform hint to gl consumer which will rotate the
buffer. If the surface sets the getTransformToDisplayInverse flag we do not want to rotate the
buffer.

This change also adds effective_scaling_mode to winscope trace.

Bug: b/74400997

Test: rotate the device with open gl test app provided in bug
Test: open trace with winscope
Test: mmma frameworks/native/services/surfaceflinger/tests/ && \
mmma frameworks/native/libs/gui/tests/ && adb sync data && \
adb shell /data/nativetest64/libgui_test/libgui_test && \
adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest && \
adb shell /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test && \
adb shell /data/nativetest64/SurfaceParcelable_test/SurfaceParcelable_test && \
echo "ALL TESTS PASSED"

Change-Id: Ibd181a4e8d2ec3a0ca9dc3c2900bb9dc2ac1ec0f
parent d73ce176
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1337,7 +1337,10 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const {

void Layer::updateTransformHint(const sp<const DisplayDevice>& display) const {
    uint32_t orientation = 0;
    if (!mFlinger->mDebugDisableTransformHint) {
    // Disable setting transform hint if the debug flag is set or if the
    // getTransformToDisplayInverse flag is set and the client wants to submit buffers
    // in one orientation.
    if (!mFlinger->mDebugDisableTransformHint && !getTransformToDisplayInverse()) {
        // The transform hint is used to improve performance, but we can
        // only have a single transform hint, it cannot
        // apply to all displays.
@@ -1969,6 +1972,7 @@ void Layer::writeToProto(LayerProto* layerInfo, LayerVector::StateSet stateSet)
    layerInfo->set_window_type(state.type);
    layerInfo->set_app_id(state.appId);
    layerInfo->set_curr_frame(mCurrentFrameNumber);
    layerInfo->set_effective_scaling_mode(getEffectiveScalingMode());

    for (const auto& pendingState : mPendingStates) {
        auto barrierLayer = pendingState.barrierLayer_legacy.promote();
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ message LayerProto {
  repeated BarrierLayerProto barrier_layer = 38;
  // If active_buffer is not null, record its transform.
  optional TransformProto buffer_transform = 39;
  optional int32 effective_scaling_mode = 40;
}

message PositionProto {