TBX CSR to call writeMemory on aubManager

Change-Id: Ie10a30944e0c3a8e136816fa91ff501887a3d0d2
This commit is contained in:
Milczarek, Slawomir 2019-01-31 16:18:18 +01:00
parent fb0424bc5a
commit 6ef2822643
2 changed files with 15 additions and 5 deletions

View File

@ -361,9 +361,9 @@ void TbxCommandStreamReceiverHw<GfxFamily>::pollForCompletion() {
template <typename GfxFamily> template <typename GfxFamily>
void TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits, DevicesBitfield devicesBitfield) { void TbxCommandStreamReceiverHw<GfxFamily>::writeMemory(uint64_t gpuAddress, void *cpuAddress, size_t size, uint32_t memoryBank, uint64_t entryBits, DevicesBitfield devicesBitfield) {
if (hardwareContext) { if (aubManager) {
int hint = AubMemDump::DataTypeHintValues::TraceNotype; int hint = AubMemDump::DataTypeHintValues::TraceNotype;
hardwareContext->writeMemory(gpuAddress, cpuAddress, size, memoryBank, hint, MemoryConstants::pageSize64k); aubManager->writeMemory(gpuAddress, cpuAddress, size, memoryBank, hint, MemoryConstants::pageSize64k);
return; return;
} }

View File

@ -349,6 +349,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true); auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true);
auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>(); auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>();
tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext); tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext);
tbxCsr->aubManager = mockManager.get();
LinearStream cs(tbxExecutionEnvironment->commandBuffer); LinearStream cs(tbxExecutionEnvironment->commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs}; BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
@ -358,9 +359,12 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
tbxCsr->flush(batchBuffer, allocationsForResidency); tbxCsr->flush(batchBuffer, allocationsForResidency);
EXPECT_TRUE(mockHardwareContext->initializeCalled); EXPECT_TRUE(mockHardwareContext->initializeCalled);
EXPECT_TRUE(mockHardwareContext->writeMemoryCalled);
EXPECT_TRUE(mockHardwareContext->submitCalled); EXPECT_TRUE(mockHardwareContext->submitCalled);
EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled); EXPECT_TRUE(mockHardwareContext->pollForCompletionCalled);
//call writeMemory on aubManager to clone page tables
EXPECT_FALSE(mockHardwareContext->writeMemoryCalled);
EXPECT_TRUE(mockManager->writeMemoryCalled);
} }
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFlushIsCalledThenItShouldMakeCommandBufferResident) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFlushIsCalledThenItShouldMakeCommandBufferResident) {
@ -373,6 +377,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true); auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true);
auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>(); auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>();
tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext); tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext);
tbxCsr->aubManager = mockManager.get();
LinearStream cs(tbxExecutionEnvironment->commandBuffer); LinearStream cs(tbxExecutionEnvironment->commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs}; BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 1, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
@ -380,7 +385,9 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
tbxCsr->flush(batchBuffer, allocationsForResidency); tbxCsr->flush(batchBuffer, allocationsForResidency);
EXPECT_TRUE(mockHardwareContext->writeMemoryCalled); //call writeMemory on aubManager to clone page tables
EXPECT_FALSE(mockHardwareContext->writeMemoryCalled);
EXPECT_TRUE(mockManager->writeMemoryCalled);
EXPECT_EQ(1u, batchBuffer.commandBufferAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId())); EXPECT_EQ(1u, batchBuffer.commandBufferAllocation->getResidencyTaskCount(tbxCsr->getOsContext().getContextId()));
} }
@ -408,12 +415,15 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true); auto tbxExecutionEnvironment = getEnvironment<MockTbxCsr<FamilyType>>(true, true);
auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>(); auto tbxCsr = tbxExecutionEnvironment->template getCsr<MockTbxCsr<FamilyType>>();
tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext); tbxCsr->hardwareContext = std::unique_ptr<MockHardwareContext>(mockHardwareContext);
tbxCsr->aubManager = mockManager.get();
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
ResidencyContainer allocationsForResidency = {&allocation}; ResidencyContainer allocationsForResidency = {&allocation};
tbxCsr->processResidency(allocationsForResidency); tbxCsr->processResidency(allocationsForResidency);
EXPECT_TRUE(mockHardwareContext->writeMemoryCalled); //call writeMemory on aubManager to clone page tables
EXPECT_FALSE(mockHardwareContext->writeMemoryCalled);
EXPECT_TRUE(mockManager->writeMemoryCalled);
} }
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsCalledThenItShouldCallTheExpectedHwContextFunctions) {