1 /* 2 * Copyright (C) 2018-2021 Intel Corporation 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 */ 7 8 #pragma once 9 #include "shared/source/helpers/common_types.h" 10 #include "shared/source/memory_manager/allocations_list.h" 11 12 namespace NEO { 13 14 class InternalAllocationStorage { 15 public: 16 MOCKABLE_VIRTUAL ~InternalAllocationStorage() = default; 17 InternalAllocationStorage(CommandStreamReceiver &commandStreamReceiver); 18 MOCKABLE_VIRTUAL void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage); 19 void storeAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage); 20 void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage, uint32_t taskCount); 21 std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, GraphicsAllocation::AllocationType allocationType); 22 std::unique_ptr<GraphicsAllocation> obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, GraphicsAllocation::AllocationType allocationType); getTemporaryAllocations()23 AllocationsList &getTemporaryAllocations() { return temporaryAllocations; } getAllocationsForReuse()24 AllocationsList &getAllocationsForReuse() { return allocationsForReuse; } 25 DeviceBitfield getDeviceBitfield() const; 26 27 protected: 28 void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList); 29 CommandStreamReceiver &commandStreamReceiver; 30 31 AllocationsList temporaryAllocations; 32 AllocationsList allocationsForReuse; 33 }; 34 } // namespace NEO 35