mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
Move ownership of OsContext to memory manager.
- register OsContext when device is created - memory manager controls residency so it needs to have control of OsContexts underneath - device may be destroyed while OsContexts may be still in use Change-Id: If08df7686f5448a1e7b0b6ced20b37a1e8ba2cd6
This commit is contained in:
committed by
sys_ocldev
parent
b87af2c9e7
commit
75e26f39b1
@@ -32,6 +32,7 @@
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/memory_manager/deferred_deleter.h"
|
||||
#include "runtime/os_interface/os_context.h"
|
||||
#include "runtime/utilities/stackvec.h"
|
||||
#include "runtime/utilities/tag_allocator.h"
|
||||
|
||||
@@ -76,6 +77,9 @@ MemoryManager::MemoryManager(bool enable64kbpages) : allocator32Bit(nullptr), en
|
||||
MemoryManager::~MemoryManager() {
|
||||
freeAllocationsList(-1, graphicsAllocations);
|
||||
freeAllocationsList(-1, allocationsForReuse);
|
||||
for (auto osContext : registeredOsContexts) {
|
||||
osContext->decRefInternal();
|
||||
}
|
||||
}
|
||||
|
||||
void *MemoryManager::allocateSystemMemory(size_t size, size_t alignment) {
|
||||
@@ -379,6 +383,11 @@ RequirementsStatus MemoryManager::checkAllocationsForOverlapping(AllocationRequi
|
||||
return status;
|
||||
}
|
||||
|
||||
void MemoryManager::registerOsContext(OsContext *contextToRegister) {
|
||||
contextToRegister->incRefInternal();
|
||||
registeredOsContexts.push_back(contextToRegister);
|
||||
}
|
||||
|
||||
bool MemoryManager::getAllocationData(AllocationData &allocationData, bool allocateMemory, const void *hostPtr, size_t size, GraphicsAllocation::AllocationType type) {
|
||||
UNRECOVERABLE_IF(hostPtr == nullptr && !allocateMemory);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user