2019-08-21 16:53:07 +08:00
|
|
|
/*
|
2021-05-18 19:14:55 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-08-21 16:53:07 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/memory_operations_handler.h"
|
2019-08-21 16:53:07 +08:00
|
|
|
|
2020-07-10 08:19:05 +08:00
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
2019-08-21 16:53:07 +08:00
|
|
|
namespace NEO {
|
|
|
|
|
|
|
|
class GraphicsAllocation;
|
|
|
|
|
|
|
|
class MockMemoryOperationsHandler : public MemoryOperationsHandler {
|
|
|
|
public:
|
|
|
|
MockMemoryOperationsHandler() {}
|
2020-07-02 17:49:46 +08:00
|
|
|
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override { return MemoryOperationsStatus::UNSUPPORTED; }
|
|
|
|
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::UNSUPPORTED; }
|
|
|
|
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override { return MemoryOperationsStatus::UNSUPPORTED; }
|
2019-08-21 16:53:07 +08:00
|
|
|
};
|
2020-07-10 08:19:05 +08:00
|
|
|
|
|
|
|
class MockMemoryOperationsHandlerTests : public MemoryOperationsHandler {
|
|
|
|
public:
|
|
|
|
MockMemoryOperationsHandlerTests() {}
|
|
|
|
MOCK_METHOD(MemoryOperationsStatus, makeResident,
|
|
|
|
(Device * device, ArrayRef<GraphicsAllocation *> gfxAllocations), (override));
|
|
|
|
MOCK_METHOD(MemoryOperationsStatus, evict,
|
|
|
|
(Device * device, GraphicsAllocation &gfxAllocation), (override));
|
|
|
|
MOCK_METHOD(MemoryOperationsStatus, isResident,
|
|
|
|
(Device * device, GraphicsAllocation &gfxAllocation), (override));
|
|
|
|
};
|
|
|
|
|
2021-05-19 19:52:10 +08:00
|
|
|
class MockMemoryOperations : public MemoryOperationsHandler {
|
|
|
|
public:
|
|
|
|
MockMemoryOperations() {}
|
|
|
|
|
|
|
|
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
|
|
|
|
makeResidentCalledCount++;
|
|
|
|
return MemoryOperationsStatus::SUCCESS;
|
|
|
|
}
|
|
|
|
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
|
|
|
|
evictCalledCount++;
|
|
|
|
return MemoryOperationsStatus::SUCCESS;
|
|
|
|
}
|
|
|
|
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override {
|
|
|
|
return MemoryOperationsStatus::SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int makeResidentCalledCount = 0;
|
|
|
|
int evictCalledCount = 0;
|
|
|
|
};
|
|
|
|
|
2020-03-13 16:17:01 +08:00
|
|
|
} // namespace NEO
|