Cleanup mocks
Signed-off-by: Daniel Chabrowski daniel.chabrowski@intel.com Related-To: NEO-6591
This commit is contained in:
parent
1c0502733f
commit
754efbdaff
|
@ -36,20 +36,15 @@ struct MockDrmMemoryOperationsHandlerBind : public DrmMemoryOperationsHandlerBin
|
||||||
using DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind;
|
using DrmMemoryOperationsHandlerBind::DrmMemoryOperationsHandlerBind;
|
||||||
using DrmMemoryOperationsHandlerBind::evictImpl;
|
using DrmMemoryOperationsHandlerBind::evictImpl;
|
||||||
|
|
||||||
DrmQueryMock *mock;
|
|
||||||
bool useBaseEvictUnused = true;
|
bool useBaseEvictUnused = true;
|
||||||
uint32_t evictUnusedCalled = 0;
|
uint32_t evictUnusedCalled = 0;
|
||||||
|
|
||||||
void evictUnusedAllocations(bool waitForCompletion, bool isLockNeeded) override {
|
void evictUnusedAllocations(bool waitForCompletion, bool isLockNeeded) override {
|
||||||
evictUnusedCalled++;
|
evictUnusedCalled++;
|
||||||
if (useBaseEvictUnused) {
|
if (useBaseEvictUnused) {
|
||||||
DrmMemoryOperationsHandlerBind::evictUnusedAllocations(waitForCompletion, isLockNeeded);
|
DrmMemoryOperationsHandlerBind::evictUnusedAllocations(waitForCompletion, isLockNeeded);
|
||||||
} else {
|
|
||||||
mock->context.vmBindReturn = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void setDrmMock(DrmQueryMock *mock) {
|
|
||||||
this->mock = mock;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <uint32_t numRootDevices>
|
template <uint32_t numRootDevices>
|
||||||
|
@ -145,7 +140,6 @@ TEST_F(DrmMemoryOperationsHandlerBindTest, whenNoSpaceLeftOnDeviceThenEvictUnuse
|
||||||
mock->context.vmBindReturn = -1;
|
mock->context.vmBindReturn = -1;
|
||||||
mock->baseErrno = false;
|
mock->baseErrno = false;
|
||||||
mock->errnoRetVal = ENOSPC;
|
mock->errnoRetVal = ENOSPC;
|
||||||
operationHandler->setDrmMock(mock);
|
|
||||||
operationHandler->useBaseEvictUnused = false;
|
operationHandler->useBaseEvictUnused = false;
|
||||||
|
|
||||||
EXPECT_EQ(operationHandler->evictUnusedCalled, 0u);
|
EXPECT_EQ(operationHandler->evictUnusedCalled, 0u);
|
||||||
|
|
|
@ -195,7 +195,7 @@ void MemoryManager::freeSystemMemory(void *ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
|
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation) {
|
||||||
return freeGraphicsMemory(gfxAllocation, false);
|
freeGraphicsMemory(gfxAllocation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryManager::freeGraphicsMemory(GraphicsAllocation *gfxAllocation, bool isImportedAllocation) {
|
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());
|
getLocalMemoryUsageBankSelector(gfxAllocation->getAllocationType(), gfxAllocation->getRootDeviceIndex())->freeOnBanks(gfxAllocation->storageInfo.getMemoryBanks(), gfxAllocation->getUnderlyingBufferSize());
|
||||||
freeGraphicsMemoryImpl(gfxAllocation, isImportedAllocation);
|
freeGraphicsMemoryImpl(gfxAllocation, isImportedAllocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if not in use destroy in place
|
//if not in use destroy in place
|
||||||
//if in use pass to temporary allocation list that is cleaned on blocking calls
|
//if in use pass to temporary allocation list that is cleaned on blocking calls
|
||||||
void MemoryManager::checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocation *gfxAllocation) {
|
void MemoryManager::checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocation *gfxAllocation) {
|
||||||
|
|
Loading…
Reference in New Issue