Add device index to AllocationProperties

Change-Id: I3c9f7ea59bf85fbbc948ba23c2b1040f295f586c
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2019-04-01 11:43:38 +02:00
committed by sys_ocldev
parent 52f51866eb
commit b4ed5468a2
2 changed files with 11 additions and 5 deletions

View File

@@ -126,7 +126,7 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS
constexpr static auto allocationType = GraphicsAllocation::AllocationType::COMMAND_BUFFER;
auto allocation = this->getInternalAllocationStorage()->obtainReusableAllocation(allocationSize, allocationType).release();
if (allocation == nullptr) {
const AllocationProperties commandStreamAllocationProperties{true, allocationSize, allocationType, this->isMultiOsContextCapable()};
const AllocationProperties commandStreamAllocationProperties{true, allocationSize, allocationType, this->isMultiOsContextCapable(), this->deviceIndex};
allocation = this->getMemoryManager()->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
}
DEBUG_BREAK_IF(allocation == nullptr);
@@ -297,7 +297,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType,
auto heapMemory = internalAllocationStorage->obtainReusableAllocation(finalHeapSize, allocationType).release();
if (!heapMemory) {
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({finalHeapSize, allocationType});
heapMemory = getMemoryManager()->allocateGraphicsMemoryWithProperties({finalHeapSize, allocationType, this->deviceIndex});
} else {
finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize);
}

View File

@@ -47,6 +47,7 @@ enum AllocationUsage {
};
struct AllocationProperties {
constexpr static uint32_t noDeviceSpecified = std::numeric_limits<uint32_t>::max();
union {
struct {
uint32_t allocateMemory : 1;
@@ -64,13 +65,18 @@ struct AllocationProperties {
size_t alignment = 0;
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
ImageInfo *imgInfo = nullptr;
uint32_t deviceIndex = AllocationProperties::noDeviceSpecified;
AllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType)
: AllocationProperties(true, size, allocationType) {}
AllocationProperties(size_t size, GraphicsAllocation::AllocationType allocationType, uint32_t deviceIndex)
: AllocationProperties(true, size, allocationType, false, deviceIndex) {}
AllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType)
: AllocationProperties(allocateMemory, size, allocationType, false) {}
AllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType, bool multiOsContextCapable)
: size(size), allocationType(allocationType) {
: AllocationProperties(allocateMemory, size, allocationType, false, AllocationProperties::noDeviceSpecified) {}
AllocationProperties(bool allocateMemory, size_t size, GraphicsAllocation::AllocationType allocationType,
bool multiOsContextCapable, uint32_t deviceIndex)
: size(size), allocationType(allocationType), deviceIndex(deviceIndex) {
allFlags = 0;
flags.flushL3RequiredForRead = 1;
flags.flushL3RequiredForWrite = 1;