2018-10-22 15:17:32 +02:00
|
|
|
/*
|
2022-02-04 13:59:01 +00:00
|
|
|
* Copyright (C) 2018-2022 Intel Corporation
|
2018-10-22 15:17:32 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-06-23 11:30:01 +02:00
|
|
|
#include "shared/source/helpers/common_types.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/memory_manager/allocations_list.h"
|
2018-10-22 15:17:32 +02:00
|
|
|
|
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);
|
2018-10-26 11:05:31 +00:00
|
|
|
MOCKABLE_VIRTUAL void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
|
2021-10-21 12:37:31 +00:00
|
|
|
void storeAllocation(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage);
|
|
|
|
|
void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> &&gfxAllocation, uint32_t allocationUsage, uint32_t 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);
|
2018-10-29 12:26:58 +00:00
|
|
|
AllocationsList &getTemporaryAllocations() { return temporaryAllocations; }
|
|
|
|
|
AllocationsList &getAllocationsForReuse() { return allocationsForReuse; }
|
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:
|
2018-10-29 12:26:58 +00:00
|
|
|
void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList);
|
2018-10-22 15:17:32 +02:00
|
|
|
CommandStreamReceiver &commandStreamReceiver;
|
2018-10-29 12:26:58 +00:00
|
|
|
|
|
|
|
|
AllocationsList temporaryAllocations;
|
|
|
|
|
AllocationsList allocationsForReuse;
|
2018-10-22 15:17:32 +02:00
|
|
|
};
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|