@@ -140,35 +140,49 @@ HWTEST_F(UltCommandStreamReceiverTest, givenSentStateSipFlagSetAndSourceLevelDeb
140140 pDevice->setDebuggerActive (false );
141141}
142142
143- HWTEST_F (UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPolicyChangedWhenEstimatingPreambleCmdSizeThenResultDependsOnPolicyProgrammingCmdSize ) {
143+ HWTEST_F (UltCommandStreamReceiverTest, givenPreambleSentAndThreadArbitrationPolicyChangedWhenEstimatingFlushTaskSizeThenResultDependsOnPolicyProgrammingCmdSize ) {
144144 auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver <FamilyType>();
145145 commandStreamReceiver.isPreambleSent = true ;
146146
147147 commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy ;
148- auto policyNotChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
148+ auto policyNotChangedPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
149+ auto policyNotChangedFlush = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags, *pDevice);
149150
150151 commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy + 1 ;
151- auto policyChanged = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
152-
153- auto actualDifference = policyChanged - policyNotChanged;
154- auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize ();
155- EXPECT_EQ (expectedDifference, actualDifference);
152+ auto policyChangedPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
153+ auto policyChangedFlush = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags, *pDevice);
154+
155+ auto actualDifferenceForPreamble = policyChangedPreamble - policyNotChangedPreamble;
156+ auto actualDifferenceForFlush = policyChangedFlush - policyNotChangedFlush;
157+ auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize () +
158+ commandStreamReceiver.getCmdSizeForComputeMode ();
159+ EXPECT_EQ (0u , actualDifferenceForPreamble);
160+ EXPECT_EQ (expectedDifference, actualDifferenceForFlush);
156161}
157162
158- HWTEST_F (UltCommandStreamReceiverTest, givenPreambleSentWhenEstimatingPreambleCmdSizeThenResultDependsOnPolicyProgrammingAndAdditionalCmdsSize ) {
163+ HWTEST_F (UltCommandStreamReceiverTest, givenPreambleSentWhenEstimatingFlushTaskSizeThenResultDependsOnPolicyProgrammingAndAdditionalCmdsSize ) {
159164 auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver <FamilyType>();
160165 commandStreamReceiver.requiredThreadArbitrationPolicy = commandStreamReceiver.lastSentThreadArbitrationPolicy ;
161166
162167 commandStreamReceiver.isPreambleSent = false ;
163- auto preambleNotSent = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
168+ auto preambleNotSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
169+ auto preambleNotSentFlush = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags, *pDevice);
164170
165171 commandStreamReceiver.isPreambleSent = true ;
166- auto preambleSent = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
172+ auto preambleSentPreamble = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
173+ auto preambleSentFlush = commandStreamReceiver.getRequiredCmdStreamSize (flushTaskFlags, *pDevice);
167174
168- auto actualDifference = preambleNotSent - preambleSent ;
169- auto expectedDifference = PreambleHelper<FamilyType>:: getThreadArbitrationCommandsSize () + PreambleHelper<FamilyType>:: getAdditionalCommandsSize (*pDevice) ;
175+ auto actualDifferenceForPreamble = preambleNotSentPreamble - preambleSentPreamble ;
176+ auto actualDifferenceForFlush = preambleNotSentFlush - preambleSentFlush ;
170177
171- EXPECT_EQ (expectedDifference, actualDifference);
178+ commandStreamReceiver.isPreambleSent = false ;
179+ auto expectedDifferenceForPreamble = PreambleHelper<FamilyType>::getAdditionalCommandsSize (*pDevice);
180+ auto expectedDifferenceForFlush = expectedDifferenceForPreamble + PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize () +
181+ commandStreamReceiver.getCmdSizeForL3Config () +
182+ PreambleHelper<FamilyType>::getCmdSizeForPipelineSelect (pDevice->getHardwareInfo ());
183+
184+ EXPECT_EQ (expectedDifferenceForPreamble, actualDifferenceForPreamble);
185+ EXPECT_EQ (expectedDifferenceForFlush, actualDifferenceForFlush);
172186}
173187
174188HWCMDTEST_F (IGFX_GEN8_CORE, UltCommandStreamReceiverTest, givenMediaVfeStateDirtyEstimatingPreambleCmdSizeThenResultDependsVfeStateProgrammingCmdSize) {
@@ -218,12 +232,12 @@ HWTEST_F(UltCommandStreamReceiverTest, givenPreambleSentAndForceSemaphoreDelayBe
218232 auto preambleSent = commandStreamReceiver.getRequiredCmdSizeForPreamble (*pDevice);
219233
220234 auto actualDifferenceWhenSemaphoreDelayNotReprogrammed = preambleNotSentAndSemaphoreDelayNotReprogrammed - preambleSent;
221- auto expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize () + PreambleHelper<FamilyType>:: getAdditionalCommandsSize (*pDevice);
235+ auto expectedDifference = PreambleHelper<FamilyType>::getAdditionalCommandsSize (*pDevice);
222236
223237 EXPECT_EQ (expectedDifference, actualDifferenceWhenSemaphoreDelayNotReprogrammed);
224238
225239 auto actualDifferenceWhenSemaphoreDelayReprogrammed = preambleNotSentAndSemaphoreDelayReprogrammed - preambleSent;
226- expectedDifference = PreambleHelper<FamilyType>::getThreadArbitrationCommandsSize () + PreambleHelper<FamilyType>:: getAdditionalCommandsSize (*pDevice) + PreambleHelper<FamilyType>::getSemaphoreDelayCommandSize ();
240+ expectedDifference = PreambleHelper<FamilyType>::getAdditionalCommandsSize (*pDevice) + PreambleHelper<FamilyType>::getSemaphoreDelayCommandSize ();
227241
228242 EXPECT_EQ (expectedDifference, actualDifferenceWhenSemaphoreDelayReprogrammed);
229243}
0 commit comments