Files
compute-runtime/shared/source/memory_manager/host_ptr_defines.h
Andrzej Swierczynski e4adb7efbf Change RequirementsStatus from enum to enum class
Related-To: NEO-5167

Change-Id: Iecf6ac74b5f757e90c36ef84a0f65339bf58e3f9
Signed-off-by: Andrzej Swierczynski <andrzej.swierczynski@intel.com>
2020-10-26 12:56:41 +01:00

79 lines
1.7 KiB
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <cinttypes>
#include <cstdlib>
#include <limits>
namespace NEO {
struct OsHandle;
struct ResidencyData;
using OsGraphicsHandle = OsHandle;
constexpr int maxFragmentsCount = 3;
enum class FragmentPosition {
NONE = 0,
LEADING,
MIDDLE,
TRAILING
};
enum OverlapStatus {
FRAGMENT_NOT_OVERLAPING_WITH_ANY_OTHER = 0,
FRAGMENT_WITHIN_STORED_FRAGMENT,
FRAGMENT_WITH_EXACT_SIZE_AS_STORED_FRAGMENT,
FRAGMENT_OVERLAPING_AND_BIGGER_THEN_STORED_FRAGMENT,
FRAGMENT_NOT_CHECKED
};
enum class RequirementsStatus {
SUCCESS = 0,
FATAL
};
struct PartialAllocation {
FragmentPosition fragmentPosition = FragmentPosition::NONE;
const void *allocationPtr = nullptr;
size_t allocationSize = 0u;
};
struct AllocationRequirements {
PartialAllocation allocationFragments[maxFragmentsCount];
uint64_t totalRequiredSize = 0u;
uint32_t requiredFragmentsCount = 0u;
uint32_t rootDeviceIndex = std::numeric_limits<uint32_t>::max();
};
struct FragmentStorage {
const void *fragmentCpuPointer = nullptr;
size_t fragmentSize = 0;
int refCount = 0;
OsHandle *osInternalStorage = nullptr;
ResidencyData *residency = nullptr;
bool driverAllocation = false;
};
struct AllocationStorageData {
OsHandle *osHandleStorage = nullptr;
size_t fragmentSize = 0;
const void *cpuPtr = nullptr;
bool freeTheFragment = false;
ResidencyData *residency = nullptr;
};
struct OsHandleStorage {
AllocationStorageData fragmentStorageData[maxFragmentsCount];
uint32_t fragmentCount = 0;
};
} // namespace NEO