1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 #include "shared/source/memory_manager/graphics_allocation.h"
10 #include "shared/source/memory_manager/memory_manager.h"
11 
12 #include <mutex>
13 
14 namespace NEO {
15 class CommandStreamReceiver;
16 struct ReusableAllocationRequirements;
17 
18 class AllocationsList : public IDList<GraphicsAllocation, true, true> {
19   public:
20     AllocationsList(AllocationUsage allocationUsage);
21     AllocationsList();
22     std::unique_ptr<GraphicsAllocation> detachAllocation(size_t requiredMinimalSize, const void *requiredPtr, CommandStreamReceiver *commandStreamReceiver, GraphicsAllocation::AllocationType allocationType);
23     void freeAllGraphicsAllocations(Device *neoDevice);
24 
25   private:
26     GraphicsAllocation *detachAllocationImpl(GraphicsAllocation *, void *);
27     bool checkTagAddressReady(ReusableAllocationRequirements *requirements, GraphicsAllocation *gfxAllocation);
28 
29     const AllocationUsage allocationUsage;
30 };
31 } // namespace NEO
32