2019-04-04 14:55:51 +02:00
|
|
|
/*
|
2019-12-30 14:40:24 +01:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-04-04 14:55:51 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/device/sub_device.h"
|
|
|
|
#include "shared/source/memory_manager/graphics_allocation.h"
|
2019-04-04 14:55:51 +02:00
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
struct ImageInfo;
|
|
|
|
struct AllocationProperties {
|
|
|
|
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-06 18:01:26 +02:00
|
|
|
uint32_t readOnlyMultiStorage : 1;
|
2019-11-14 04:08:59 -05:00
|
|
|
uint32_t shareable : 1;
|
2020-02-10 17:58:02 +01:00
|
|
|
uint32_t resource48Bit : 1;
|
2020-09-03 00:57:05 -07:00
|
|
|
uint32_t isUSMHostAllocation : 1;
|
2020-09-11 15:44:09 +02:00
|
|
|
uint32_t isUSMDeviceAllocation : 1;
|
|
|
|
uint32_t reserved : 21;
|
2019-04-04 14:55:51 +02:00
|
|
|
} flags;
|
|
|
|
uint32_t allFlags = 0;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(AllocationProperties::flags) == sizeof(AllocationProperties::allFlags), "");
|
2020-07-08 18:31:52 -07:00
|
|
|
uint32_t rootDeviceIndex = std::numeric_limits<uint32_t>::max();
|
2019-04-04 14:55:51 +02:00
|
|
|
size_t size = 0;
|
|
|
|
size_t alignment = 0;
|
|
|
|
GraphicsAllocation::AllocationType allocationType = GraphicsAllocation::AllocationType::UNKNOWN;
|
|
|
|
ImageInfo *imgInfo = nullptr;
|
2019-11-06 18:46:42 +01:00
|
|
|
bool multiStorageResource = false;
|
2019-12-10 12:16:07 +01:00
|
|
|
DeviceBitfield subDevicesBitfield{};
|
2020-07-01 10:38:19 +02:00
|
|
|
uint64_t gpuAddress = 0;
|
|
|
|
OsContext *osContext = nullptr;
|
2019-04-04 14:55:51 +02:00
|
|
|
|
2020-06-16 15:46:15 +02:00
|
|
|
AllocationProperties(uint32_t rootDeviceIndex, size_t size,
|
|
|
|
GraphicsAllocation::AllocationType allocationType, DeviceBitfield subDevicesBitfieldParam)
|
|
|
|
: AllocationProperties(rootDeviceIndex, true, size, allocationType, false, subDevicesBitfieldParam) {}
|
2019-04-04 14:55:51 +02:00
|
|
|
|
2019-11-07 14:15:04 +01:00
|
|
|
AllocationProperties(uint32_t rootDeviceIndex, bool allocateMemory,
|
2019-04-04 14:55:51 +02:00
|
|
|
ImageInfo &imgInfo,
|
2020-04-14 17:07:38 +02:00
|
|
|
GraphicsAllocation::AllocationType allocationType,
|
|
|
|
DeviceBitfield subDevicesBitfieldParam)
|
|
|
|
: AllocationProperties(rootDeviceIndex, allocateMemory, 0u, allocationType, false, subDevicesBitfieldParam) {
|
2019-04-04 14:55:51 +02:00
|
|
|
this->imgInfo = &imgInfo;
|
|
|
|
}
|
|
|
|
|
2019-11-07 14:15:04 +01:00
|
|
|
AllocationProperties(uint32_t rootDeviceIndex,
|
|
|
|
bool allocateMemory,
|
2019-04-04 14:55:51 +02:00
|
|
|
size_t size,
|
2019-06-13 10:08:53 +02:00
|
|
|
GraphicsAllocation::AllocationType allocationType,
|
2020-04-14 17:07:38 +02:00
|
|
|
bool isMultiStorageAllocation,
|
|
|
|
DeviceBitfield subDevicesBitfieldParam)
|
|
|
|
: AllocationProperties(rootDeviceIndex, allocateMemory, size, allocationType, false, isMultiStorageAllocation, subDevicesBitfieldParam) {}
|
2019-04-04 14:55:51 +02:00
|
|
|
|
2019-11-07 14:15:04 +01:00
|
|
|
AllocationProperties(uint32_t rootDeviceIndexParam,
|
|
|
|
bool allocateMemoryParam,
|
|
|
|
size_t sizeParam,
|
|
|
|
GraphicsAllocation::AllocationType allocationTypeParam,
|
|
|
|
bool multiOsContextCapableParam,
|
|
|
|
bool isMultiStorageAllocationParam,
|
2019-12-10 12:16:07 +01:00
|
|
|
DeviceBitfield subDevicesBitfieldParam)
|
|
|
|
: rootDeviceIndex(rootDeviceIndexParam),
|
|
|
|
size(sizeParam),
|
|
|
|
allocationType(allocationTypeParam),
|
|
|
|
multiStorageResource(isMultiStorageAllocationParam),
|
|
|
|
subDevicesBitfield(subDevicesBitfieldParam) {
|
2019-04-04 14:55:51 +02:00
|
|
|
allFlags = 0;
|
|
|
|
flags.flushL3RequiredForRead = 1;
|
|
|
|
flags.flushL3RequiredForWrite = 1;
|
2019-11-07 14:15:04 +01:00
|
|
|
flags.allocateMemory = allocateMemoryParam;
|
|
|
|
flags.multiOsContextCapable = multiOsContextCapableParam;
|
2019-04-04 14:55:51 +02:00
|
|
|
}
|
|
|
|
};
|
2020-06-02 13:38:02 +02:00
|
|
|
|
|
|
|
struct AllocationData {
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
uint32_t allocateMemory : 1;
|
|
|
|
uint32_t allow64kbPages : 1;
|
|
|
|
uint32_t allow32Bit : 1;
|
|
|
|
uint32_t useSystemMemory : 1;
|
|
|
|
uint32_t forcePin : 1;
|
|
|
|
uint32_t uncacheable : 1;
|
|
|
|
uint32_t flushL3 : 1;
|
|
|
|
uint32_t preferRenderCompressed : 1;
|
|
|
|
uint32_t multiOsContextCapable : 1;
|
|
|
|
uint32_t requiresCpuAccess : 1;
|
|
|
|
uint32_t shareable : 1;
|
|
|
|
uint32_t resource48Bit : 1;
|
2020-09-03 00:57:05 -07:00
|
|
|
uint32_t isUSMHostAllocation : 1;
|
|
|
|
uint32_t reserved : 19;
|
2020-06-02 13:38:02 +02:00
|
|
|
} flags;
|
|
|
|
uint32_t allFlags = 0;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(AllocationData::flags) == sizeof(AllocationData::allFlags), "");
|
|
|
|
GraphicsAllocation::AllocationType type = GraphicsAllocation::AllocationType::UNKNOWN;
|
|
|
|
const void *hostPtr = nullptr;
|
2020-07-01 10:38:19 +02:00
|
|
|
uint64_t gpuAddress = 0;
|
2020-06-02 13:38:02 +02:00
|
|
|
size_t size = 0;
|
|
|
|
size_t alignment = 0;
|
|
|
|
StorageInfo storageInfo = {};
|
|
|
|
ImageInfo *imgInfo = nullptr;
|
|
|
|
uint32_t rootDeviceIndex = 0;
|
2020-07-01 10:38:19 +02:00
|
|
|
OsContext *osContext = nullptr;
|
2020-06-02 13:38:02 +02:00
|
|
|
};
|
2019-04-04 14:55:51 +02:00
|
|
|
} // namespace NEO
|