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:
Mrozek, Michal
2018-09-06 09:01:13 +02:00
committed by sys_ocldev
parent b87af2c9e7
commit 75e26f39b1
5 changed files with 30 additions and 5 deletions

View File

@@ -251,6 +251,9 @@ class MemoryManager {
::alignedFree(ptr);
}
void registerOsContext(OsContext *contextToRegister);
size_t getOsContextCount() { return registeredOsContexts.size(); }
protected:
static bool getAllocationData(AllocationData &allocationData, bool allocateMemory, const void *hostPtr, size_t size, GraphicsAllocation::AllocationType type);
@@ -268,6 +271,7 @@ class MemoryManager {
std::unique_ptr<DeferredDeleter> deferredDeleter;
bool asyncDeleterEnabled = false;
bool enable64kbpages = false;
std::vector<OsContext *> registeredOsContexts;
};
std::unique_ptr<DeferredDeleter> createDeferredDeleter();