mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: pass arrayIndex to Wddm::openNTHandle function
Related-To: NEO-11498 Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f8994aacb6
commit
76a05c1cab
@@ -76,7 +76,8 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
||||
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
|
||||
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
|
||||
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, AllocationType::sharedImage);
|
||||
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle, arrayIndex};
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, rootDeviceIndex, AllocationType::sharedImage);
|
||||
} else {
|
||||
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
|
||||
return nullptr;
|
||||
@@ -170,7 +171,8 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
||||
if (textureDesc.MiscFlags & D3DResourceFlags::MISC_SHARED_NTHANDLE) {
|
||||
sharingFcns->getSharedNTHandle(textureStaging, &sharedHandle);
|
||||
if (memoryManager->verifyHandle(toOsHandle(sharedHandle), rootDeviceIndex, true)) {
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(sharedHandle, rootDeviceIndex, AllocationType::sharedImage);
|
||||
MemoryManager::ExtendedOsHandleData osHandleData{sharedHandle};
|
||||
alloc = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, rootDeviceIndex, AllocationType::sharedImage);
|
||||
} else {
|
||||
err.set(CL_INVALID_D3D11_RESOURCE_KHR);
|
||||
return nullptr;
|
||||
|
||||
@@ -42,7 +42,8 @@ GraphicsAllocation *UnifiedSharing::createGraphicsAllocation(Context *context, U
|
||||
auto memoryManager = context->getMemoryManager();
|
||||
switch (description.type) {
|
||||
case UnifiedSharingHandleType::win32Nt: {
|
||||
return memoryManager->createGraphicsAllocationFromNTHandle(description.handle, context->getDevice(0)->getRootDeviceIndex(), allocationType);
|
||||
MemoryManager::OsHandleData osHandleData{description.handle};
|
||||
return memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, context->getDevice(0)->getRootDeviceIndex(), allocationType);
|
||||
}
|
||||
case UnifiedSharingHandleType::linuxFd:
|
||||
case UnifiedSharingHandleType::win32Shared: {
|
||||
|
||||
@@ -59,12 +59,11 @@ class D3DTests : public PlatformFixture, public ::testing::Test {
|
||||
gmmOwnershipPassed = true;
|
||||
return alloc;
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
if (failAlloc) {
|
||||
return nullptr;
|
||||
}
|
||||
AllocationProperties properties(rootDeviceIndex, true, 0, AllocationType::internalHostMemory, false, false, 0);
|
||||
OsAgnosticMemoryManager::OsHandleData osHandleData{handle};
|
||||
auto alloc = OsAgnosticMemoryManager::createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
|
||||
alloc->setDefaultGmm(forceGmm);
|
||||
gmmOwnershipPassed = true;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,10 +14,10 @@ using namespace NEO;
|
||||
|
||||
struct ImageWindowsTestsMockMemoryManager : MockMemoryManager {
|
||||
using MockMemoryManager::MockMemoryManager;
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
|
||||
auto graphicsAllocation = createMemoryAllocation(allocType, nullptr, reinterpret_cast<void *>(1), 1,
|
||||
4096u, reinterpret_cast<uint64_t>(handle), MemoryPool::systemCpuInaccessible,
|
||||
4096u, osHandleData.handle, MemoryPool::systemCpuInaccessible,
|
||||
rootDeviceIndex, false, false, false);
|
||||
|
||||
graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper()));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -60,15 +60,15 @@ struct UnifiedSharingContextFixture : ::testing::Test {
|
||||
template <bool validMemoryManager>
|
||||
struct UnifiedSharingMockMemoryManager : MockMemoryManager {
|
||||
using MockMemoryManager::MockMemoryManager;
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
if (!validMemoryManager) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto graphicsAllocation = createMemoryAllocation(AllocationType::internalHostMemory, nullptr, reinterpret_cast<void *>(1), 1,
|
||||
4096u, reinterpret_cast<uint64_t>(handle), MemoryPool::systemCpuInaccessible,
|
||||
4096u, osHandleData.handle, MemoryPool::systemCpuInaccessible,
|
||||
rootDeviceIndex, false, false, false);
|
||||
graphicsAllocation->setSharedHandle(static_cast<osHandle>(reinterpret_cast<uint64_t>(handle)));
|
||||
graphicsAllocation->setSharedHandle(osHandleData.handle);
|
||||
graphicsAllocation->set32BitAllocation(false);
|
||||
graphicsAllocation->setDefaultGmm(new MockGmm(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper()));
|
||||
return graphicsAllocation;
|
||||
|
||||
@@ -110,8 +110,8 @@ class MockProductHelper : public ProductHelperHw<IGFX_UNKNOWN> {
|
||||
};
|
||||
|
||||
struct MemoryManagerReturningCompressedAllocations : UnifiedSharingMockMemoryManager<true> {
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
auto allocation = UnifiedSharingMockMemoryManager<true>::createGraphicsAllocationFromNTHandle(handle, rootDeviceIndex, AllocationType::sharedImage);
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
auto allocation = UnifiedSharingMockMemoryManager<true>::createGraphicsAllocationFromNTHandle(osHandleData, rootDeviceIndex, AllocationType::sharedImage);
|
||||
|
||||
auto gmm = allocation->getDefaultGmm();
|
||||
auto mockGmmResourceInfo = std::make_unique<MockGmmResourceInfo>(gmm->gmmResourceInfo->peekGmmResourceInfo());
|
||||
|
||||
@@ -164,9 +164,9 @@ struct UnifiedSharingCreateAllocationTests : UnifiedSharingTestsWithMemoryManage
|
||||
struct MemoryManagerCheckingAllocationMethod : MockMemoryManager {
|
||||
using MockMemoryManager::MockMemoryManager;
|
||||
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(void *handle, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
this->createFromNTHandleCalled = true;
|
||||
this->handle = toOsHandle(handle);
|
||||
this->handle = osHandleData.handle;
|
||||
return nullptr;
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override {
|
||||
|
||||
Reference in New Issue
Block a user