2018-10-22 15:17:32 +02:00
|
|
|
/*
|
2023-01-24 15:33:52 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-10-22 15:17:32 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/memory_manager/allocations_list.h"
|
2018-10-22 15:17:32 +02:00
|
|
|
|
2022-07-13 15:05:42 +00:00
|
|
|
#include <array>
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-10-22 15:17:32 +02:00
|
|
|
|
|
|
|
|
class InternalAllocationStorage {
|
|
|
|
|
public:
|
2018-10-26 11:05:31 +00:00
|
|
|
MOCKABLE_VIRTUAL ~InternalAllocationStorage() = default;
|
2018-10-22 15:17:32 +02:00
|
|
|
InternalAllocationStorage(CommandStreamReceiver &commandStreamReceiver);
|
2022-11-22 13:53:59 +00:00
|
|
|
MOCKABLE_VIRTUAL void cleanAllocationList(TaskCountType waitTaskCount, uint32_t allocationUsage);
|
2021-10-21 12:37:31 +00:00
|
|
|
void storeAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage);
|
2022-11-22 13:53:59 +00:00
|
|
|
void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage, TaskCountType taskCount);
|
2022-02-04 13:59:01 +00:00
|
|
|
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, AllocationType allocationType);
|
|
|
|
|
std::unique_ptr<GraphicsAllocation> obtainTemporaryAllocationWithPtr(size_t requiredSize, const void *requiredPtr, AllocationType allocationType);
|
2022-07-13 15:05:42 +00:00
|
|
|
AllocationsList &getTemporaryAllocations() { return allocationLists[TEMPORARY_ALLOCATION]; }
|
|
|
|
|
AllocationsList &getAllocationsForReuse() { return allocationLists[REUSABLE_ALLOCATION]; }
|
|
|
|
|
AllocationsList &getDeferredAllocations() { return allocationLists[DEFERRED_DEALLOCATION]; }
|
2020-06-23 11:30:01 +02:00
|
|
|
DeviceBitfield getDeviceBitfield() const;
|
2018-10-22 15:17:32 +02:00
|
|
|
|
2018-10-26 11:05:31 +00:00
|
|
|
protected:
|
2022-11-22 13:53:59 +00:00
|
|
|
void freeAllocationsList(TaskCountType waitTaskCount, AllocationsList &allocationsList);
|
2018-10-22 15:17:32 +02:00
|
|
|
CommandStreamReceiver &commandStreamReceiver;
|
2018-10-29 12:26:58 +00:00
|
|
|
|
2022-07-13 15:05:42 +00:00
|
|
|
std::array<AllocationsList, 3> allocationLists = {AllocationsList(TEMPORARY_ALLOCATION), AllocationsList(REUSABLE_ALLOCATION), AllocationsList(DEFERRED_DEALLOCATION)};
|
2018-10-22 15:17:32 +02:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|