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

Commit 46ca8f7a authored by Ram Indani's avatar Ram Indani Committed by Automerger Merge Worker
Browse files

Merge "[SF] Use HWC api getPhysicalDisplayOrientation" into tm-dev am: ade990bd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/17195693

Change-Id: I6cee9c007dd025483814e7a136100489d29d22f6
parents 22a98637 ade990bd
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -134,7 +134,9 @@ public:
                          std::optional<aidl::android::hardware::graphics::common::
                                                DisplayDecorationSupport>* support));
    MOCK_METHOD2(setIdleTimerEnabled, status_t(PhysicalDisplayId, std::chrono::milliseconds));
    MOCK_METHOD1(hasDisplayIdleTimerCapability, bool(PhysicalDisplayId displayId));
    MOCK_METHOD(bool, hasDisplayIdleTimerCapability, (PhysicalDisplayId), (const, override));
    MOCK_METHOD(Hwc2::AidlTransform, getPhysicalDisplayOrientation, (PhysicalDisplayId),
                (const, override));
};

} // namespace mock
+13 −0
Original line number Diff line number Diff line
@@ -249,6 +249,7 @@ bool AidlComposer::isSupported(OptionalFeature feature) const {
        case OptionalFeature::DisplayBrightnessCommand:
        case OptionalFeature::BootDisplayConfig:
        case OptionalFeature::KernelIdleTimer:
        case OptionalFeature::PhysicalDisplayOrientation:
            return true;
    }
}
@@ -1126,5 +1127,17 @@ Error AidlComposer::setIdleTimerEnabled(Display displayId, std::chrono::millisec
    return Error::NONE;
}

Error AidlComposer::getPhysicalDisplayOrientation(Display displayId,
                                                  AidlTransform* outDisplayOrientation) {
    const auto status =
            mAidlComposerClient->getDisplayPhysicalOrientation(translate<int64_t>(displayId),
                                                               outDisplayOrientation);
    if (!status.isOk()) {
        ALOGE("getPhysicalDisplayOrientation failed %s", status.getDescription().c_str());
        return static_cast<Error>(status.getServiceSpecificError());
    }
    return Error::NONE;
}

} // namespace Hwc2
} // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ public:
                                      std::optional<DisplayDecorationSupport>* support) override;
    Error setIdleTimerEnabled(Display displayId, std::chrono::milliseconds timeout) override;

    Error getPhysicalDisplayOrientation(Display displayId,
                                        AidlTransform* outDisplayOrientation) override;

private:
    // Many public functions above simply write a command into the command
    // queue to batch the calls.  validateDisplay and presentDisplay will call
+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include <aidl/android/hardware/graphics/composer3/DisplayCapability.h>
#include <aidl/android/hardware/graphics/composer3/IComposerCallback.h>

#include <aidl/android/hardware/graphics/common/Transform.h>
#include <optional>

// TODO(b/129481165): remove the #pragma below and fix conversion issues
@@ -80,6 +81,7 @@ using V2_4::VsyncPeriodNanos;
using PerFrameMetadata = IComposerClient::PerFrameMetadata;
using PerFrameMetadataKey = IComposerClient::PerFrameMetadataKey;
using PerFrameMetadataBlob = IComposerClient::PerFrameMetadataBlob;
using AidlTransform = ::aidl::android::hardware::graphics::common::Transform;

class Composer {
public:
@@ -94,6 +96,7 @@ public:
        DisplayBrightnessCommand,
        BootDisplayConfig,
        KernelIdleTimer,
        PhysicalDisplayOrientation,
    };

    virtual bool isSupported(OptionalFeature) const = 0;
@@ -277,6 +280,8 @@ public:
            std::optional<::aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
                    support) = 0;
    virtual Error setIdleTimerEnabled(Display displayId, std::chrono::milliseconds timeout) = 0;
    virtual Error getPhysicalDisplayOrientation(Display displayId,
                                                AidlTransform* outDisplayOrientation) = 0;
};

} // namespace Hwc2
+5 −0
Original line number Diff line number Diff line
@@ -154,6 +154,11 @@ bool Display::hasDisplayIdleTimerCapability() const {
            isCapabilitySupported;
}

Error Display::getPhysicalDisplayOrientation(Hwc2::AidlTransform* outTransform) const {
    auto error = mComposer.getPhysicalDisplayOrientation(mId, outTransform);
    return static_cast<Error>(error);
}

Error Display::getChangedCompositionTypes(std::unordered_map<HWC2::Layer*, Composition>* outTypes) {
    std::vector<Hwc2::Layer> layerIds;
    std::vector<Composition> types;
Loading