mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
refactor: remove not needed createGraphicsAllocationFromNTHandle method
Related-To: NEO-11498 Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
bd46361e26
commit
daec249430
@@ -480,7 +480,7 @@ NTSTATUS __stdcall mockD3DKMTOpenResourceFromNtHandle(IN OUT D3DKMT_OPENRESOURCE
|
||||
}
|
||||
|
||||
NTSTATUS __stdcall mockD3DKMTQueryResourceInfo(IN OUT D3DKMT_QUERYRESOURCEINFO *queryResourceInfo) {
|
||||
if (queryResourceInfo->hDevice != DEVICE_HANDLE || queryResourceInfo->hGlobalShare == INVALID_HANDLE) {
|
||||
if (queryResourceInfo->hDevice != DEVICE_HANDLE || queryResourceInfo->hGlobalShare == INVALID_HANDLE || queryResourceInfo->hGlobalShare == NT_ALLOCATION_HANDLE) {
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
queryResourceInfo->TotalPrivateDriverDataSize = totalPrivateSize;
|
||||
|
||||
@@ -232,20 +232,6 @@ GraphicsAllocation *MockMemoryManager::createGraphicsAllocationFromSharedHandle(
|
||||
}
|
||||
}
|
||||
|
||||
GraphicsAllocation *MockMemoryManager::createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) {
|
||||
if (osHandleData.handle != invalidSharedHandle) {
|
||||
auto graphicsAllocation = createMemoryAllocation(NEO::AllocationType::sharedBuffer, nullptr, reinterpret_cast<void *>(1), 1,
|
||||
ipcAllocationSize, osHandleData.handle, MemoryPool::systemCpuInaccessible, rootDeviceIndex,
|
||||
false, false, false);
|
||||
graphicsAllocation->setSharedHandle(osHandleData.handle);
|
||||
this->capturedSharedHandle = osHandleData.handle;
|
||||
return graphicsAllocation;
|
||||
} else {
|
||||
this->capturedSharedHandle = osHandleData.handle;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool MockMemoryManager::copyMemoryToAllocationBanks(GraphicsAllocation *graphicsAllocation, size_t destinationOffset, const void *memoryToCopy, size_t sizeToCopy, DeviceBitfield handleMask) {
|
||||
copyMemoryToAllocationBanksCalled++;
|
||||
copyMemoryToAllocationBanksParamsPassed.push_back({graphicsAllocation, destinationOffset, memoryToCopy, sizeToCopy, handleMask});
|
||||
|
||||
@@ -84,7 +84,6 @@ class MockMemoryManager : public MemoryManagerCreate<OsAgnosticMemoryManager> {
|
||||
GraphicsAllocation *allocateGraphicsMemoryWithProperties(const AllocationProperties &properties, const void *ptr) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromExistingStorage(AllocationProperties &properties, void *ptr, MultiGraphicsAllocation &multiGraphicsAllocation) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override;
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override;
|
||||
|
||||
void *allocateSystemMemory(size_t size, size_t alignment) override;
|
||||
|
||||
@@ -329,9 +328,6 @@ class FailMemoryManager : public MockMemoryManager {
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override {
|
||||
return nullptr;
|
||||
}
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *lockResourceImpl(GraphicsAllocation &gfxAllocation) override { return nullptr; };
|
||||
void unlockResourceImpl(GraphicsAllocation &gfxAllocation) override{};
|
||||
|
||||
@@ -161,7 +161,7 @@ bool WddmMock::destroyAllocation(WddmAllocation *alloc, OsContextWin *osContext)
|
||||
return success;
|
||||
}
|
||||
|
||||
bool WddmMock::openSharedHandle(const MemoryManager::ExtendedOsHandleData &osHandleData, WddmAllocation *alloc) {
|
||||
bool WddmMock::openSharedHandle(const MemoryManager::OsHandleData &osHandleData, WddmAllocation *alloc) {
|
||||
if (failOpenSharedHandle) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -77,7 +77,7 @@ class WddmMock : public Wddm {
|
||||
NTSTATUS createAllocation(WddmAllocation *wddmAllocation);
|
||||
bool createAllocation64k(WddmAllocation *wddmAllocation);
|
||||
bool destroyAllocation(WddmAllocation *alloc, OsContextWin *osContext);
|
||||
bool openSharedHandle(const MemoryManager::ExtendedOsHandleData &osHandleData, WddmAllocation *alloc) override;
|
||||
bool openSharedHandle(const MemoryManager::OsHandleData &osHandleData, WddmAllocation *alloc) override;
|
||||
bool createContext(OsContextWin &osContext) override;
|
||||
void applyAdditionalContextFlags(CREATECONTEXT_PVTDATA &privateData, OsContextWin &osContext) override;
|
||||
bool destroyContext(D3DKMT_HANDLE context) override;
|
||||
|
||||
@@ -509,7 +509,6 @@ TEST_F(DeviceGetCapsTest, givenFlagEnabled64kbPagesWhenCallConstructorMemoryMana
|
||||
void removeAllocationFromHostPtrManager(GraphicsAllocation *memory) override{};
|
||||
GraphicsAllocation *createGraphicsAllocationFromMultipleSharedHandles(const std::vector<osHandle> &handles, AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override { return nullptr; }
|
||||
GraphicsAllocation *createGraphicsAllocationFromSharedHandle(const OsHandleData &osHandleData, const AllocationProperties &properties, bool requireSpecificBitness, bool isHostIpcAllocation, bool reuseSharedAllocation, void *mapPointer) override { return nullptr; };
|
||||
GraphicsAllocation *createGraphicsAllocationFromNTHandle(const OsHandleData &osHandleData, uint32_t rootDeviceIndex, AllocationType allocType) override { return nullptr; };
|
||||
AllocationStatus populateOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override { return AllocationStatus::Success; };
|
||||
void cleanOsHandles(OsHandleStorage &handleStorage, uint32_t rootDeviceIndex) override{};
|
||||
void freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation) override{};
|
||||
|
||||
@@ -1358,14 +1358,6 @@ TEST(OsAgnosticMemoryManager, givenDefaultMemoryManagerWhenCreateGraphicsAllocat
|
||||
memoryManager.freeGraphicsMemory(sharedAllocation);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenCreateAllocationFromNtHandleIsCalledThenReturnNullptr) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
OsAgnosticMemoryManager::ExtendedOsHandleData osHandleData{(void *)1};
|
||||
auto graphicsAllocation = memoryManager.createGraphicsAllocationFromNTHandle(osHandleData, 0, AllocationType::sharedImage);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
}
|
||||
|
||||
TEST(OsAgnosticMemoryManager, givenMemoryManagerWhenLockUnlockCalledThenReturnCpuPtr) {
|
||||
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
|
||||
OsAgnosticMemoryManager memoryManager(executionEnvironment);
|
||||
|
||||
@@ -2304,12 +2304,6 @@ TEST_F(DrmMemoryManagerTest, givenTwoGraphicsAllocationsThatDoesnShareTheSameBuf
|
||||
memoryManager->freeGraphicsMemory(graphicsAllocation2);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerWhenCreateAllocationFromNtHandleIsCalledThenReturnNullptr) {
|
||||
TestedDrmMemoryManager::ExtendedOsHandleData osHandleData{1u};
|
||||
auto graphicsAllocation = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, 0, AllocationType::sharedImage);
|
||||
EXPECT_EQ(nullptr, graphicsAllocation);
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledThenReturnPtr) {
|
||||
mock->ioctlExpected.gemUserptr = 1;
|
||||
mock->ioctlExpected.gemSetDomain = 1;
|
||||
|
||||
@@ -522,7 +522,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandlesWhenCreateGraphicsAllocation
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::sharedImage, false, {});
|
||||
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
WddmMemoryManager::ExtendedOsHandleData osHandleData{ALLOCATION_HANDLE, i};
|
||||
WddmMemoryManager::OsHandleData osHandleData{ALLOCATION_HANDLE, i};
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, true, nullptr);
|
||||
auto wddmAllocation = (WddmAllocation *)graphicsAllocation;
|
||||
@@ -970,7 +970,7 @@ NTSTATUS APIENTRY queryResourceInfoMock(D3DKMT_QUERYRESOURCEINFO *pData) {
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
|
||||
MockMemoryManager::ExtendedOsHandleData osHandleData{static_cast<uint64_t>(0ull)};
|
||||
MockMemoryManager::OsHandleData osHandleData{static_cast<uint64_t>(0ull)};
|
||||
WddmAllocation *alloc = nullptr;
|
||||
|
||||
gdi->queryResourceInfo = reinterpret_cast<PFND3DKMT_QUERYRESOURCEINFO>(queryResourceInfoMock);
|
||||
|
||||
@@ -972,7 +972,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSharedHandleWhenCreateGraphicsAllocatio
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocationFromHandleIsCalledThenCorrectAllocationTypeIsSet) {
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, executionEnvironment));
|
||||
MockMemoryManager::ExtendedOsHandleData osHandleData{1u};
|
||||
MockMemoryManager::OsHandleData osHandleData{1u};
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
GmmRequirements gmmRequirements{};
|
||||
gmmRequirements.allowLargePages = true;
|
||||
@@ -2626,7 +2626,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationsAreReturned) {
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIsCalledThenNonNullGraphicsAllocationsAreReturned) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
GmmRequirements gmmRequirements{};
|
||||
gmmRequirements.allowLargePages = true;
|
||||
@@ -2637,8 +2637,9 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
setSizesFcn(gmmPtrArray, 2u, 1024u, 1u);
|
||||
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
MockWddmMemoryManager::ExtendedOsHandleData osHandleData{1u, i};
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, 0, AllocationType::sharedImage);
|
||||
MockWddmMemoryManager::OsHandleData osHandleData{NT_ALLOCATION_HANDLE, i};
|
||||
AllocationProperties properties(0, false, 0u, AllocationType::sharedImage, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, false, nullptr);
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(NT_RESOURCE_HANDLE, wddmAlloc->getResourceHandle());
|
||||
@@ -2654,7 +2655,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledWithUmKmDataTranslatorEnabledThenNonNullGraphicsAllocationIsReturned) {
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIsCalledWithUmKmDataTranslatorEnabledThenNonNullGraphicsAllocationIsReturned) {
|
||||
struct MockUmKmDataTranslator : UmKmDataTranslator {
|
||||
using UmKmDataTranslator::isEnabled;
|
||||
};
|
||||
@@ -2676,8 +2677,9 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCall
|
||||
void *gmmPtrArray[]{gmm->gmmResourceInfo.get()};
|
||||
setSizesFcn(gmmPtrArray, 1u, 1024u, 1u);
|
||||
|
||||
MockWddmMemoryManager::ExtendedOsHandleData osHandleData{1u};
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(osHandleData, 0, AllocationType::sharedImage);
|
||||
MockWddmMemoryManager::OsHandleData osHandleData{NT_ALLOCATION_HANDLE};
|
||||
AllocationProperties properties(0, false, 0u, AllocationType::sharedImage, false, 0);
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandleData, properties, false, false, false, nullptr);
|
||||
auto wddmAlloc = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
EXPECT_EQ(NT_RESOURCE_HANDLE, wddmAlloc->getResourceHandle());
|
||||
|
||||
Reference in New Issue
Block a user