From 71f99f4174351aaa9242cdc65e4bd91b35a46692 Mon Sep 17 00:00:00 2001 From: Lukasz Jobczyk Date: Wed, 2 Sep 2020 08:16:35 +0200 Subject: [PATCH] Optimize mergeWithResidencyContainer method Related-To: NEO-5007 Change-Id: I7145371c719ceeebf529fdf94a512a8398156591 Signed-off-by: Lukasz Jobczyk --- .../linux/drm_memory_operations_handler_bind.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/shared/source/os_interface/linux/drm_memory_operations_handler_bind.cpp b/shared/source/os_interface/linux/drm_memory_operations_handler_bind.cpp index 5d8579d416..2986edef87 100644 --- a/shared/source/os_interface/linux/drm_memory_operations_handler_bind.cpp +++ b/shared/source/os_interface/linux/drm_memory_operations_handler_bind.cpp @@ -84,18 +84,16 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::isResident(Device *device } void DrmMemoryOperationsHandlerBind::mergeWithResidencyContainer(OsContext *osContext, ResidencyContainer &residencyContainer) { + if (DebugManager.flags.BindAllAllocations.get()) { + this->makeResidentWithinOsContext(osContext, ArrayRef(residencyContainer)); + residencyContainer.clear(); + return; + } + std::lock_guard lock(mutex); for (auto gfxAllocation = residencyContainer.begin(); gfxAllocation != residencyContainer.end();) { if ((*gfxAllocation)->isAlwaysResident(osContext->getContextId())) { gfxAllocation = residencyContainer.erase(gfxAllocation); - } else if (DebugManager.flags.BindAllAllocations.get()) { - auto drmAllocation = static_cast(*gfxAllocation); - auto &drmContextIds = static_cast(osContext)->getDrmContextIds(); - for (uint32_t drmIterator = 0u; drmIterator < drmContextIds.size(); drmIterator++) { - drmAllocation->makeBOsResident(osContext, drmIterator, nullptr, true); - } - drmAllocation->updateResidencyTaskCount(GraphicsAllocation::objectAlwaysResident, osContext->getContextId()); - gfxAllocation = residencyContainer.erase(gfxAllocation); } else { gfxAllocation++; }