Files
compute-runtime/runtime/os_interface/windows/wddm_residency_handler.cpp
Zbigniew Zdanowicz f01c1d2d49 Add residency mechanism to OS interface
Change-Id: I323ca856d3c901bdc4d5961cdefa42685b53d4d9
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
2019-07-19 13:35:11 +02:00

39 lines
1.4 KiB
C++

/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/os_interface/windows/wddm_residency_handler.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm_allocation.h"
#include "runtime/os_interface/windows/wddm_residency_allocations_container.h"
#include "engine_limits.h"
namespace NEO {
WddmResidencyHandler::WddmResidencyHandler(Wddm *wddm) : wddm(wddm) {
residentAllocations = std::make_unique<WddmResidentAllocationsContainer>(wddm);
}
bool WddmResidencyHandler::makeResident(GraphicsAllocation &gfxAllocation) {
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
return residentAllocations->makeResidentResources(wddmAllocation.getHandles().data(), wddmAllocation.getNumHandles());
}
bool WddmResidencyHandler::evict(GraphicsAllocation &gfxAllocation) {
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
auto result = residentAllocations->evictResources(wddmAllocation.getHandles().data(), wddmAllocation.getNumHandles());
return result == EvictionStatus::SUCCESS;
}
bool WddmResidencyHandler::isResident(GraphicsAllocation &gfxAllocation) {
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
return residentAllocations->isAllocationResident(wddmAllocation.getDefaultHandle());
}
} // namespace NEO