2019-07-12 22:50:14 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-08-21 16:53:07 +08:00
|
|
|
#include "runtime/os_interface/windows/wddm_memory_operations_handler.h"
|
2019-07-12 22:50:14 +08:00
|
|
|
|
|
|
|
#include "runtime/os_interface/windows/wddm_allocation.h"
|
|
|
|
#include "runtime/os_interface/windows/wddm_residency_allocations_container.h"
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
2019-08-21 16:53:07 +08:00
|
|
|
WddmMemoryOperationsHandler::WddmMemoryOperationsHandler(Wddm *wddm) : wddm(wddm) {
|
2019-07-12 22:50:14 +08:00
|
|
|
residentAllocations = std::make_unique<WddmResidentAllocationsContainer>(wddm);
|
|
|
|
}
|
|
|
|
|
2019-08-29 19:46:49 +08:00
|
|
|
MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(GraphicsAllocation &gfxAllocation) {
|
2019-07-12 22:50:14 +08:00
|
|
|
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
|
|
|
|
return residentAllocations->makeResidentResources(wddmAllocation.getHandles().data(), wddmAllocation.getNumHandles());
|
|
|
|
}
|
|
|
|
|
2019-08-29 19:46:49 +08:00
|
|
|
MemoryOperationsStatus WddmMemoryOperationsHandler::evict(GraphicsAllocation &gfxAllocation) {
|
2019-07-12 22:50:14 +08:00
|
|
|
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
|
2019-08-29 19:46:49 +08:00
|
|
|
return residentAllocations->evictResources(wddmAllocation.getHandles().data(), wddmAllocation.getNumHandles());
|
2019-07-12 22:50:14 +08:00
|
|
|
}
|
|
|
|
|
2019-08-29 19:46:49 +08:00
|
|
|
MemoryOperationsStatus WddmMemoryOperationsHandler::isResident(GraphicsAllocation &gfxAllocation) {
|
2019-07-12 22:50:14 +08:00
|
|
|
WddmAllocation &wddmAllocation = reinterpret_cast<WddmAllocation &>(gfxAllocation);
|
|
|
|
return residentAllocations->isAllocationResident(wddmAllocation.getDefaultHandle());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace NEO
|