refactor: command container tests

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska
2024-05-09 13:38:31 +00:00
committed by Compute-Runtime-Automation
parent 5052d4ac4b
commit 02e2a13c84
3 changed files with 14 additions and 7 deletions

View File

@@ -1011,7 +1011,7 @@ HWTEST_F(CommandContainerTest, givenCmdContainerWhenReuseExistingCmdBufferWithAl
allocList.freeAllGraphicsAllocations(pDevice);
}
TEST_F(CommandContainerTest, GivenCmdContainerWhenContainerIsInitializedThenSurfaceStateIndirectHeapSizeIsCorrect) {
HWTEST_F(CommandContainerTest, GivenCmdContainerWhenContainerIsInitializedThenSurfaceStateIndirectHeapSizeIsCorrect) {
MyMockCommandContainer cmdContainer;
cmdContainer.initialize(pDevice, nullptr, HeapSize::defaultHeapSize, true, false);
auto size = cmdContainer.allocationIndirectHeaps[IndirectHeap::Type::surfaceState]->getUnderlyingBufferSize();
@@ -1634,11 +1634,11 @@ TEST_F(CommandContainerTest, givenCmdContainerAndCsrWhenGetHeapWithRequiredSizeA
cmdContainer->fillReusableAllocationLists();
auto &reusableHeapsList = reinterpret_cast<MockHeapHelper *>(cmdContainer->getHeapHelper())->storageForReuse->getAllocationsForReuse();
auto baseAlloc = cmdContainer->getIndirectHeapAllocation(HeapType::indirectObject);
auto reusableAlloc = reusableHeapsList.peekHead();
auto baseAlloc = cmdContainer->getIndirectHeapAllocation(HeapType::surfaceState);
auto reusableAlloc = reusableHeapsList.peekTail();
cmdContainer->getIndirectHeap(HeapType::indirectObject)->getSpace(cmdContainer->getIndirectHeap(HeapType::indirectObject)->getMaxAvailableSpace());
auto heap = cmdContainer->getHeapWithRequiredSizeAndAlignment(HeapType::indirectObject, 1024, 1024);
cmdContainer->getIndirectHeap(HeapType::surfaceState)->getSpace(cmdContainer->getIndirectHeap(HeapType::surfaceState)->getMaxAvailableSpace());
auto heap = cmdContainer->getHeapWithRequiredSizeAndAlignment(HeapType::surfaceState, 1024, 1024);
EXPECT_EQ(heap->getGraphicsAllocation(), reusableAlloc);
EXPECT_TRUE(reusableHeapsList.peekContains(*baseAlloc));
@@ -1722,10 +1722,13 @@ TEST_F(CommandContainerTest, givenCmdContainerSetToSbaTrackingWhenStateHeapsCons
TEST_F(CommandContainerTest, givenCmdContainerSetToSbaTrackingWhenContainerIsInitializedThenSurfaceHeapDefaultValueIsUsed) {
constexpr size_t sshDefaultSize = 2 * HeapSize::defaultHeapSize;
auto &productHelper = pDevice->getProductHelper();
auto &gfxCoreHelper = pDevice->getGfxCoreHelper();
auto expectedSshSize = gfxCoreHelper.getDefaultSshSize(productHelper);
auto cmdContainer = std::make_unique<MyMockCommandContainer>();
cmdContainer->initialize(pDevice, nullptr, sshDefaultSize, true, false);
EXPECT_EQ(HeapSize::defaultHeapSize, cmdContainer->defaultSshSize);
EXPECT_EQ(expectedSshSize, cmdContainer->defaultSshSize);
cmdContainer = std::make_unique<MyMockCommandContainer>();
cmdContainer->setStateBaseAddressTracking(true);

View File

@@ -19,6 +19,7 @@ class CommandEncodeStatesFixture : public DeviceFixture {
public:
class MyMockCommandContainer : public CommandContainer {
public:
using CommandContainer::allocationIndirectHeaps;
using CommandContainer::dirtyHeaps;
using CommandContainer::indirectHeaps;