@@ -288,10 +288,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenFlushIs
288288}
289289
290290HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenProcessResidencyIsCalledButSubCaptureIsDisabledThenItShouldntWriteMemory) {
291+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
291292 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , true );
292293 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
293294
294- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
295295 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
296296 aubSubCaptureManagerMock->disableSubCapture ();
297297 aubCsr->subCaptureManager = aubSubCaptureManagerMock.get ();
@@ -306,13 +306,13 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
306306
307307HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenProcessResidencyIsCalledButAllocationSizeIsZeroThenItShouldntWriteMemory) {
308308 DebugManagerStateRestore stateRestore;
309+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
309310 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , true );
310311 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
311312
312313 const DispatchInfo dispatchInfo;
313314 MultiDispatchInfo multiDispatchInfo;
314315 multiDispatchInfo.push (dispatchInfo);
315- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
316316 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
317317 aubSubCaptureManagerMock->setSubCaptureToggleActive (true );
318318 aubSubCaptureManagerMock->activateSubCapture (multiDispatchInfo);
@@ -327,11 +327,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
327327}
328328
329329HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenFlushIsCalledButSubCaptureIsDisabledThenItShouldntInitializeEngineInfo) {
330+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
330331 auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(true , true , true );
331332 auto aubCsr = aubExecutionEnvironment->template getCsr <AUBCommandStreamReceiverHw<FamilyType>>();
332333 LinearStream cs (aubExecutionEnvironment->commandBuffer );
333334
334- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
335335 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
336336 aubSubCaptureManagerMock->disableSubCapture ();
337337 aubCsr->subCaptureManager = aubSubCaptureManagerMock.get ();
@@ -436,11 +436,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStanda
436436
437437HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenFlushIsCalledButSubCaptureIsDisabledThenItShouldUpdateHwTagWithLatestSentTaskCount) {
438438 DebugManagerStateRestore stateRestore;
439+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
439440 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , true );
440441 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
441442 LinearStream cs (aubExecutionEnvironment->commandBuffer );
442443
443- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
444444 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
445445 aubSubCaptureManagerMock->disableSubCapture ();
446446 aubCsr->subCaptureManager = aubSubCaptureManagerMock.get ();
@@ -461,11 +461,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
461461
462462HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStandaloneAndSubCaptureModeWhenFlushIsCalledButSubCaptureIsDisabledThenItShouldNotUpdateHwTagWithLatestSentTaskCount) {
463463 DebugManagerStateRestore stateRestore;
464+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
464465 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , false );
465466 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
466467 LinearStream cs (aubExecutionEnvironment->commandBuffer );
467468
468- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
469469 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
470470 aubSubCaptureManagerMock->disableSubCapture ();
471471 aubCsr->subCaptureManager = aubSubCaptureManagerMock.get ();
@@ -488,14 +488,14 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStanda
488488HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenItShouldDeactivateSubCapture) {
489489 DebugManagerStateRestore stateRestore;
490490
491+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
491492 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , false );
492493 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
493494 LinearStream cs (aubExecutionEnvironment->commandBuffer );
494495
495496 const DispatchInfo dispatchInfo;
496497 MultiDispatchInfo multiDispatchInfo;
497498 multiDispatchInfo.push (dispatchInfo);
498- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
499499 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
500500 aubSubCaptureManagerMock->setSubCaptureToggleActive (true );
501501 aubSubCaptureManagerMock->activateSubCapture (multiDispatchInfo);
@@ -511,6 +511,32 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
511511 EXPECT_FALSE (aubCsr->subCaptureManager ->isSubCaptureEnabled ());
512512}
513513
514+ HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenItShouldCallPollForCompletion) {
515+ DebugManagerStateRestore stateRestore;
516+
517+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
518+ auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , false );
519+ auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
520+ LinearStream cs (aubExecutionEnvironment->commandBuffer );
521+
522+ const DispatchInfo dispatchInfo;
523+ MultiDispatchInfo multiDispatchInfo;
524+ multiDispatchInfo.push (dispatchInfo);
525+ aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
526+ aubSubCaptureManagerMock->setSubCaptureToggleActive (true );
527+ aubSubCaptureManagerMock->activateSubCapture (multiDispatchInfo);
528+ aubCsr->subCaptureManager = aubSubCaptureManagerMock.get ();
529+ ASSERT_TRUE (aubCsr->subCaptureManager ->isSubCaptureEnabled ());
530+
531+ BatchBuffer batchBuffer{cs.getGraphicsAllocation (), 0 , 0 , nullptr , false , false , QueueThrottle::MEDIUM, cs.getUsed (), &cs};
532+
533+ ResidencyContainer allocationsForResidency = {};
534+
535+ aubCsr->flush (batchBuffer, allocationsForResidency);
536+
537+ EXPECT_TRUE (aubCsr->pollForCompletionCalled );
538+ }
539+
514540HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnCommandBufferAllocation) {
515541 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , true );
516542 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
@@ -610,6 +636,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStanda
610636
611637HWTEST_F (AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneAndSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenItShouldCallMakeResidentOnCommandBufferAndResidencyAllocations) {
612638 DebugManagerStateRestore stateRestore;
639+ auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
613640 auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true , true , true );
614641 auto aubCsr = aubExecutionEnvironment->template getCsr <MockAubCsr<FamilyType>>();
615642 auto memoryManager = aubExecutionEnvironment->executionEnvironment ->memoryManager .get ();
@@ -619,7 +646,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
619646 const DispatchInfo dispatchInfo;
620647 MultiDispatchInfo multiDispatchInfo;
621648 multiDispatchInfo.push (dispatchInfo);
622- auto aubSubCaptureManagerMock = std::unique_ptr<AubSubCaptureManagerMock>(new AubSubCaptureManagerMock (" " ));
623649 aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
624650 aubSubCaptureManagerMock->setSubCaptureToggleActive (true );
625651 aubSubCaptureManagerMock->activateSubCapture (multiDispatchInfo);
0 commit comments