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

Commit 730f86fe authored by Ram Indani's avatar Ram Indani Committed by Android (Google) Code Review
Browse files

Merge changes from topic "RRN" into main

* changes:
  [Composer3-VTS] Test Composer3-V3 for refreshPeriodNanos and vsyncPeriodNanos
  [HWC3] AIDL change to add refreshPeriodNanos to RefreshRateChangedDebugData
parents e91038df a2a6deaf
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -36,4 +36,5 @@ package android.hardware.graphics.composer3;
parcelable RefreshRateChangedDebugData {
  long display;
  int vsyncPeriodNanos;
  int refreshPeriodNanos;
}
+11 −0
Original line number Diff line number Diff line
@@ -27,4 +27,15 @@ parcelable RefreshRateChangedDebugData {
     * The display vsync period in nanoseconds.
     */
    int vsyncPeriodNanos;

    /**
     * The refresh period of the display in nanoseconds.
     * On VRR (Variable Refresh Rate) displays, refreshPeriodNanos can be different from the
     * vsyncPeriodNanos because not every vsync cycle of the display is a refresh cycle.
     * This should be set to the current refresh period.
     * On non-VRR displays this value should be equal to vsyncPeriodNanos
     *
     * @see vsyncPeriodNanos
     */
    int refreshPeriodNanos;
}
+2 −1
Original line number Diff line number Diff line
@@ -517,7 +517,8 @@ std::pair<ScopedAStatus, std::vector<VtsDisplay>> VtsComposerClient::getDisplays
void VtsComposerClient::addDisplayConfigs(VtsDisplay* vtsDisplay,
                                          const std::vector<DisplayConfiguration>& configs) {
    for (const auto& config : configs) {
        vtsDisplay->addDisplayConfig(config.configId, {config.vsyncPeriod, config.configGroup});
        vtsDisplay->addDisplayConfig(config.configId,
                                     {config.vsyncPeriod, config.configGroup, config.vrrConfig});
    }
}

+6 −2
Original line number Diff line number Diff line
@@ -253,10 +253,14 @@ class VtsDisplay {
    int32_t getDisplayHeight() const { return mDisplayHeight; }

    struct DisplayConfig {
        DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_)
            : vsyncPeriod(vsyncPeriod_), configGroup(configGroup_) {}
        DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_,
                      std::optional<VrrConfig> vrrConfig_ = {})
            : vsyncPeriod(vsyncPeriod_),
              configGroup(configGroup_),
              vrrConfig(std::move(vrrConfig_)) {}
        int32_t vsyncPeriod;
        int32_t configGroup;
        std::optional<VrrConfig> vrrConfig;
    };

    void addDisplayConfig(int32_t config, DisplayConfig displayConfig) {
+31 −18
Original line number Diff line number Diff line
@@ -2664,7 +2664,8 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena
        return;
    }

    const auto displayId = getPrimaryDisplayId();
    for (VtsDisplay& display : mDisplays) {
        const auto displayId = display.getDisplayId();
        EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
        // Enable the callback
        ASSERT_TRUE(mComposerClient
@@ -2673,8 +2674,20 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena
                            .isOk());
        std::this_thread::sleep_for(100ms);

    const auto displayFilter = [displayId](auto refreshRateChangedDebugData) {
        return displayId == refreshRateChangedDebugData.display;
        const auto [status, configId] = mComposerClient->getActiveConfig(display.getDisplayId());
        EXPECT_TRUE(status.isOk());

        const auto displayFilter = [&](auto refreshRateChangedDebugData) {
            bool nonVrrRateMatching = true;
            if (std::optional<VrrConfig> vrrConfigOpt =
                        display.getDisplayConfig(configId).vrrConfig;
                getInterfaceVersion() >= 3 && !vrrConfigOpt) {
                nonVrrRateMatching = refreshRateChangedDebugData.refreshPeriodNanos ==
                                     refreshRateChangedDebugData.vsyncPeriodNanos;
            }
            const bool isDisplaySame =
                    display.getDisplayId() == refreshRateChangedDebugData.display;
            return nonVrrRateMatching && isDisplaySame;
        };

        // Check that we immediately got a callback
@@ -2685,6 +2698,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena
                                                                        /*enabled*/ false)
                            .isOk());
    }
}

TEST_P(GraphicsComposerAidlCommandV2Test,
       SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) {
@@ -3001,7 +3015,6 @@ INSTANTIATE_TEST_SUITE_P(
        PerInstance, GraphicsComposerAidlCommandV2Test,
        testing::ValuesIn(::android::getAidlHalInstanceNames(IComposer::descriptor)),
        ::android::PrintInstanceNameToString);

}  // namespace aidl::android::hardware::graphics::composer3::vts

int main(int argc, char** argv) {