Files
compute-runtime/runtime/os_interface/windows/wddm_residency_controller.h
Maciej Dziuban 07e03af67e Extract trimCandidatesList to WddmResidencyController
Change-Id: I8938ee79975caf9cb09f7183c87452dc94a6b3e6
2018-10-09 00:55:10 +02:00

46 lines
1.1 KiB
C++

/*
* Copyright (C) 2018 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "runtime/memory_manager/residency_container.h"
#include <atomic>
namespace OCLRT {
class GraphicsAllocation;
class WddmAllocation;
class WddmResidencyController {
public:
WddmResidencyController();
void acquireLock();
void releaseLock();
WddmAllocation *getTrimCandidateHead();
void addToTrimCandidateList(GraphicsAllocation *allocation);
void removeFromTrimCandidateList(GraphicsAllocation *allocation, bool compactList);
void checkTrimCandidateCount();
bool checkTrimCandidateListCompaction();
void compactTrimCandidateList();
uint64_t getLastTrimFenceValue() { return lastTrimFenceValue; }
void setLastTrimFenceValue(uint64_t value) { lastTrimFenceValue = value; }
const ResidencyContainer &peekTrimCandidateList() const { return trimCandidateList; }
uint32_t peekTrimCandidatesCount() const { return trimCandidatesCount; }
protected:
std::atomic<bool> lock;
uint64_t lastTrimFenceValue;
ResidencyContainer trimCandidateList;
uint32_t trimCandidatesCount = 0;
};
} // namespace OCLRT