Rename AllocationType to FragmentPosition

- better reflects enums usage
- make the type scoped enum

Change-Id: Id2712e43028258ffc038a5738ec9e546d19d9e2e
This commit is contained in:
Hoppe, Mateusz
2018-07-12 10:53:18 +02:00
committed by sys_ocldev
parent 0a1c4a5e41
commit c34ed02f57
4 changed files with 36 additions and 36 deletions

View File

@ -31,7 +31,7 @@ typedef OsHandle OsGraphicsHandle;
const int max_fragments_count = 3;
enum AllocationType {
enum class FragmentPosition {
NONE = 0,
LEADING,
MIDDLE,
@ -59,7 +59,7 @@ struct ResidencyData {
};
struct PartialAllocation {
int allocationType = NONE;
FragmentPosition fragmentPosition = FragmentPosition::NONE;
const void *allocationPtr = nullptr;
size_t allocationSize = 0u;
};

View File

@ -70,7 +70,7 @@ AllocationRequirements OCLRT::HostPtrManager::getAllocationRequirements(const vo
if (alignedStartAddress != inputPtr) {
leadingNeeded = true;
requiredAllocations.AllocationFragments[allocationCount].allocationPtr = alignedStartAddress;
requiredAllocations.AllocationFragments[allocationCount].allocationType = LEADING;
requiredAllocations.AllocationFragments[allocationCount].fragmentPosition = FragmentPosition::LEADING;
requiredAllocations.AllocationFragments[allocationCount].allocationSize = MemoryConstants::pageSize;
allocationCount++;
}
@ -86,14 +86,14 @@ AllocationRequirements OCLRT::HostPtrManager::getAllocationRequirements(const vo
auto middleSize = wholeAllocationSize - (trailingNeeded + leadingNeeded) * MemoryConstants::pageSize;
if (middleSize) {
requiredAllocations.AllocationFragments[allocationCount].allocationPtr = alignUp(inputPtr, MemoryConstants::pageSize);
requiredAllocations.AllocationFragments[allocationCount].allocationType = MIDDLE;
requiredAllocations.AllocationFragments[allocationCount].fragmentPosition = FragmentPosition::MIDDLE;
requiredAllocations.AllocationFragments[allocationCount].allocationSize = middleSize;
allocationCount++;
}
if (trailingNeeded) {
requiredAllocations.AllocationFragments[allocationCount].allocationPtr = alignedEndAddress;
requiredAllocations.AllocationFragments[allocationCount].allocationType = TRAILING;
requiredAllocations.AllocationFragments[allocationCount].fragmentPosition = FragmentPosition::TRAILING;
requiredAllocations.AllocationFragments[allocationCount].allocationSize = MemoryConstants::pageSize;
allocationCount++;
}