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

Commit 3acaaf57 authored by ramindani's avatar ramindani
Browse files

[SF] Adds support to call notifyExpectedPresentHint

Adds the supporting code to make the call over HAL.

BUG: 296636253
BUG: 284845445
Test: m
Change-Id: I44e26affc7b179c125524351d01ea54431b51ace
parent 912e153e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ public:
    MOCK_METHOD(const aidl::android::hardware::graphics::composer3::OverlayProperties&,
                getOverlaySupport, (), (const, override));
    MOCK_METHOD(status_t, setRefreshRateChangedCallbackDebugEnabled, (PhysicalDisplayId, bool));
    MOCK_METHOD(status_t, notifyExpectedPresent, (PhysicalDisplayId, nsecs_t, int32_t));
};

} // namespace mock
+14 −0
Original line number Diff line number Diff line
@@ -1450,6 +1450,20 @@ Error AidlComposer::setRefreshRateChangedCallbackDebugEnabled(Display displayId,
    return Error::NONE;
}

Error AidlComposer::notifyExpectedPresent(Display displayId, nsecs_t expectedPresentTime,
                                          int32_t frameIntervalNs) {
    const auto status =
            mAidlComposerClient->notifyExpectedPresent(translate<int64_t>(displayId),
                                                       ClockMonotonicTimestamp{expectedPresentTime},
                                                       frameIntervalNs);

    if (!status.isOk()) {
        ALOGE("notifyExpectedPresent failed %s", status.getDescription().c_str());
        return static_cast<Error>(status.getServiceSpecificError());
    }
    return Error::NONE;
}

Error AidlComposer::getClientTargetProperty(
        Display display, ClientTargetPropertyWithBrightness* outClientTargetProperty) {
    Error error = Error::NONE;
+2 −0
Original line number Diff line number Diff line
@@ -240,6 +240,8 @@ public:
    Error getHdrConversionCapabilities(std::vector<HdrConversionCapability>*) override;
    Error setHdrConversionStrategy(HdrConversionStrategy, Hdr*) override;
    Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) override;
    Error notifyExpectedPresent(Display, nsecs_t expectedPresentTime,
                                int32_t frameIntervalNs) override;

private:
    // Many public functions above simply write a command into the command
+2 −0
Original line number Diff line number Diff line
@@ -298,6 +298,8 @@ public:
    virtual Error setHdrConversionStrategy(
            ::aidl::android::hardware::graphics::common::HdrConversionStrategy, Hdr*) = 0;
    virtual Error setRefreshRateChangedCallbackDebugEnabled(Display, bool) = 0;
    virtual Error notifyExpectedPresent(Display, nsecs_t expectedPresentTime,
                                        int32_t frameIntervalNs) = 0;
};

} // namespace Hwc2
+13 −0
Original line number Diff line number Diff line
@@ -876,6 +876,19 @@ status_t HWComposer::setRefreshRateChangedCallbackDebugEnabled(PhysicalDisplayId
    return NO_ERROR;
}

status_t HWComposer::notifyExpectedPresent(PhysicalDisplayId displayId, nsecs_t expectedPresentTime,
                                           int32_t frameIntervalNs) {
    ATRACE_CALL();
    RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX);
    const auto error = mComposer->notifyExpectedPresent(mDisplayData[displayId].hwcDisplay->getId(),
                                                        expectedPresentTime, frameIntervalNs);
    if (error != hal::Error::NONE) {
        ALOGE("Error in notifyExpectedPresent call %s", to_string(error).c_str());
        return INVALID_OPERATION;
    }
    return NO_ERROR;
}

status_t HWComposer::getDisplayDecorationSupport(
        PhysicalDisplayId displayId,
        std::optional<aidl::android::hardware::graphics::common::DisplayDecorationSupport>*
Loading