refactor: remove not needed createGraphicsAllocationFromNTHandle method

Related-To: NEO-11498
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2024-06-18 12:10:24 +00:00
committed by Compute-Runtime-Automation
parent bd46361e26
commit daec249430
40 changed files with 104 additions and 246 deletions

View File

@@ -89,7 +89,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
MemoryManager::ExtendedOsHandleData osHandleData{surfaceInfo->shared_handle};
MemoryManager::OsHandleData osHandleData{surfaceInfo->shared_handle};
alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties,
false, false, true, nullptr);
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imagePlane, 0u);

View File

@@ -73,31 +73,22 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
auto memoryManager = context->getMemoryManager();
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle, arrayIndex};
alloc = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, rootDeviceIndex, AllocationType::sharedImage);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
bool ntHandle = textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE;
ntHandle ? sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle) : sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, ntHandle)) {
MemoryManager::OsHandleData osHandleData{sharedHandle, arrayIndex};
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, true, nullptr);
} else {
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle, arrayIndex};
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, true, nullptr);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
if (alloc == nullptr) {
err.set(CL_OUT_OF_HOST_MEMORY);
return nullptr;
@@ -168,31 +159,22 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
auto memoryManager = context->getMemoryManager();
auto rootDeviceIndex = context->getDevice(0)->getRootDeviceIndex();
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle};
alloc = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, rootDeviceIndex, AllocationType::sharedImage);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
bool ntHandle = textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE;
ntHandle ? sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle) : sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, ntHandle)) {
MemoryManager::OsHandleData osHandleData{sharedHandle};
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, true, nullptr);
} else {
sharingFcns->getSharedHandle(textureStaging, &sharedHandle);
AllocationProperties allocProperties(rootDeviceIndex,
false, // allocateMemory
0u, // size
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(rootDeviceIndex));
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, false)) {
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle};
alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, true, nullptr);
} else {
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
return nullptr;
}
bool is3DUavOrRtv = false;
if (textureDesc.BindFlags & D3DBindFLags::D3D11_BIND_RENDER_TARGET || textureDesc.BindFlags & D3DBindFLags::D3D11_BIND_UNORDERED_ACCESS) {
is3DUavOrRtv = true;

View File

@@ -145,7 +145,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
&imgInfo,
AllocationType::sharedImage,
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
MemoryManager::ExtendedOsHandleData osHandleData{texInfo.globalShareHandle};
MemoryManager::OsHandleData osHandleData{texInfo.globalShareHandle};
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, false, nullptr);
if (alloc == nullptr) {

View File

@@ -59,7 +59,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
AllocationType::sharedImage,
false, // isMultiStorageAllocation
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex()));
MemoryManager::ExtendedOsHandleData osHandleData{texInfo.globalShareHandle};
MemoryManager::OsHandleData osHandleData{texInfo.globalShareHandle};
auto alloc = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, allocProperties, false, false, true, nullptr);
if (alloc == nullptr) {

View File

@@ -40,24 +40,17 @@ GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, U
GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, UnifiedSharingMemoryDescription description, ImageInfo *imgInfo, AllocationType allocationType) {
auto memoryManager = context->getMemoryManager();
switch (description.type) {
case UnifiedSharingHandleType::win32Nt: {
MemoryManager::OsHandleData osHandleData{description.handle};
return memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, context->getDevice(0)->getRootDeviceIndex(), allocationType);
}
case UnifiedSharingHandleType::linuxFd:
case UnifiedSharingHandleType::win32Shared: {
const AllocationProperties properties{context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
imgInfo,
allocationType,
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
MemoryManager::OsHandleData osHandleData{description.handle};
return memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
}
default:
if (description.type != UnifiedSharingHandleType::win32Nt && description.type != UnifiedSharingHandleType::linuxFd && description.type != UnifiedSharingHandleType::win32Shared)
return nullptr;
}
const AllocationProperties properties{context->getDevice(0)->getRootDeviceIndex(),
false, // allocateMemory
imgInfo,
allocationType,
context->getDeviceBitfieldForAllocation(context->getDevice(0)->getRootDeviceIndex())};
MemoryManager::OsHandleData osHandleData{description.handle};
return memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
}
template <>