2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-01-07 16:29:49 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
class MockGraphicsAllocation : public GraphicsAllocation {
|
2018-11-07 16:33:55 +08:00
|
|
|
public:
|
2018-05-14 17:25:18 +08:00
|
|
|
using GraphicsAllocation::GraphicsAllocation;
|
2018-11-07 16:33:55 +08:00
|
|
|
using GraphicsAllocation::objectNotResident;
|
|
|
|
using GraphicsAllocation::objectNotUsed;
|
2018-12-04 22:11:29 +08:00
|
|
|
using GraphicsAllocation::usageInfos;
|
2018-05-14 17:25:18 +08:00
|
|
|
|
2019-02-26 18:37:51 +08:00
|
|
|
MockGraphicsAllocation()
|
|
|
|
: MockGraphicsAllocation(true) {}
|
|
|
|
|
|
|
|
MockGraphicsAllocation(bool multiOsContextCapable)
|
|
|
|
: GraphicsAllocation(AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull, multiOsContextCapable) {}
|
|
|
|
|
|
|
|
MockGraphicsAllocation(void *buffer, size_t sizeIn)
|
|
|
|
: GraphicsAllocation(AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull, false) {}
|
|
|
|
|
|
|
|
MockGraphicsAllocation(void *buffer, uint64_t gpuAddr, size_t sizeIn)
|
|
|
|
: GraphicsAllocation(AllocationType::UNKNOWN, buffer, gpuAddr, 0llu, sizeIn, MemoryPool::MemoryNull, false) {}
|
2018-12-04 22:11:29 +08:00
|
|
|
|
|
|
|
void resetInspectionIds() {
|
|
|
|
for (auto &usageInfo : usageInfos) {
|
|
|
|
usageInfo.inspectionId = 0u;
|
|
|
|
}
|
2018-05-14 17:25:18 +08:00
|
|
|
}
|
2018-12-04 22:11:29 +08:00
|
|
|
|
2018-07-23 17:03:05 +08:00
|
|
|
void overrideMemoryPool(MemoryPool::Type pool) {
|
|
|
|
this->memoryPool = pool;
|
|
|
|
}
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2018-05-14 17:25:18 +08:00
|
|
|
} // namespace OCLRT
|