mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
Related-To: LOCI-4172, LOCI-4305, LOCI-4306 - Create a new IPC Memory handle upon call to getIpcMemHandle if the previous handle has been freed. - Release the Ipc Memory Handle when zeMemPutIpcHandle is called. - Create a new IPC Handle for tracking thru zeMemGetAllocProperties when ze_external_memory_export_fd_t is used. - Convert FD to opaque IPC handle and IPC Handle to FD. Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
29 lines
972 B
C++
29 lines
972 B
C++
/*
|
|
* Copyright (C) 2023 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/os_interface/windows/wddm_allocation.h"
|
|
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
|
|
|
namespace NEO {
|
|
int WddmAllocation::createInternalHandle(MemoryManager *memoryManager, uint32_t handleId, uint64_t &handle) {
|
|
handle = ntSecureHandle;
|
|
if (handle == 0) {
|
|
HANDLE ntSharedHandle = NULL;
|
|
WddmMemoryManager *wddmMemoryManager = reinterpret_cast<WddmMemoryManager *>(memoryManager);
|
|
auto status = wddmMemoryManager->createInternalNTHandle(&resourceHandle, &ntSharedHandle, this->getRootDeviceIndex());
|
|
if (status != STATUS_SUCCESS) {
|
|
return handle == 0;
|
|
}
|
|
ntSecureHandle = castToUint64(ntSharedHandle);
|
|
handle = ntSecureHandle;
|
|
}
|
|
return handle == 0;
|
|
}
|
|
void WddmAllocation::clearInternalHandle(uint32_t handleId) {
|
|
ntSecureHandle = 0u;
|
|
}
|
|
} // namespace NEO
|