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
This commit is contained in:
commit
730f86fe18
5 changed files with 51 additions and 21 deletions
|
@ -36,4 +36,5 @@ package android.hardware.graphics.composer3;
|
|||
parcelable RefreshRateChangedDebugData {
|
||||
long display;
|
||||
int vsyncPeriodNanos;
|
||||
int refreshPeriodNanos;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -2664,26 +2664,40 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena
|
|||
return;
|
||||
}
|
||||
|
||||
const auto displayId = getPrimaryDisplayId();
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
|
||||
// Enable the callback
|
||||
ASSERT_TRUE(mComposerClient
|
||||
->setRefreshRateChangedCallbackDebugEnabled(displayId,
|
||||
/*enabled*/ true)
|
||||
.isOk());
|
||||
std::this_thread::sleep_for(100ms);
|
||||
for (VtsDisplay& display : mDisplays) {
|
||||
const auto displayId = display.getDisplayId();
|
||||
EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
|
||||
// Enable the callback
|
||||
ASSERT_TRUE(mComposerClient
|
||||
->setRefreshRateChangedCallbackDebugEnabled(displayId,
|
||||
/*enabled*/ true)
|
||||
.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());
|
||||
|
||||
// Check that we immediately got a callback
|
||||
EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter));
|
||||
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;
|
||||
};
|
||||
|
||||
ASSERT_TRUE(mComposerClient
|
||||
->setRefreshRateChangedCallbackDebugEnabled(displayId,
|
||||
/*enabled*/ false)
|
||||
.isOk());
|
||||
// Check that we immediately got a callback
|
||||
EXPECT_TRUE(checkIfCallbackRefreshRateChangedDebugEnabledReceived(displayFilter));
|
||||
|
||||
ASSERT_TRUE(mComposerClient
|
||||
->setRefreshRateChangedCallbackDebugEnabled(displayId,
|
||||
/*enabled*/ false)
|
||||
.isOk());
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(GraphicsComposerAidlCommandV2Test,
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue