Merge "[Composer-VTS] Check minFrameIntervalNs to check if rate is changing" into main
This commit is contained in:
commit
8892a927f4
2 changed files with 33 additions and 14 deletions
|
@ -258,13 +258,13 @@ class VtsDisplay {
|
|||
|
||||
struct DisplayConfig {
|
||||
DisplayConfig(int32_t vsyncPeriod_, int32_t configGroup_,
|
||||
std::optional<VrrConfig> vrrConfig_ = {})
|
||||
std::optional<VrrConfig> vrrConfigOpt_ = {})
|
||||
: vsyncPeriod(vsyncPeriod_),
|
||||
configGroup(configGroup_),
|
||||
vrrConfig(std::move(vrrConfig_)) {}
|
||||
vrrConfigOpt(std::move(vrrConfigOpt_)) {}
|
||||
int32_t vsyncPeriod;
|
||||
int32_t configGroup;
|
||||
std::optional<VrrConfig> vrrConfig;
|
||||
std::optional<VrrConfig> vrrConfigOpt;
|
||||
};
|
||||
|
||||
void addDisplayConfig(int32_t config, DisplayConfig displayConfig) {
|
||||
|
@ -273,6 +273,21 @@ class VtsDisplay {
|
|||
|
||||
DisplayConfig getDisplayConfig(int32_t config) { return mDisplayConfigs.find(config)->second; }
|
||||
|
||||
bool isRateSameBetweenConfigs(int config1, int config2) {
|
||||
const auto displayConfig1 = getDisplayConfig(config1);
|
||||
const auto displayConfig2 = getDisplayConfig(config2);
|
||||
const auto vrrConfigOpt1 = displayConfig1.vrrConfigOpt;
|
||||
const auto vrrConfigOpt2 = displayConfig2.vrrConfigOpt;
|
||||
|
||||
if (vrrConfigOpt1 && vrrConfigOpt2 &&
|
||||
vrrConfigOpt1->minFrameIntervalNs == vrrConfigOpt2->minFrameIntervalNs) {
|
||||
return true;
|
||||
} else if (displayConfig1.vsyncPeriod == displayConfig2.vsyncPeriod) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unordered_map<int32_t, DisplayConfig> getDisplayConfigs() { return mDisplayConfigs; }
|
||||
|
||||
private:
|
||||
|
|
|
@ -1603,18 +1603,24 @@ class GraphicsComposerAidlCommandTest : public GraphicsComposerAidlTest {
|
|||
EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk());
|
||||
sendRefreshFrame(display, nullptr);
|
||||
|
||||
const auto displayConfigGroup1 = display.getDisplayConfig(config1);
|
||||
int32_t vsyncPeriod1 = displayConfigGroup1.vsyncPeriod;
|
||||
int32_t configGroup1 = displayConfigGroup1.configGroup;
|
||||
const auto displayConfig1 = display.getDisplayConfig(config1);
|
||||
int32_t vsyncPeriod1 = displayConfig1.vsyncPeriod;
|
||||
int32_t configGroup1 = displayConfig1.configGroup;
|
||||
|
||||
const auto displayConfigGroup2 = display.getDisplayConfig(config2);
|
||||
int32_t vsyncPeriod2 = displayConfigGroup2.vsyncPeriod;
|
||||
int32_t configGroup2 = displayConfigGroup2.configGroup;
|
||||
const auto displayConfig2 = display.getDisplayConfig(config2);
|
||||
int32_t vsyncPeriod2 = displayConfig2.vsyncPeriod;
|
||||
int32_t configGroup2 = displayConfig2.configGroup;
|
||||
|
||||
if (vsyncPeriod1 == vsyncPeriod2) {
|
||||
return; // continue
|
||||
}
|
||||
|
||||
if ((!displayConfig1.vrrConfigOpt && displayConfig2.vrrConfigOpt) ||
|
||||
(displayConfig1.vrrConfigOpt && !displayConfig2.vrrConfigOpt)) {
|
||||
// switching between vrr to non-vrr modes
|
||||
return; // continue
|
||||
}
|
||||
|
||||
// We don't allow delayed change when changing config groups
|
||||
if (params.delayForChange > 0 && configGroup1 != configGroup2) {
|
||||
return; // continue
|
||||
|
@ -2738,7 +2744,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test, SetRefreshRateChangedCallbackDebug_Ena
|
|||
const auto displayFilter = [&](auto refreshRateChangedDebugData) {
|
||||
bool nonVrrRateMatching = true;
|
||||
if (std::optional<VrrConfig> vrrConfigOpt =
|
||||
display.getDisplayConfig(configId).vrrConfig;
|
||||
display.getDisplayConfig(configId).vrrConfigOpt;
|
||||
getInterfaceVersion() >= 3 && !vrrConfigOpt) {
|
||||
nonVrrRateMatching = refreshRateChangedDebugData.refreshPeriodNanos ==
|
||||
refreshRateChangedDebugData.vsyncPeriodNanos;
|
||||
|
@ -2836,10 +2842,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test,
|
|||
.isOk());
|
||||
|
||||
forEachTwoConfigs(displayId, [&](int32_t config1, int32_t config2) {
|
||||
const int32_t vsyncPeriod1 = display.getDisplayConfig(config1).vsyncPeriod;
|
||||
const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod;
|
||||
|
||||
if (vsyncPeriod1 == vsyncPeriod2) {
|
||||
if (display.isRateSameBetweenConfigs(config1, config2)) {
|
||||
return; // continue
|
||||
}
|
||||
|
||||
|
@ -2854,6 +2857,7 @@ TEST_P(GraphicsComposerAidlCommandV2Test,
|
|||
sendRefreshFrame(display, &timeline);
|
||||
}
|
||||
|
||||
const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod;
|
||||
const auto callbackFilter = [displayId,
|
||||
vsyncPeriod2](auto refreshRateChangedDebugData) {
|
||||
constexpr int kVsyncThreshold = 1000;
|
||||
|
|
Loading…
Reference in a new issue