mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
Pass MultiGraphicsAllocation in Buffer instead of GraphicsAllocation Related-To: NEO-4672 Change-Id: I7fb05ab53f54875f41d90f480e7f930b3b9f2fda Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
58 lines
1.8 KiB
C++
58 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
|
#include "shared/source/memory_manager/multi_graphics_allocation.h"
|
|
|
|
#include "opencl/source/memory_manager/os_agnostic_memory_manager.h"
|
|
|
|
namespace NEO {
|
|
|
|
constexpr uint32_t mockRootDeviceIndex = 0u;
|
|
constexpr DeviceBitfield mockDeviceBitfield(0b1);
|
|
|
|
class MockGraphicsAllocation : public MemoryAllocation {
|
|
public:
|
|
using MemoryAllocation::aubInfo;
|
|
using MemoryAllocation::MemoryAllocation;
|
|
using MemoryAllocation::objectNotResident;
|
|
using MemoryAllocation::objectNotUsed;
|
|
using MemoryAllocation::usageInfos;
|
|
|
|
MockGraphicsAllocation()
|
|
: MemoryAllocation(0, AllocationType::UNKNOWN, nullptr, 0u, 0, MemoryPool::MemoryNull) {}
|
|
|
|
MockGraphicsAllocation(void *buffer, size_t sizeIn)
|
|
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, castToUint64(buffer), 0llu, sizeIn, MemoryPool::MemoryNull) {}
|
|
|
|
MockGraphicsAllocation(void *buffer, uint64_t gpuAddr, size_t sizeIn)
|
|
: MemoryAllocation(0, AllocationType::UNKNOWN, buffer, gpuAddr, 0llu, sizeIn, MemoryPool::MemoryNull) {}
|
|
|
|
void resetInspectionIds() {
|
|
for (auto &usageInfo : usageInfos) {
|
|
usageInfo.inspectionId = 0u;
|
|
}
|
|
}
|
|
|
|
void overrideMemoryPool(MemoryPool::Type pool) {
|
|
this->memoryPool = pool;
|
|
}
|
|
};
|
|
|
|
namespace GraphicsAllocationHelper {
|
|
|
|
static inline MultiGraphicsAllocation toMultiGraphicsAllocation(GraphicsAllocation *graphicsAllocation) {
|
|
MultiGraphicsAllocation multiGraphicsAllocation(graphicsAllocation->getRootDeviceIndex());
|
|
multiGraphicsAllocation.addAllocation(graphicsAllocation);
|
|
return multiGraphicsAllocation;
|
|
}
|
|
|
|
} // namespace GraphicsAllocationHelper
|
|
|
|
} // namespace NEO
|