2019-04-04 20:55:51 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2019-09-18 03:26:09 +08:00
|
|
|
#include "core/memory_manager/graphics_allocation.h"
|
2019-04-04 20:55:51 +08:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
struct ImageInfo;
|
|
|
|
struct AllocationProperties {
|
|
|
|
constexpr static uint32_t noDeviceSpecified = std::numeric_limits<uint32_t>::max();
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint32_t allocateMemory : 1;
|
|
|
|
uint32_t flushL3RequiredForRead : 1;
|
|
|
|
uint32_t flushL3RequiredForWrite : 1;
|
|
|
|
uint32_t forcePin : 1;
|
|
|
|
uint32_t uncacheable : 1;
|
|
|
|
uint32_t multiOsContextCapable : 1;
|
2019-08-07 00:01:26 +08:00
|
|
|
uint32_t readOnlyMultiStorage : 1;
|
|
|
|
uint32_t reserved : 25;
|
2019-04-04 20:55:51 +08:00
|
|
|
} flags;
|
|
|
|
uint32_t allFlags = 0;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(AllocationProperties::flags) == sizeof(AllocationProperties::allFlags), "");
|
|
|
|
size_t size = 0;
|
|
|
|
size_t alignment = 0;
|
|
|
|
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
|
|
|
ImageInfo *imgInfo = nullptr;
|
2019-11-07 01:46:42 +08:00
|
|
|
bool multiStorageResource = false;
|
2019-10-22 16:26:23 +08:00
|
|
|
uint32_t subDeviceIndex = AllocationProperties::noDeviceSpecified;
|
|
|
|
uint32_t rootDeviceIndex = AllocationProperties::noDeviceSpecified;
|
2019-04-04 20:55:51 +08:00
|
|
|
|
|
|
|
AllocationProperties(size_t size,
|
|
|
|
GraphicsAllocation::AllocationType allocationType)
|
2019-06-13 16:08:53 +08:00
|
|
|
: AllocationProperties(true, size, allocationType, false) {}
|
2019-04-04 20:55:51 +08:00
|
|
|
|
|
|
|
AllocationProperties(bool allocateMemory,
|
|
|
|
ImageInfo &imgInfo,
|
|
|
|
GraphicsAllocation::AllocationType allocationType)
|
2019-06-13 16:08:53 +08:00
|
|
|
: AllocationProperties(allocateMemory, 0u, allocationType, false) {
|
2019-04-04 20:55:51 +08:00
|
|
|
this->imgInfo = &imgInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
AllocationProperties(bool allocateMemory,
|
|
|
|
size_t size,
|
2019-06-13 16:08:53 +08:00
|
|
|
GraphicsAllocation::AllocationType allocationType,
|
|
|
|
bool isMultiStorageAllocation)
|
2019-11-07 01:46:42 +08:00
|
|
|
: AllocationProperties(allocateMemory, size, allocationType, false, isMultiStorageAllocation, AllocationProperties::noDeviceSpecified, AllocationProperties::noDeviceSpecified) {}
|
2019-04-04 20:55:51 +08:00
|
|
|
|
|
|
|
AllocationProperties(bool allocateMemory,
|
|
|
|
size_t size,
|
|
|
|
GraphicsAllocation::AllocationType allocationType,
|
|
|
|
bool multiOsContextCapable,
|
2019-11-07 01:46:42 +08:00
|
|
|
bool isMultiStorageAllocation,
|
2019-10-22 16:26:23 +08:00
|
|
|
uint32_t subDeviceIndex,
|
|
|
|
uint32_t rootDeviceIndex)
|
2019-11-07 01:46:42 +08:00
|
|
|
: size(size), allocationType(allocationType), multiStorageResource(isMultiStorageAllocation), subDeviceIndex(subDeviceIndex), rootDeviceIndex(rootDeviceIndex) {
|
2019-04-04 20:55:51 +08:00
|
|
|
allFlags = 0;
|
|
|
|
flags.flushL3RequiredForRead = 1;
|
|
|
|
flags.flushL3RequiredForWrite = 1;
|
|
|
|
flags.allocateMemory = allocateMemory;
|
|
|
|
flags.multiOsContextCapable = multiOsContextCapable;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
} // namespace NEO
|