Move isMemoryBudgetExhausted to WddmResidencyController

Change-Id: Ic9da29ab954835e93cfbcd6690c1764d99939613
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2018-11-05 15:15:31 +01:00
committed by sys_ocldev
parent 630a7e1c26
commit b0acc5ecde
5 changed files with 40 additions and 7 deletions

View File

@@ -342,6 +342,15 @@ bool WddmMemoryManager::tryDeferDeletions(D3DKMT_HANDLE *handles, uint32_t alloc
return status;
}
bool WddmMemoryManager::isMemoryBudgetExhausted() const {
for (auto osContext : this->registeredOsContexts) {
if (osContext != nullptr && osContext->get()->getResidencyController().isMemoryBudgetExhausted()) {
return true;
}
}
return false;
}
bool WddmMemoryManager::validateAllocation(WddmAllocation *alloc) {
if (alloc == nullptr)
return false;
@@ -491,7 +500,7 @@ bool WddmMemoryManager::makeResidentResidencyAllocations(ResidencyContainer &all
if (totalHandlesCount) {
uint64_t bytesToTrim = 0;
while ((result = wddm->makeResident(handlesForResidency.get(), totalHandlesCount, false, &bytesToTrim)) == false) {
this->memoryBudgetExhausted = true;
osContext.get()->getResidencyController().setMemoryBudgetExhausted();
bool trimmingDone = this->getRegisteredOsContext(0u)->get()->getResidencyController().trimResidencyToBudget(bytesToTrim);
bool cantTrimFurther = !trimmingDone;
if (cantTrimFurther) {