2018-10-22 21:17:32 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2018-10-29 20:26:58 +08:00
|
|
|
#include "runtime/memory_manager/allocations_list.h"
|
2018-10-22 21:17:32 +08:00
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
class CommandStreamReceiver;
|
|
|
|
class GraphicsAllocation;
|
|
|
|
|
|
|
|
class InternalAllocationStorage {
|
|
|
|
public:
|
2018-10-26 19:05:31 +08:00
|
|
|
MOCKABLE_VIRTUAL ~InternalAllocationStorage() = default;
|
2018-10-22 21:17:32 +08:00
|
|
|
InternalAllocationStorage(CommandStreamReceiver &commandStreamReceiver);
|
2018-10-26 19:05:31 +08:00
|
|
|
MOCKABLE_VIRTUAL void cleanAllocationList(uint32_t waitTaskCount, uint32_t allocationUsage);
|
2018-10-22 21:17:32 +08:00
|
|
|
void storeAllocation(std::unique_ptr<GraphicsAllocation> gfxAllocation, uint32_t allocationUsage);
|
|
|
|
void storeAllocationWithTaskCount(std::unique_ptr<GraphicsAllocation> gfxAllocation, uint32_t allocationUsage, uint32_t taskCount);
|
|
|
|
std::unique_ptr<GraphicsAllocation> obtainReusableAllocation(size_t requiredSize, bool isInternalAllocationRequired);
|
2018-10-29 20:26:58 +08:00
|
|
|
AllocationsList &getTemporaryAllocations() { return temporaryAllocations; }
|
|
|
|
AllocationsList &getAllocationsForReuse() { return allocationsForReuse; }
|
2018-10-22 21:17:32 +08:00
|
|
|
|
2018-10-26 19:05:31 +08:00
|
|
|
protected:
|
2018-10-29 20:26:58 +08:00
|
|
|
void freeAllocationsList(uint32_t waitTaskCount, AllocationsList &allocationsList);
|
2018-10-22 21:17:32 +08:00
|
|
|
CommandStreamReceiver &commandStreamReceiver;
|
2018-10-29 20:26:58 +08:00
|
|
|
|
|
|
|
AllocationsList temporaryAllocations;
|
|
|
|
AllocationsList allocationsForReuse;
|
2018-10-22 21:17:32 +08:00
|
|
|
};
|
|
|
|
} // namespace OCLRT
|