Move indirect heaps from command queues to csr.

-This is required to enable N:1 submission model.
-If heaps are coming from different command queues that always
mean that STATE_BASE_ADDRESS needs to be reloaded
-In order to not emit any non pipelined state in CSR, this change
moves the ownership of IndirectHeap to one centralized place which is
CommandStreamReceiver
-This way when there are submissions from multiple command queues then
they reuse the same heaps, therefore preventing SBA reload

Change-Id: I5caf5dc5cb05d7a2d8766883d9bc51c29062e980
This commit is contained in:
Mrozek, Michal
2018-04-26 10:01:01 +02:00
committed by sys_ocldev
parent be7393fcfe
commit 8d2df3c332
13 changed files with 231 additions and 123 deletions

View File

@ -258,6 +258,32 @@ HWTEST_F(CommandStreamReceiverTest, givenDefaultCommandStreamReceiverThenDefault
EXPECT_EQ(DispatchMode::ImmediateDispatch, csr.dispatchMode);
}
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenGetIndirectHeapIsCalledThenHeapIsReturned) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto &heap = csr.getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10u);
EXPECT_NE(nullptr, heap.getGraphicsAllocation());
EXPECT_NE(nullptr, csr.indirectHeap[IndirectHeap::DYNAMIC_STATE]);
EXPECT_EQ(&heap, csr.indirectHeap[IndirectHeap::DYNAMIC_STATE]);
}
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenReleaseIndirectHeapIsCalledThenHeapAllocationIsNull) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto &heap = csr.getIndirectHeap(IndirectHeap::DYNAMIC_STATE, 10u);
csr.releaseIndirectHeap(IndirectHeap::DYNAMIC_STATE);
EXPECT_EQ(nullptr, heap.getGraphicsAllocation());
EXPECT_EQ(0u, heap.getMaxAvailableSpace());
}
HWTEST_F(CommandStreamReceiverTest, givenCsrWhenAllocateHeapMemoryIsCalledThenHeapMemoryIsAllocated) {
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
IndirectHeap *dsh = nullptr;
csr.allocateHeapMemory(IndirectHeap::DYNAMIC_STATE, 4096u, dsh);
EXPECT_NE(nullptr, dsh);
ASSERT_NE(nullptr, dsh->getGraphicsAllocation());
csr.getMemoryManager()->freeGraphicsMemory(dsh->getGraphicsAllocation());
delete dsh;
}
TEST(CommandStreamReceiverSimpleTest, givenCSRWithoutTagAllocationWhenGetTagAllocationIsCalledThenNullptrIsReturned) {
MockCommandStreamReceiver csr;
EXPECT_EQ(nullptr, csr.getTagAllocation());
@ -268,4 +294,4 @@ TEST(CommandStreamReceiverSimpleTest, givenCSRWithTagAllocationSetWhenGetTagAllo
GraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
csr.setTagAllocation(&allocation);
EXPECT_EQ(&allocation, csr.getTagAllocation());
}
}