mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-29 17:13:29 +08:00
leave parameterless method in Buffer and Image classes add method to remove graphics allocation from MultiGraphicsAllocation Related-To: NEO-4672 Change-Id: I3020eecfabe9a16af7f36d68a74b32d3f4fc2276 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
/*
|
|
* Copyright (C) 2020 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/memory_manager/multi_graphics_allocation.h"
|
|
|
|
namespace NEO {
|
|
|
|
MultiGraphicsAllocation::MultiGraphicsAllocation(uint32_t maxRootDeviceIndex) {
|
|
graphicsAllocations.resize(maxRootDeviceIndex + 1);
|
|
}
|
|
|
|
GraphicsAllocation *MultiGraphicsAllocation::getDefaultGraphicsAllocation() const {
|
|
for (auto &allocation : graphicsAllocations) {
|
|
if (allocation) {
|
|
return allocation;
|
|
}
|
|
}
|
|
return nullptr;
|
|
}
|
|
|
|
void MultiGraphicsAllocation::addAllocation(GraphicsAllocation *graphicsAllocation) {
|
|
UNRECOVERABLE_IF(graphicsAllocation == nullptr);
|
|
UNRECOVERABLE_IF(graphicsAllocations.size() < graphicsAllocation->getRootDeviceIndex() + 1);
|
|
graphicsAllocations[graphicsAllocation->getRootDeviceIndex()] = graphicsAllocation;
|
|
}
|
|
|
|
void MultiGraphicsAllocation::removeAllocation(uint32_t rootDeviceIndex) {
|
|
graphicsAllocations[rootDeviceIndex] = nullptr;
|
|
}
|
|
|
|
GraphicsAllocation *MultiGraphicsAllocation::getGraphicsAllocation(uint32_t rootDeviceIndex) const {
|
|
return graphicsAllocations[rootDeviceIndex];
|
|
}
|
|
|
|
GraphicsAllocation::AllocationType MultiGraphicsAllocation::getAllocationType() const {
|
|
return getDefaultGraphicsAllocation()->getAllocationType();
|
|
}
|
|
|
|
bool MultiGraphicsAllocation::isCoherent() const {
|
|
return getDefaultGraphicsAllocation()->isCoherent();
|
|
}
|
|
|
|
} // namespace NEO
|