diff --git a/runtime/command_queue/command_queue.cpp b/runtime/command_queue/command_queue.cpp index 9a93ec2904..0eeb236764 100644 --- a/runtime/command_queue/command_queue.cpp +++ b/runtime/command_queue/command_queue.cpp @@ -234,7 +234,7 @@ LinearStream &CommandQueue::getCS(size_t minRequiredSize) { allocation = memoryManager->allocateGraphicsMemory(requiredSize, MemoryConstants::pageSize); } - allocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); // Deallocate the old block, if not null auto oldAllocation = commandStream->getGraphicsAllocation(); diff --git a/runtime/command_queue/enqueue_fill_buffer.h b/runtime/command_queue/enqueue_fill_buffer.h index c314bc7a87..7f6124eda3 100644 --- a/runtime/command_queue/enqueue_fill_buffer.h +++ b/runtime/command_queue/enqueue_fill_buffer.h @@ -47,7 +47,7 @@ cl_int CommandQueueHw::enqueueFillBuffer( DEBUG_BREAK_IF(nullptr == memoryManager); auto patternAllocation = memoryManager->allocateGraphicsMemory(alignUp(patternSize, MemoryConstants::cacheLineSize), MemoryConstants::preferredAlignment); - patternAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN); + patternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN); if (patternSize == 1) { int patternInt = (uint32_t)((*(uint8_t *)pattern << 24) | (*(uint8_t *)pattern << 16) | (*(uint8_t *)pattern << 8) | *(uint8_t *)pattern); diff --git a/runtime/command_queue/enqueue_svm.h b/runtime/command_queue/enqueue_svm.h index 1413262b61..d756e22605 100644 --- a/runtime/command_queue/enqueue_svm.h +++ b/runtime/command_queue/enqueue_svm.h @@ -247,7 +247,7 @@ cl_int CommandQueueHw::enqueueSVMMemFill(void *svmPtr, patternAllocation = memoryManager->allocateGraphicsMemory(patternSize, MemoryConstants::preferredAlignment); } - patternAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN); + patternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN); if (patternSize == 1) { int patternInt = (uint32_t)((*(uint8_t *)pattern << 24) | (*(uint8_t *)pattern << 16) | (*(uint8_t *)pattern << 8) | *(uint8_t *)pattern); diff --git a/runtime/command_stream/aub_command_stream_receiver_hw.inl b/runtime/command_stream/aub_command_stream_receiver_hw.inl index 2ef3a9671b..6c1b60f43a 100644 --- a/runtime/command_stream/aub_command_stream_receiver_hw.inl +++ b/runtime/command_stream/aub_command_stream_receiver_hw.inl @@ -531,8 +531,8 @@ bool AUBCommandStreamReceiverHw::writeMemory(GraphicsAllocation &gfxA gfxAllocation.setLocked(false); } - if (!!(allocType & GraphicsAllocation::ALLOCATION_TYPE_BUFFER) || - !!(allocType & GraphicsAllocation::ALLOCATION_TYPE_IMAGE)) + if (!!(allocType & GraphicsAllocation::AllocationType::BUFFER) || + !!(allocType & GraphicsAllocation::AllocationType::IMAGE)) gfxAllocation.setTypeAubNonWritable(); return true; diff --git a/runtime/command_stream/command_stream_receiver.cpp b/runtime/command_stream/command_stream_receiver.cpp index 6fc4c0f6df..fb239bf199 100644 --- a/runtime/command_stream/command_stream_receiver.cpp +++ b/runtime/command_stream/command_stream_receiver.cpp @@ -166,7 +166,7 @@ LinearStream &CommandStreamReceiver::getCS(size_t minRequiredSize) { allocation = memoryManager->allocateGraphicsMemory(requiredSize, MemoryConstants::pageSize); } - allocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + allocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); //pass current allocation to reusable list if (commandStream.getCpuBase()) { @@ -309,7 +309,7 @@ void CommandStreamReceiver::allocateHeapMemory(IndirectHeap::Type heapType, finalHeapSize = std::max(heapMemory->getUnderlyingBufferSize(), finalHeapSize); } - heapMemory->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + heapMemory->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); if (IndirectHeap::SURFACE_STATE == heapType) { DEBUG_BREAK_IF(minRequiredSize > maxSshSize); diff --git a/runtime/helpers/flat_batch_buffer_helper_hw.inl b/runtime/helpers/flat_batch_buffer_helper_hw.inl index 8268c6e3da..96a17ddbbb 100644 --- a/runtime/helpers/flat_batch_buffer_helper_hw.inl +++ b/runtime/helpers/flat_batch_buffer_helper_hw.inl @@ -41,7 +41,7 @@ void *FlatBatchBufferHelperHw::flattenBatchBuffer(BatchBuffer &batchB if (dispatchMode == DispatchMode::ImmediateDispatch) { if (batchBuffer.chainedBatchBuffer) { - batchBuffer.chainedBatchBuffer->setAllocationType(batchBuffer.chainedBatchBuffer->getAllocationType() | GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE); + batchBuffer.chainedBatchBuffer->setAllocationType(batchBuffer.chainedBatchBuffer->getAllocationType() | GraphicsAllocation::AllocationType::NON_AUB_WRITABLE); auto sizeMainBatchBuffer = batchBuffer.chainedBatchBufferStartOffset - batchBuffer.startOffset; auto flatBatchBufferSize = alignUp(sizeMainBatchBuffer + indirectPatchCommandsSize + batchBuffer.chainedBatchBuffer->getUnderlyingBufferSize(), MemoryConstants::pageSize); diff --git a/runtime/mem_obj/buffer.cpp b/runtime/mem_obj/buffer.cpp index c112eff31a..630f70b44e 100644 --- a/runtime/mem_obj/buffer.cpp +++ b/runtime/mem_obj/buffer.cpp @@ -149,8 +149,8 @@ Buffer *Buffer::create(Context *context, } auto allocationType = (flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)) - ? GraphicsAllocation::ALLOCATION_TYPE_BUFFER - : GraphicsAllocation::ALLOCATION_TYPE_BUFFER | GraphicsAllocation::ALLOCATION_TYPE_WRITABLE; + ? GraphicsAllocation::AllocationType::BUFFER + : GraphicsAllocation::AllocationType::BUFFER | GraphicsAllocation::AllocationType::WRITABLE; memory->setAllocationType(allocationType); DBG_LOG(LogMemoryObject, __FUNCTION__, "hostPtr:", hostPtr, "size:", size, "memoryStorage:", memory->getUnderlyingBuffer(), "GPU address:", std::hex, memory->getGpuAddress()); diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index dfe3eb824d..51bd392b29 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -289,8 +289,8 @@ Image *Image::create(Context *context, } auto allocationType = (flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)) - ? GraphicsAllocation::ALLOCATION_TYPE_IMAGE - : GraphicsAllocation::ALLOCATION_TYPE_IMAGE | GraphicsAllocation::ALLOCATION_TYPE_WRITABLE; + ? GraphicsAllocation::AllocationType::IMAGE + : GraphicsAllocation::AllocationType::IMAGE | GraphicsAllocation::AllocationType::WRITABLE; memory->setAllocationType(allocationType); DBG_LOG(LogMemoryObject, __FUNCTION__, "hostPtr:", hostPtr, "size:", memory->getUnderlyingBufferSize(), "memoryStorage:", memory->getUnderlyingBuffer(), "GPU address:", std::hex, memory->getGpuAddress()); diff --git a/runtime/memory_manager/graphics_allocation.h b/runtime/memory_manager/graphics_allocation.h index fb73663d84..e3311f9e61 100644 --- a/runtime/memory_manager/graphics_allocation.h +++ b/runtime/memory_manager/graphics_allocation.h @@ -55,14 +55,14 @@ class GraphicsAllocation : public IDNode { public: enum AllocationType { - ALLOCATION_TYPE_UNKNOWN = 0, - ALLOCATION_TYPE_BUFFER, - ALLOCATION_TYPE_IMAGE, - ALLOCATION_TYPE_TAG_BUFFER, - ALLOCATION_TYPE_LINEAR_STREAM, - ALLOCATION_TYPE_FILL_PATTERN, - ALLOCATION_TYPE_NON_AUB_WRITABLE = 0x40000000, - ALLOCATION_TYPE_WRITABLE = 0x80000000 + UNKNOWN = 0, + BUFFER, + IMAGE, + TAG_BUFFER, + LINEAR_STREAM, + FILL_PATTERN, + NON_AUB_WRITABLE = 0x40000000, + WRITABLE = 0x80000000 }; virtual ~GraphicsAllocation() = default; @@ -73,21 +73,21 @@ class GraphicsAllocation : public IDNode { gpuAddress(castToUint64(cpuPtrIn)), sharedHandle(Sharing::nonSharedResource), - allocationType(ALLOCATION_TYPE_UNKNOWN) {} + allocationType(AllocationType::UNKNOWN) {} GraphicsAllocation(void *cpuPtrIn, uint64_t gpuAddress, uint64_t baseAddress, size_t sizeIn) : size(sizeIn), cpuPtr(cpuPtrIn), gpuAddress(gpuAddress), sharedHandle(Sharing::nonSharedResource), gpuBaseAddress(baseAddress), - allocationType(ALLOCATION_TYPE_UNKNOWN) {} + allocationType(AllocationType::UNKNOWN) {} GraphicsAllocation(void *cpuPtrIn, size_t sizeIn, osHandle sharedHandleIn) : size(sizeIn), cpuPtr(cpuPtrIn), gpuAddress(castToUint64(cpuPtrIn)), sharedHandle(sharedHandleIn), - allocationType(ALLOCATION_TYPE_UNKNOWN) {} + allocationType(AllocationType::UNKNOWN) {} void *getUnderlyingBuffer() const { return cpuPtr; } void setCpuPtrAndGpuAddress(void *cpuPtr, uint64_t gpuAddress) { @@ -114,9 +114,9 @@ class GraphicsAllocation : public IDNode { void setAllocationType(uint32_t allocationType) { this->allocationType = allocationType; } uint32_t getAllocationType() const { return allocationType; } - void setTypeAubNonWritable() { this->allocationType |= GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE; } - void clearTypeAubNonWritable() { this->allocationType &= ~GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE; } - bool isTypeAubNonWritable() const { return !!(this->allocationType & GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE); } + void setTypeAubNonWritable() { this->allocationType |= GraphicsAllocation::AllocationType::NON_AUB_WRITABLE; } + void clearTypeAubNonWritable() { this->allocationType &= ~GraphicsAllocation::AllocationType::NON_AUB_WRITABLE; } + bool isTypeAubNonWritable() const { return !!(this->allocationType & GraphicsAllocation::AllocationType::NON_AUB_WRITABLE); } uint32_t taskCount = ObjectNotUsed; OsHandleStorage fragmentsStorage; diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index c439032db7..1d972ec36a 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -178,12 +178,12 @@ void MemoryManager::freeSystemMemory(void *ptr) { ::alignedFree(ptr); } -void MemoryManager::storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationType) { +void MemoryManager::storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationUsage) { std::lock_guard lock(mtx); uint32_t taskCount = gfxAllocation->taskCount; - if (allocationType == REUSABLE_ALLOCATION) { + if (allocationUsage == REUSABLE_ALLOCATION) { if (csr) { taskCount = csr->peekTaskCount(); } else { @@ -191,20 +191,20 @@ void MemoryManager::storeAllocation(std::unique_ptr gfxAlloc } } - storeAllocation(std::move(gfxAllocation), allocationType, taskCount); + storeAllocation(std::move(gfxAllocation), allocationUsage, taskCount); } -void MemoryManager::storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationType, uint32_t taskCount) { +void MemoryManager::storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationUsage, uint32_t taskCount) { std::lock_guard lock(mtx); if (DebugManager.flags.DisableResourceRecycling.get()) { - if (allocationType == REUSABLE_ALLOCATION) { + if (allocationUsage == REUSABLE_ALLOCATION) { freeGraphicsMemory(gfxAllocation.release()); return; } } - auto &allocationsList = (allocationType == TEMPORARY_ALLOCATION) ? graphicsAllocations : allocationsForReuse; + auto &allocationsList = (allocationUsage == TEMPORARY_ALLOCATION) ? graphicsAllocations : allocationsForReuse; gfxAllocation->taskCount = taskCount; allocationsList.pushTailOne(*gfxAllocation.release()); } @@ -236,9 +236,9 @@ void MemoryManager::applyCommonCleanup() { cleanAllocationList(-1, REUSABLE_ALLOCATION); } -bool MemoryManager::cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationType) { +bool MemoryManager::cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage) { std::lock_guard lock(mtx); - freeAllocationsList(waitTaskCount, (allocationType == TEMPORARY_ALLOCATION) ? graphicsAllocations : allocationsForReuse); + freeAllocationsList(waitTaskCount, (allocationUsage == TEMPORARY_ALLOCATION) ? graphicsAllocations : allocationsForReuse); return false; } diff --git a/runtime/memory_manager/memory_manager.h b/runtime/memory_manager/memory_manager.h index 7aba1fc266..189252183a 100644 --- a/runtime/memory_manager/memory_manager.h +++ b/runtime/memory_manager/memory_manager.h @@ -50,7 +50,7 @@ class AllocsTracker; class MapBaseAllocationTracker; class SVMAllocsManager; -enum allocationType { +enum AllocationUsage { TEMPORARY_ALLOCATION, REUSABLE_ALLOCATION }; @@ -148,12 +148,12 @@ class MemoryManager { virtual uint64_t getInternalHeapBaseAddress() = 0; - virtual bool cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationType); + virtual bool cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage); void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList); - void storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationType); - void storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationType, uint32_t taskCount); + void storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationUsage); + void storeAllocation(std::unique_ptr gfxAllocation, uint32_t allocationUsage, uint32_t taskCount); RequirementsStatus checkAllocationsForOverlapping(AllocationRequirements *requirements, CheckedFragments *checkedFragments); diff --git a/runtime/os_interface/linux/drm_memory_manager.cpp b/runtime/os_interface/linux/drm_memory_manager.cpp index cfb8587ab3..9243c9dee7 100644 --- a/runtime/os_interface/linux/drm_memory_manager.cpp +++ b/runtime/os_interface/linux/drm_memory_manager.cpp @@ -250,7 +250,7 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImage(ImageInfo & DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemory(size_t size, void *ptr, AllocationOrigin allocationOrigin) { auto allocatorToUse = allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION ? allocator32Bit.get() : internal32bitAllocator.get(); - auto allocationType = allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION ? BIT32_ALLOCATOR_EXTERNAL : BIT32_ALLOCATOR_INTERNAL; + auto allocatorType = allocationOrigin == AllocationOrigin::EXTERNAL_ALLOCATION ? BIT32_ALLOCATOR_EXTERNAL : BIT32_ALLOCATOR_INTERNAL; if (ptr) { uintptr_t inputPtr = (uintptr_t)ptr; @@ -274,7 +274,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemory(size_t size, void * bo->address = reinterpret_cast(gpuVirtualAddress); uintptr_t offset = (uintptr_t)bo->address; bo->softPin((uint64_t)offset); - bo->setAllocationType(allocationType); + bo->setAllocationType(allocatorType); auto drmAllocation = new DrmAllocation(bo, (void *)ptr, (uint64_t)ptrOffset(gpuVirtualAddress, inputPointerOffset), allocationSize); drmAllocation->is32BitAllocation = true; drmAllocation->gpuBaseAddress = allocatorToUse->getBase(); @@ -305,7 +305,7 @@ DrmAllocation *DrmMemoryManager::allocate32BitGraphicsMemory(size_t size, void * bo->isAllocated = true; bo->setUnmapSize(allocationSize); - bo->setAllocationType(allocationType); + bo->setAllocationType(allocatorType); auto drmAllocation = new DrmAllocation(bo, reinterpret_cast(res), alignedAllocationSize); drmAllocation->is32BitAllocation = true; diff --git a/runtime/os_interface/windows/wddm_device_command_stream.inl b/runtime/os_interface/windows/wddm_device_command_stream.inl index 1ca52f9241..08f07ad9a7 100644 --- a/runtime/os_interface/windows/wddm_device_command_stream.inl +++ b/runtime/os_interface/windows/wddm_device_command_stream.inl @@ -220,8 +220,8 @@ void WddmCommandStreamReceiver::kmDafLockAllocations(ResidencyContain for (uint32_t i = 0; i < residencyAllocations.size(); i++) { auto graphicsAllocation = residencyAllocations[i]; - if ((GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM == graphicsAllocation->getAllocationType()) || - (GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN == graphicsAllocation->getAllocationType())) { + if ((GraphicsAllocation::AllocationType::LINEAR_STREAM == graphicsAllocation->getAllocationType()) || + (GraphicsAllocation::AllocationType::FILL_PATTERN == graphicsAllocation->getAllocationType())) { wddm->kmDafLock(static_cast(graphicsAllocation)); } } diff --git a/unit_tests/command_queue/command_queue_tests.cpp b/unit_tests/command_queue/command_queue_tests.cpp index 92eccc9fb5..3ea1382412 100644 --- a/unit_tests/command_queue/command_queue_tests.cpp +++ b/unit_tests/command_queue/command_queue_tests.cpp @@ -394,7 +394,7 @@ TEST_F(CommandQueueCommandStreamTest, givenCommandQueueWhenGetCSIsCalledThenComm auto commandStreamAllocation = commandStream.getGraphicsAllocation(); ASSERT_NE(nullptr, commandStreamAllocation); - EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM, commandStreamAllocation->getAllocationType()); + EXPECT_EQ(GraphicsAllocation::AllocationType::LINEAR_STREAM, commandStreamAllocation->getAllocationType()); } struct CommandQueueIndirectHeapTest : public CommandQueueMemoryDevice, @@ -638,7 +638,7 @@ TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetIndirectHeapIsCalle auto indirectHeapAllocation = indirectHeap.getGraphicsAllocation(); ASSERT_NE(nullptr, indirectHeapAllocation); - EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM, indirectHeapAllocation->getAllocationType()); + EXPECT_EQ(GraphicsAllocation::AllocationType::LINEAR_STREAM, indirectHeapAllocation->getAllocationType()); } TEST_P(CommandQueueIndirectHeapTest, givenCommandQueueWhenGetHeapMemoryIsCalledThenHeapIsCreated) { diff --git a/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp b/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp index 6757d2c28b..4028ca519e 100644 --- a/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_fill_buffer_tests.cpp @@ -528,5 +528,5 @@ HWTEST_F(EnqueueFillBufferCmdTests, givenEnqueueFillBufferWhenPatternAllocationI GraphicsAllocation *patternAllocation = mmgr->graphicsAllocations.peekHead(); ASSERT_NE(nullptr, patternAllocation); - EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN, patternAllocation->getAllocationType()); + EXPECT_EQ(GraphicsAllocation::AllocationType::FILL_PATTERN, patternAllocation->getAllocationType()); } diff --git a/unit_tests/command_queue/enqueue_svm_tests.cpp b/unit_tests/command_queue/enqueue_svm_tests.cpp index 2d74e68f68..87f3e0d1d5 100644 --- a/unit_tests/command_queue/enqueue_svm_tests.cpp +++ b/unit_tests/command_queue/enqueue_svm_tests.cpp @@ -463,7 +463,7 @@ TEST_F(EnqueueSvmTest, givenEnqueueSVMMemFillWhenPatternAllocationIsObtainedThen GraphicsAllocation *patternAllocation = mmgr->allocationsForReuse.peekHead(); ASSERT_NE(nullptr, patternAllocation); - EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN, patternAllocation->getAllocationType()); + EXPECT_EQ(GraphicsAllocation::AllocationType::FILL_PATTERN, patternAllocation->getAllocationType()); } TEST_F(EnqueueSvmTest, enqueueTaskWithKernelExecInfo_success) { diff --git a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp index 8310464b5c..bd9e51c89a 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_tests.cpp @@ -590,10 +590,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess memoryManager.reset(aubCsr->createMemoryManager(false)); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxBufferAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_BUFFER); + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxImageAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_IMAGE); + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; aubCsr->processResidency(&allocationsForResidency); @@ -612,10 +612,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur memoryManager.reset(aubCsr->createMemoryManager(false)); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxBufferAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_BUFFER); + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxImageAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_IMAGE); + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); const DispatchInfo dispatchInfo; auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock(); @@ -642,10 +642,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur memoryManager.reset(aubCsr->createMemoryManager(false)); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxBufferAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_BUFFER | GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE); + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER | GraphicsAllocation::AllocationType::NON_AUB_WRITABLE); auto gfxImageAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); - gfxImageAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_IMAGE | GraphicsAllocation::ALLOCATION_TYPE_NON_AUB_WRITABLE); + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE | GraphicsAllocation::AllocationType::NON_AUB_WRITABLE); auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock(); aubSubCaptureManagerMock->subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle; diff --git a/unit_tests/command_stream/command_stream_receiver_tests.cpp b/unit_tests/command_stream/command_stream_receiver_tests.cpp index 353dcc1955..ff46d7acd3 100644 --- a/unit_tests/command_stream/command_stream_receiver_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_tests.cpp @@ -142,7 +142,7 @@ TEST_F(CommandStreamReceiverTest, givenCommandStreamReceiverWhenGetCSIsCalledThe auto commandStreamAllocation = commandStream.getGraphicsAllocation(); ASSERT_NE(nullptr, commandStreamAllocation); - EXPECT_EQ(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM, commandStreamAllocation->getAllocationType()); + EXPECT_EQ(GraphicsAllocation::AllocationType::LINEAR_STREAM, commandStreamAllocation->getAllocationType()); } TEST_F(CommandStreamReceiverTest, createAllocationAndHandleResidency) { diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index d316f695be..2a77fe75fb 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -363,10 +363,10 @@ TEST_P(NoHostPtr, withBufferGraphicsAllocationReportsBufferType) { auto &allocation = *buffer->getGraphicsAllocation(); auto type = allocation.getAllocationType(); - auto isTypeBuffer = !!(type & GraphicsAllocation::ALLOCATION_TYPE_BUFFER); + auto isTypeBuffer = !!(type & GraphicsAllocation::AllocationType::BUFFER); EXPECT_TRUE(isTypeBuffer); - auto isTypeWritable = !!(type & GraphicsAllocation::ALLOCATION_TYPE_WRITABLE); + auto isTypeWritable = !!(type & GraphicsAllocation::AllocationType::WRITABLE); auto isBufferWritable = !(flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)); EXPECT_EQ(isBufferWritable, isTypeWritable); diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index 62e2d4ad9e..111d60da34 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -481,10 +481,10 @@ TEST_P(CreateImageNoHostPtr, withImageGraphicsAllocationReportsImageType) { auto &allocation = *image->getGraphicsAllocation(); auto type = allocation.getAllocationType(); - auto isTypeImage = !!(type & GraphicsAllocation::ALLOCATION_TYPE_IMAGE); + auto isTypeImage = !!(type & GraphicsAllocation::AllocationType::IMAGE); EXPECT_TRUE(isTypeImage); - auto isTypeWritable = !!(type & GraphicsAllocation::ALLOCATION_TYPE_WRITABLE); + auto isTypeWritable = !!(type & GraphicsAllocation::AllocationType::WRITABLE); auto isImageWritable = !(flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS)); EXPECT_EQ(isImageWritable, isTypeWritable); diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 46fcc3d5c1..092af45371 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -1438,12 +1438,12 @@ TEST_F(MemoryManagerWithCsrTest, checkAllocationsForOverlappingWithBiggerOverlap GMockMemoryManager *memMngr = gmockMemoryManager; - auto cleanAllocations = [memMngr](uint32_t waitTaskCount, uint32_t allocationType) -> bool { - return memMngr->MemoryManagerCleanAllocationList(waitTaskCount, allocationType); + auto cleanAllocations = [memMngr](uint32_t waitTaskCount, uint32_t allocationUsage) -> bool { + return memMngr->MemoryManagerCleanAllocationList(waitTaskCount, allocationUsage); }; - auto cleanAllocationsWithTaskCount = [taskCountReady, memMngr](uint32_t waitTaskCount, uint32_t allocationType) -> bool { - return memMngr->MemoryManagerCleanAllocationList(taskCountReady, allocationType); + auto cleanAllocationsWithTaskCount = [taskCountReady, memMngr](uint32_t waitTaskCount, uint32_t allocationUsage) -> bool { + return memMngr->MemoryManagerCleanAllocationList(taskCountReady, allocationUsage); }; EXPECT_CALL(*gmockMemoryManager, cleanAllocationList(::testing::_, ::testing::_)).Times(2).WillOnce(::testing::Invoke(cleanAllocations)).WillOnce(::testing::Invoke(cleanAllocationsWithTaskCount)); @@ -1494,8 +1494,8 @@ TEST_F(MemoryManagerWithCsrTest, checkAllocationsForOverlappingWithBiggerOverlap GMockMemoryManager *memMngr = gmockMemoryManager; - auto cleanAllocations = [memMngr](uint32_t waitTaskCount, uint32_t allocationType) -> bool { - return memMngr->MemoryManagerCleanAllocationList(waitTaskCount, allocationType); + auto cleanAllocations = [memMngr](uint32_t waitTaskCount, uint32_t allocationUsage) -> bool { + return memMngr->MemoryManagerCleanAllocationList(waitTaskCount, allocationUsage); }; EXPECT_CALL(*gmockMemoryManager, cleanAllocationList(::testing::_, ::testing::_)).Times(2).WillRepeatedly(::testing::Invoke(cleanAllocations)); diff --git a/unit_tests/mocks/mock_memory_manager.h b/unit_tests/mocks/mock_memory_manager.h index 7f80c575eb..3fd2f8cd94 100644 --- a/unit_tests/mocks/mock_memory_manager.h +++ b/unit_tests/mocks/mock_memory_manager.h @@ -41,11 +41,11 @@ class MockMemoryManager : public OsAgnosticMemoryManager { class GMockMemoryManager : public MockMemoryManager { public: - MOCK_METHOD2(cleanAllocationList, bool(uint32_t waitTaskCount, uint32_t allocationType)); + MOCK_METHOD2(cleanAllocationList, bool(uint32_t waitTaskCount, uint32_t allocationUsage)); // cleanAllocationList call defined in MemoryManager. MOCK_METHOD1(populateOsHandles, MemoryManager::AllocationStatus(OsHandleStorage &handleStorage)); - bool MemoryManagerCleanAllocationList(uint32_t waitTaskCount, uint32_t allocationType) { return MemoryManager::cleanAllocationList(waitTaskCount, allocationType); } + bool MemoryManagerCleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage) { return MemoryManager::cleanAllocationList(waitTaskCount, allocationUsage); } MemoryManager::AllocationStatus MemoryManagerPopulateOsHandles(OsHandleStorage &handleStorage) { return OsAgnosticMemoryManager::populateOsHandles(handleStorage); } }; diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 9f73bcc96d..9b85e04ae2 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -322,7 +322,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafDisabledWhenFlushIsCalledWithAll auto linearStreamAllocation = memManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); ASSERT_NE(nullptr, linearStreamAllocation); - linearStreamAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); ResidencyContainer allocationsForResidency = {linearStreamAllocation}; EXPECT_FALSE(wddm->isKmDafEnabled()); @@ -358,7 +358,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithResi auto linearStreamAllocation = memManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); ASSERT_NE(nullptr, linearStreamAllocation); - linearStreamAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); csr->makeResident(*linearStreamAllocation); EXPECT_EQ(1u, memManager->getResidencyAllocations().size()); @@ -383,7 +383,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo auto linearStreamAllocation = memManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); ASSERT_NE(nullptr, linearStreamAllocation); - linearStreamAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_LINEAR_STREAM); + linearStreamAllocation->setAllocationType(GraphicsAllocation::AllocationType::LINEAR_STREAM); ResidencyContainer allocationsForResidency = {linearStreamAllocation}; wddm->setKmDafEnabled(true); @@ -405,7 +405,7 @@ TEST_F(WddmCommandStreamTest, givenWddmWithKmDafEnabledWhenFlushIsCalledWithAllo auto fillPatternAllocation = memManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false); ASSERT_NE(nullptr, fillPatternAllocation); - fillPatternAllocation->setAllocationType(GraphicsAllocation::ALLOCATION_TYPE_FILL_PATTERN); + fillPatternAllocation->setAllocationType(GraphicsAllocation::AllocationType::FILL_PATTERN); ResidencyContainer allocationsForResidency = {fillPatternAllocation}; wddm->setKmDafEnabled(true);