2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2022-02-01 23:48:44 +08:00
|
|
|
* Copyright (C) 2020-2022 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-03-27 22:21:18 +08:00
|
|
|
#include "shared/source/helpers/common_types.h"
|
2021-12-07 21:50:28 +08:00
|
|
|
#include "shared/source/helpers/definitions/engine_group_types.h"
|
2021-08-17 20:50:38 +08:00
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include <cstdint>
|
2018-09-29 05:36:11 +08:00
|
|
|
#include <limits>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr bool is32bit = (sizeof(void *) == 4);
|
|
|
|
inline constexpr bool is64bit = (sizeof(void *) == 8);
|
2018-09-27 21:08:57 +08:00
|
|
|
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr NEO::DeviceBitfield systemMemoryBitfield(0b0);
|
2020-07-08 18:09:05 +08:00
|
|
|
|
2019-11-28 01:00:52 +08:00
|
|
|
constexpr uint64_t maxNBitValue(uint64_t n) {
|
2022-02-01 23:48:44 +08:00
|
|
|
return ((n == 64) ? std::numeric_limits<uint64_t>::max()
|
|
|
|
: ((1ULL << n) - 1));
|
2019-11-28 01:00:52 +08:00
|
|
|
}
|
|
|
|
static_assert(maxNBitValue(8) == std::numeric_limits<uint8_t>::max(), "");
|
|
|
|
static_assert(maxNBitValue(16) == std::numeric_limits<uint16_t>::max(), "");
|
|
|
|
static_assert(maxNBitValue(32) == std::numeric_limits<uint32_t>::max(), "");
|
2022-02-01 23:48:44 +08:00
|
|
|
static_assert(maxNBitValue(64) == std::numeric_limits<uint64_t>::max(), "");
|
2019-01-29 01:12:39 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
namespace MemoryConstants {
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr uint64_t zoneHigh = ~(uint64_t)0xFFFFFFFF;
|
|
|
|
inline constexpr uint64_t kiloByte = 1024;
|
|
|
|
inline constexpr uint64_t kiloByteShiftSize = 10;
|
|
|
|
inline constexpr uint64_t megaByte = 1024 * kiloByte;
|
|
|
|
inline constexpr uint64_t gigaByte = 1024 * megaByte;
|
|
|
|
inline constexpr size_t minBufferAlignment = 4;
|
|
|
|
inline constexpr size_t cacheLineSize = 64;
|
|
|
|
inline constexpr size_t pageSize = 4 * kiloByte;
|
|
|
|
inline constexpr size_t pageSize64k = 64 * kiloByte;
|
|
|
|
inline constexpr size_t pageSize2Mb = 2 * megaByte;
|
|
|
|
inline constexpr size_t preferredAlignment = pageSize; // alignment preferred for performance reasons, i.e. internal allocations
|
|
|
|
inline constexpr size_t allocationAlignment = pageSize; // alignment required to gratify incoming pointer, i.e. passed host_ptr
|
|
|
|
inline constexpr size_t slmWindowAlignment = 128 * kiloByte;
|
|
|
|
inline constexpr size_t slmWindowSize = 64 * kiloByte;
|
|
|
|
inline constexpr uintptr_t pageMask = (pageSize - 1);
|
|
|
|
inline constexpr uintptr_t page64kMask = (pageSize64k - 1);
|
|
|
|
inline constexpr uint64_t max32BitAppAddress = maxNBitValue(31);
|
|
|
|
inline constexpr uint64_t max64BitAppAddress = maxNBitValue(47);
|
|
|
|
inline constexpr uint32_t sizeOf4GBinPageEntities = (MemoryConstants::gigaByte * 4 - MemoryConstants::pageSize) / MemoryConstants::pageSize;
|
|
|
|
inline constexpr uint64_t max32BitAddress = maxNBitValue(32);
|
|
|
|
inline constexpr uint64_t max36BitAddress = (maxNBitValue(36));
|
|
|
|
inline constexpr uint64_t max48BitAddress = maxNBitValue(48);
|
|
|
|
inline constexpr uintptr_t page4kEntryMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::pageMask;
|
|
|
|
inline constexpr uintptr_t page64kEntryMask = std::numeric_limits<uintptr_t>::max() & ~MemoryConstants::page64kMask;
|
|
|
|
inline constexpr int GfxAddressBits = is64bit ? 48 : 32;
|
|
|
|
inline constexpr uint64_t maxSvmAddress = is64bit ? maxNBitValue(47) : maxNBitValue(32);
|
2019-04-03 21:59:31 +08:00
|
|
|
|
2018-06-13 03:54:39 +08:00
|
|
|
} // namespace MemoryConstants
|
2019-04-03 21:59:31 +08:00
|
|
|
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr uint64_t KB = MemoryConstants::kiloByte;
|
|
|
|
inline constexpr uint64_t MB = MemoryConstants::megaByte;
|
|
|
|
inline constexpr uint64_t GB = MemoryConstants::gigaByte;
|
2020-04-28 21:23:04 +08:00
|
|
|
|
2019-04-03 21:59:31 +08:00
|
|
|
namespace BlitterConstants {
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr uint64_t maxBlitWidth = 0x4000;
|
|
|
|
inline constexpr uint64_t maxBlitHeight = 0x4000;
|
|
|
|
inline constexpr uint64_t maxBlitSetWidth = 0x1FF80; // 0x20000 aligned to 128
|
|
|
|
inline constexpr uint64_t maxBlitSetHeight = 0x1FFC0; // 0x20000 aligned to cacheline size
|
2020-07-02 22:07:22 +08:00
|
|
|
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr uint64_t maxBytesPerPixel = 0x10;
|
2020-01-24 19:50:59 +08:00
|
|
|
enum class BlitDirection : uint32_t {
|
2019-07-01 17:08:58 +08:00
|
|
|
BufferToHostPtr,
|
|
|
|
HostPtrToBuffer,
|
2020-10-20 21:27:49 +08:00
|
|
|
BufferToBuffer,
|
|
|
|
HostPtrToImage,
|
2021-07-26 08:49:41 +08:00
|
|
|
ImageToHostPtr,
|
|
|
|
ImageToImage
|
2019-05-16 23:48:29 +08:00
|
|
|
};
|
2020-11-17 01:12:08 +08:00
|
|
|
|
|
|
|
enum PostBlitMode : int32_t {
|
|
|
|
Default = -1,
|
|
|
|
MiArbCheck = 0,
|
|
|
|
MiFlush = 1,
|
|
|
|
None = 2
|
|
|
|
};
|
2019-04-03 21:59:31 +08:00
|
|
|
} // namespace BlitterConstants
|
2020-03-27 22:21:18 +08:00
|
|
|
|
|
|
|
namespace CommonConstants {
|
2022-12-06 20:15:26 +08:00
|
|
|
inline constexpr uint64_t unsupportedPatIndex = std::numeric_limits<uint64_t>::max();
|
|
|
|
inline constexpr uint32_t unspecifiedDeviceIndex = std::numeric_limits<uint32_t>::max();
|
|
|
|
inline constexpr uint32_t invalidStepping = std::numeric_limits<uint32_t>::max();
|
|
|
|
inline constexpr uint32_t invalidRevisionID = std::numeric_limits<uint16_t>::max();
|
|
|
|
inline constexpr uint32_t maximalSimdSize = 32;
|
|
|
|
inline constexpr uint32_t maximalSizeOfAtomicType = 8;
|
|
|
|
inline constexpr uint32_t engineGroupCount = static_cast<uint32_t>(NEO::EngineGroupType::MaxEngineGroups);
|
2020-03-27 22:21:18 +08:00
|
|
|
} // namespace CommonConstants
|