2023-04-07 02:57:37 +00:00
|
|
|
/*
|
2025-05-15 12:22:11 +00:00
|
|
|
* Copyright (C) 2023-2025 Intel Corporation
|
2023-04-07 02:57:37 +00:00
|
|
|
*
|
|
|
|
|
* 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) {
|
2025-05-16 02:04:44 +02:00
|
|
|
return handle == 0;
|
2023-04-07 02:57:37 +00:00
|
|
|
}
|
|
|
|
|
ntSecureHandle = castToUint64(ntSharedHandle);
|
|
|
|
|
handle = ntSecureHandle;
|
|
|
|
|
}
|
2025-05-16 02:04:44 +02:00
|
|
|
return handle == 0;
|
2023-04-07 02:57:37 +00:00
|
|
|
}
|
|
|
|
|
void WddmAllocation::clearInternalHandle(uint32_t handleId) {
|
|
|
|
|
ntSecureHandle = 0u;
|
|
|
|
|
}
|
|
|
|
|
} // namespace NEO
|