mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Dont unlock/evict wddm allocations during releasing memory
Change-Id: Ib934867886a883a22fde2f0c03e16338dc215e65 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
@@ -1002,7 +1002,15 @@ void Wddm::applyBlockingMakeResident(const D3DKMT_HANDLE &handle) {
|
||||
while (currentPagingFenceValue > *getPagingFenceAddress())
|
||||
;
|
||||
}
|
||||
|
||||
void Wddm::removeTemporaryResource(const D3DKMT_HANDLE &handle) {
|
||||
auto lock = acquireLock(temporaryResourcesLock);
|
||||
auto position = std::find(temporaryResources.begin(), temporaryResources.end(), handle);
|
||||
if (position == temporaryResources.end()) {
|
||||
return;
|
||||
}
|
||||
*position = temporaryResources.back();
|
||||
temporaryResources.pop_back();
|
||||
}
|
||||
std::unique_lock<SpinLock> Wddm::acquireLock(SpinLock &lock) {
|
||||
return std::unique_lock<SpinLock>{lock};
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL EvictionStatus evictTemporaryResource(const D3DKMT_HANDLE &handle);
|
||||
MOCKABLE_VIRTUAL void applyBlockingMakeResident(const D3DKMT_HANDLE &handle);
|
||||
MOCKABLE_VIRTUAL std::unique_lock<SpinLock> acquireLock(SpinLock &lock);
|
||||
MOCKABLE_VIRTUAL void removeTemporaryResource(const D3DKMT_HANDLE &handle);
|
||||
|
||||
protected:
|
||||
bool initialized = false;
|
||||
|
||||
@@ -286,6 +286,14 @@ void WddmMemoryManager::unlockResourceImpl(GraphicsAllocation &graphicsAllocatio
|
||||
DEBUG_BREAK_IF(evictionStatus == EvictionStatus::FAILED);
|
||||
}
|
||||
}
|
||||
void WddmMemoryManager::freeAssociatedResourceImpl(GraphicsAllocation &graphicsAllocation) {
|
||||
auto &wddmAllocation = static_cast<WddmAllocation &>(graphicsAllocation);
|
||||
if (wddmAllocation.needsMakeResidentBeforeLock) {
|
||||
for (auto i = 0u; i < wddmAllocation.getNumHandles(); i++) {
|
||||
wddm->removeTemporaryResource(wddmAllocation.getHandles()[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) {
|
||||
WddmAllocation *input = static_cast<WddmAllocation *>(gfxAllocation);
|
||||
|
||||
@@ -70,6 +70,7 @@ class WddmMemoryManager : public MemoryManager {
|
||||
|
||||
void *lockResourceImpl(GraphicsAllocation &graphicsAllocation) override;
|
||||
void unlockResourceImpl(GraphicsAllocation &graphicsAllocation) override;
|
||||
void freeAssociatedResourceImpl(GraphicsAllocation &graphicsAllocation) override;
|
||||
GraphicsAllocation *allocate32BitGraphicsMemoryImpl(const AllocationData &allocationData) override;
|
||||
GraphicsAllocation *allocateGraphicsMemoryInDevicePool(const AllocationData &allocationData, AllocationStatus &status) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user