2020-05-26 12:25:27 +02:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2020 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
|
|
|
|
|
2020-11-04 16:50:54 +01:00
|
|
|
#include <mutex>
|
|
|
|
|
|
2020-05-26 12:25:27 +02:00
|
|
|
namespace NEO {
|
|
|
|
|
|
2020-07-10 11:21:53 +02:00
|
|
|
class MultiGraphicsAllocation {
|
2020-05-26 12:25:27 +02:00
|
|
|
public:
|
|
|
|
|
MultiGraphicsAllocation(uint32_t maxRootDeviceIndex);
|
|
|
|
|
|
2020-11-04 16:50:54 +01:00
|
|
|
MultiGraphicsAllocation(const MultiGraphicsAllocation &obj);
|
|
|
|
|
|
2020-05-26 12:25:27 +02:00
|
|
|
GraphicsAllocation *getDefaultGraphicsAllocation() const;
|
|
|
|
|
|
|
|
|
|
void addAllocation(GraphicsAllocation *graphicsAllocation);
|
|
|
|
|
|
2020-06-02 13:38:13 +02:00
|
|
|
void removeAllocation(uint32_t rootDeviceIndex);
|
|
|
|
|
|
2020-05-26 12:25:27 +02:00
|
|
|
GraphicsAllocation *getGraphicsAllocation(uint32_t rootDeviceIndex) const;
|
|
|
|
|
|
|
|
|
|
GraphicsAllocation::AllocationType getAllocationType() const;
|
|
|
|
|
|
|
|
|
|
bool isCoherent() const;
|
|
|
|
|
|
2020-08-04 11:53:49 +02:00
|
|
|
StackVec<GraphicsAllocation *, 1> const &getGraphicsAllocations() const;
|
2020-06-29 12:47:13 +02:00
|
|
|
|
2020-11-04 16:50:54 +01:00
|
|
|
void ensureMemoryOnDevice(MemoryManager &memoryManager, uint32_t requiredRootDeviceIndex);
|
|
|
|
|
|
|
|
|
|
uint32_t getLastUsedRootDeviceIndex() const { return lastUsedRootDeviceIndex; }
|
|
|
|
|
|
2020-05-26 12:25:27 +02:00
|
|
|
protected:
|
2020-08-04 11:53:49 +02:00
|
|
|
StackVec<GraphicsAllocation *, 1> graphicsAllocations;
|
2020-11-04 16:50:54 +01:00
|
|
|
|
|
|
|
|
uint32_t lastUsedRootDeviceIndex = std::numeric_limits<uint32_t>::max();
|
|
|
|
|
uint32_t requiredRootDeviceIndex = std::numeric_limits<uint32_t>::max();
|
|
|
|
|
|
|
|
|
|
std::mutex transferMutex;
|
2020-05-26 12:25:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace NEO
|