Cleanup mocks

Signed-off-by: Daniel Chabrowski daniel.chabrowski@intel.com
Related-To: NEO-6591
This commit is contained in:
Daniel Chabrowski 2022-03-17 15:54:48 +00:00 committed by Compute-Runtime-Automation
parent 1c0502733f
commit 754efbdaff
2 changed files with 3 additions and 8 deletions

View File

@ -36,20 +36,15 @@ struct MockDrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandlerBin
using DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind;
using DrmMemoryOperationsHandlerBind::evictImpl;
DrmQueryMock *mock;
bool useBaseEvictUnused = true;
uint32_t evictUnusedCalled = 0;
void evictUnusedAllocations(bool waitForCompletion, bool isLockNeeded) override {
evictUnusedCalled++;
if (useBaseEvictUnused) {
DrmMemoryOperationsHandlerBind::evictUnusedAllocations(waitForCompletion, isLockNeeded);
} else {
mock->context.vmBindReturn = 0;
}
}
void setDrmMock(DrmQueryMock *mock) {
this->mock = mock;
}
};
template <uint32_t numRootDevices>
@ -145,7 +140,6 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenNoSpaceLeftOnDeviceThenEvictUnuse
mock->context.vmBindReturn = -1;
mock->baseErrno = false;
mock->errnoRetVal = ENOSPC;
operationHandler->setDrmMock(mock);
operationHandler->useBaseEvictUnused = false;
EXPECT_EQ(operationHandler->evictUnusedCalled, 0u);

View File

@ -195,7 +195,7 @@ void MemoryManager::freeSystemMemory(void *ptr) {
}
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
return freeGraphicsMemory(gfxAllocation, false);
freeGraphicsMemory(gfxAllocation, false);
}
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) {
@ -219,6 +219,7 @@ void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation, bool i
getLocalMemoryUsageBankSelector(gfxAllocation->getAllocationType(), gfxAllocation->getRootDeviceIndex())->freeOnBanks(gfxAllocation->storageInfo.getMemoryBanks(), gfxAllocation->getUnderlyingBufferSize());
freeGraphicsMemoryImpl(gfxAllocation, isImportedAllocation);
}
//if not in use destroy in place
//if in use pass to temporary allocation list that is cleaned on blocking calls
void MemoryManager::checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocation *gfxAllocation) {