2019-03-01 23:14:28 +08:00
|
|
|
/*
|
2020-01-13 15:54:47 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-03-01 23:14:28 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/gfx_partition.h"
|
2019-03-01 23:14:28 +08:00
|
|
|
|
2019-07-29 23:50:46 +08:00
|
|
|
#include "gmock/gmock.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
using namespace NEO;
|
2019-03-01 23:14:28 +08:00
|
|
|
|
|
|
|
class MockGfxPartition : public GfxPartition {
|
|
|
|
public:
|
2020-01-13 15:54:47 +08:00
|
|
|
using GfxPartition::osMemory;
|
|
|
|
|
2019-03-01 23:14:28 +08:00
|
|
|
uint64_t getHeapSize(HeapIndex heapIndex) {
|
|
|
|
return getHeap(heapIndex).getSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool heapInitialized(HeapIndex heapIndex) {
|
2019-03-15 18:09:06 +08:00
|
|
|
return getHeapSize(heapIndex) > 0;
|
2019-03-01 23:14:28 +08:00
|
|
|
}
|
|
|
|
|
2019-04-18 21:30:47 +08:00
|
|
|
void *getReservedCpuAddressRange() {
|
2020-03-30 01:40:34 +08:00
|
|
|
return reservedCpuAddressRange.alignedPtr;
|
2019-04-18 21:30:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t getReservedCpuAddressRangeSize() {
|
2020-03-30 01:40:34 +08:00
|
|
|
return reservedCpuAddressRange.actualReservedSize - GfxPartition::heapGranularity;
|
2019-04-18 21:30:47 +08:00
|
|
|
}
|
|
|
|
|
2019-07-29 23:50:46 +08:00
|
|
|
MOCK_METHOD2(freeGpuAddressRange, void(uint64_t gpuAddress, size_t size));
|
|
|
|
|
2019-03-01 23:14:28 +08:00
|
|
|
static std::array<HeapIndex, static_cast<uint32_t>(HeapIndex::TOTAL_HEAPS)> allHeapNames;
|
|
|
|
};
|