Do not call submit on HardwareContext with zero-sized command buffer

Change-Id: I53b9233b30f58e2fcb354142eb1186a20c834d62
This commit is contained in:
Hoppe, Mateusz
2018-12-10 08:31:23 +01:00
committed by sys_ocldev
parent d870359434
commit e88548a251
2 changed files with 21 additions and 2 deletions

View File

@@ -175,7 +175,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI
aubCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext);
LinearStream cs(aubExecutionEnvironment->commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
ResidencyContainer allocationsForResidency;
aubCsr->flush(batchBuffer, allocationsForResidency);
@@ -186,6 +186,23 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI
EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled);
}
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) {
auto mockManager = std::make_unique<MockAubManager>();
auto mockHardwareContext = static_cast<MockHardwareContext *>(mockManager->createHardwareContext(0, EngineType::ENGINE_RCS));
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
aubCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext);
LinearStream cs(aubExecutionEnvironment->commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
ResidencyContainer allocationsForResidency;
aubCsr->flush(batchBuffer, allocationsForResidency);
EXPECT_FALSE(mockHardwareContext->submitCalled);
}
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
auto mockManager = std::make_unique<MockAubManager>();
auto mockHardwareContext = static_cast<MockHardwareContext *>(mockManager->createHardwareContext(0, EngineType::ENGINE_RCS));