mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Fail when handle cannot be obtain for an allocation
If a handle cannot be obtained, like PRIME_HANDLE_TO_FD, then properly check for the error and propagate it upwards. Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
acb8186744
commit
4391ad21bb
@@ -72,8 +72,9 @@ class WddmAllocation : public GraphicsAllocation {
|
||||
handles[handleIndex] = handle;
|
||||
}
|
||||
|
||||
uint64_t peekInternalHandle(MemoryManager *memoryManager) override {
|
||||
return ntSecureHandle;
|
||||
int peekInternalHandle(MemoryManager *memoryManager, uint64_t &handle) override {
|
||||
handle = ntSecureHandle;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t *getSharedHandleToModify() {
|
||||
|
||||
@@ -557,8 +557,10 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation
|
||||
for (auto handleId = 0u; handleId < gfxAllocation->getNumGmms(); handleId++) {
|
||||
delete gfxAllocation->getGmm(handleId);
|
||||
}
|
||||
if (input->peekInternalHandle(nullptr) != 0u) {
|
||||
[[maybe_unused]] auto status = SysCalls::closeHandle(reinterpret_cast<void *>(reinterpret_cast<uintptr_t *>(input->peekInternalHandle(nullptr))));
|
||||
uint64_t handle = 0;
|
||||
int ret = input->peekInternalHandle(nullptr, handle);
|
||||
if (ret == 0) {
|
||||
[[maybe_unused]] auto status = SysCalls::closeHandle(reinterpret_cast<void *>(reinterpret_cast<uintptr_t *>(handle)));
|
||||
DEBUG_BREAK_IF(!status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user