mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-22 19:29:06 +08:00
Gmm construction cleanup
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
82ad3d61be
commit
c88fce0def
@@ -912,7 +912,7 @@ HWTEST2_F(DrmMemoryManagerLocalMemoryTest, givenGraphicsAllocationInDevicePoolIs
|
||||
|
||||
auto gmm = allocation->getDefaultGmm();
|
||||
EXPECT_NE(nullptr, gmm);
|
||||
EXPECT_FALSE(gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
auto gpuAddress = allocation->getGpuAddress();
|
||||
auto sizeAlignedTo64KB = alignUp(allocData.imgInfo->size, MemoryConstants::pageSize64k);
|
||||
|
||||
@@ -271,7 +271,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenSmallSizeAndGpuAddress
|
||||
|
||||
mock->reset();
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_expected.execbuffer2 = 0; //pinBB not called
|
||||
mock->ioctl_expected.execbuffer2 = 0; // pinBB not called
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
@@ -284,7 +284,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenSmallSizeAndGpuAddress
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, givenInjectedFailuresWhenGraphicsMemoryWithGpuVaIsAllocatedThenNullptrIsReturned) {
|
||||
mock->ioctl_expected.total = -1; //don't care
|
||||
mock->ioctl_expected.total = -1; // don't care
|
||||
|
||||
auto memoryManager = std::make_unique<TestedDrmMemoryManager>(false, true, false, *executionEnvironment);
|
||||
auto osContext = device->getDefaultEngine().osContext;
|
||||
@@ -316,7 +316,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenSizeExceedingThreshold
|
||||
|
||||
mock->reset();
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_expected.execbuffer2 = 1; //pinBB called
|
||||
mock->ioctl_expected.execbuffer2 = 1; // pinBB called
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
@@ -331,7 +331,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenSizeExceedingThreshold
|
||||
|
||||
mock->reset();
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_expected.execbuffer2 = 0; //pinBB not called
|
||||
mock->ioctl_expected.execbuffer2 = 0; // pinBB not called
|
||||
|
||||
properties.gpuAddress = 0x5000;
|
||||
|
||||
@@ -355,7 +355,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDisabledForcePinAndSiz
|
||||
|
||||
mock->reset();
|
||||
mock->ioctl_expected.gemUserptr = 1;
|
||||
mock->ioctl_expected.execbuffer2 = 0; //pinBB not called
|
||||
mock->ioctl_expected.execbuffer2 = 0; // pinBB not called
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(properties);
|
||||
|
||||
@@ -713,7 +713,7 @@ TEST_F(DrmMemoryManagerTest, GivenAllocationWhenFreeingThenSucceeds) {
|
||||
}
|
||||
|
||||
TEST_F(DrmMemoryManagerTest, GivenInjectedFailureWhenAllocatingThenAllocationFails) {
|
||||
mock->ioctl_expected.total = -1; //don't care
|
||||
mock->ioctl_expected.total = -1; // don't care
|
||||
|
||||
InjectedFunction method = [this](size_t failureIndex) {
|
||||
auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize});
|
||||
@@ -1040,7 +1040,7 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenEnabledHostMemoryValid
|
||||
mock->testIoctls();
|
||||
mock->ioctl_res_ext = &mock->NONE;
|
||||
|
||||
//make sure that partition is free
|
||||
// make sure that partition is free
|
||||
size_t dummySize2 = 13u;
|
||||
auto allocatedPointer2 = gfxPartition->heapAllocate(HeapIndex::HEAP_STANDARD, dummySize2);
|
||||
EXPECT_EQ(allocatedPointer2, allocatedPointer);
|
||||
@@ -2396,7 +2396,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCrea
|
||||
AllocationProperties properties(rootDeviceIndex, false, MemoryConstants::pageSize, AllocationType::SHARED_BUFFER, false, mockDeviceBitfield);
|
||||
|
||||
graphicsAllocations[i] = memoryManager->createGraphicsAllocationFromSharedHandle(handles[i], properties, false, false);
|
||||
//Clang-tidy false positive WA
|
||||
// Clang-tidy false positive WA
|
||||
if (graphicsAllocations[i] == nullptr) {
|
||||
ASSERT_FALSE(true);
|
||||
continue;
|
||||
@@ -2419,7 +2419,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndThreeOsHandlesWhenReuseCrea
|
||||
}
|
||||
|
||||
for (const auto &it : graphicsAllocations) {
|
||||
//Clang-tidy false positive WA
|
||||
// Clang-tidy false positive WA
|
||||
if (it != nullptr)
|
||||
memoryManager->freeGraphicsMemory(it);
|
||||
}
|
||||
@@ -2593,7 +2593,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
||||
auto ptr = memoryManager->lockResource(allocation);
|
||||
EXPECT_EQ(allocation->getUnderlyingBuffer(), ptr);
|
||||
|
||||
//check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
// check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(allocation);
|
||||
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->setDomainHandle);
|
||||
EXPECT_EQ((uint32_t)I915_GEM_DOMAIN_CPU, mock->setDomainReadDomains);
|
||||
@@ -2634,14 +2634,14 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenLockUnlockIsCalledOnAlloca
|
||||
auto drmAllocation = static_cast<DrmAllocation *>(allocation);
|
||||
EXPECT_NE(nullptr, drmAllocation->getBO()->peekLockedAddress());
|
||||
|
||||
//check DRM_IOCTL_I915_GEM_MMAP input params
|
||||
// check DRM_IOCTL_I915_GEM_MMAP input params
|
||||
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->mmapHandle);
|
||||
EXPECT_EQ(0u, mock->mmapPad);
|
||||
EXPECT_EQ(0u, mock->mmapOffset);
|
||||
EXPECT_EQ(drmAllocation->getBO()->peekSize(), mock->mmapSize);
|
||||
EXPECT_EQ(0u, mock->mmapFlags);
|
||||
|
||||
//check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
// check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
EXPECT_EQ((uint32_t)drmAllocation->getBO()->peekHandle(), mock->setDomainHandle);
|
||||
EXPECT_EQ((uint32_t)I915_GEM_DOMAIN_CPU, mock->setDomainReadDomains);
|
||||
EXPECT_EQ(0u, mock->setDomainWriteDomain);
|
||||
@@ -2763,7 +2763,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenSetDomainCpuIsCalledOnAllo
|
||||
auto success = memoryManager->setDomainCpu(drmAllocation, true);
|
||||
EXPECT_TRUE(success);
|
||||
|
||||
//check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
// check DRM_IOCTL_I915_GEM_SET_DOMAIN input params
|
||||
EXPECT_EQ((uint32_t)drmAllocation.getBO()->peekHandle(), mock->setDomainHandle);
|
||||
EXPECT_EQ((uint32_t)I915_GEM_DOMAIN_CPU, mock->setDomainReadDomains);
|
||||
EXPECT_EQ((uint32_t)I915_GEM_DOMAIN_CPU, mock->setDomainWriteDomain);
|
||||
@@ -2774,7 +2774,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
|
||||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
|
||||
auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, false);
|
||||
auto gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 123, 0, false, false, {}, true);
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, MemoryConstants::pageSize});
|
||||
allocation->setDefaultGmm(gmm);
|
||||
|
||||
@@ -2799,10 +2799,10 @@ TEST_F(DrmMemoryManagerTest, given32BitAllocatorWithHeapAllocatorWhenLargerFragm
|
||||
size_t smallAllocationSize = MemoryConstants::pageSize;
|
||||
memoryManager->getGfxPartition(rootDeviceIndex)->heapAllocate(HeapIndex::HEAP_EXTERNAL, smallAllocationSize);
|
||||
|
||||
//now free first allocation , this will move it to chunks
|
||||
// now free first allocation , this will move it to chunks
|
||||
memoryManager->getGfxPartition(rootDeviceIndex)->heapFree(HeapIndex::HEAP_EXTERNAL, ptr, allocationSize);
|
||||
|
||||
//now ask for 3 pages, this will give ptr from chunks
|
||||
// now ask for 3 pages, this will give ptr from chunks
|
||||
size_t pages3size = 3 * MemoryConstants::pageSize;
|
||||
|
||||
void *host_ptr = reinterpret_cast<void *>(0x1000);
|
||||
@@ -2844,11 +2844,11 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenItIsR
|
||||
mock->ioctl_expected.gemUserptr = 2;
|
||||
mock->ioctl_expected.gemWait = 2;
|
||||
mock->ioctl_expected.gemClose = 2;
|
||||
//first let's create normal buffer
|
||||
// first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
// buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
|
||||
auto bufferWithPaddingSize = 8192u;
|
||||
@@ -3000,11 +3000,11 @@ TEST_F(DrmMemoryManagerTest, givenMemoryManagerSupportingVirutalPaddingWhenAlloc
|
||||
this->ioctlResExt = {mock->ioctl_cnt.total + 1, -1};
|
||||
mock->ioctl_res_ext = &ioctlResExt;
|
||||
|
||||
//first let's create normal buffer
|
||||
// first let's create normal buffer
|
||||
auto bufferSize = MemoryConstants::pageSize;
|
||||
auto buffer = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{rootDeviceIndex, bufferSize});
|
||||
|
||||
//buffer should have size 16
|
||||
// buffer should have size 16
|
||||
EXPECT_EQ(bufferSize, buffer->getUnderlyingBufferSize());
|
||||
|
||||
auto bufferWithPaddingSize = 8192u;
|
||||
@@ -3098,14 +3098,14 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDefaultDrmMemoryManage
|
||||
#include <iostream>
|
||||
|
||||
TEST(MmapFlags, givenVariousMmapParametersWhenGettingTimeDeltaThenTimeIsPrinted) {
|
||||
//disabling this test in CI.
|
||||
// disabling this test in CI.
|
||||
return;
|
||||
typedef std::chrono::high_resolution_clock Time;
|
||||
typedef std::chrono::nanoseconds ns;
|
||||
typedef std::chrono::duration<double> fsec;
|
||||
|
||||
std::vector<void *> pointersForFree;
|
||||
//allocate 4GB.
|
||||
// allocate 4GB.
|
||||
auto size = 4 * GB;
|
||||
unsigned int maxTime = 0;
|
||||
unsigned int minTime = -1;
|
||||
@@ -5415,7 +5415,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUs
|
||||
|
||||
auto gmm = allocation->getDefaultGmm();
|
||||
EXPECT_NE(nullptr, gmm);
|
||||
EXPECT_FALSE(gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
EXPECT_EQ(RESOURCE_BUFFER, gmm->resourceParams.Type);
|
||||
EXPECT_EQ(sizeAligned, gmm->resourceParams.BaseWidth64);
|
||||
@@ -5477,7 +5477,7 @@ TEST_F(DrmMemoryManagerWithLocalMemoryAndExplicitExpectationsTest, givenNotSetUs
|
||||
|
||||
auto gmm = allocation->getDefaultGmm();
|
||||
EXPECT_NE(nullptr, gmm);
|
||||
EXPECT_FALSE(gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
auto gpuAddress = allocation->getGpuAddress();
|
||||
auto sizeAligned = alignUp(allocData.imgInfo->size, MemoryConstants::pageSize64k);
|
||||
|
||||
@@ -56,7 +56,7 @@ Gmm *getGmm(void *ptr, size_t size, GmmClientContext *clientContext) {
|
||||
size_t alignedSize = alignSizeWholePage(ptr, size);
|
||||
void *alignedPtr = alignUp(ptr, 4096);
|
||||
|
||||
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, false);
|
||||
Gmm *gmm = new Gmm(clientContext, alignedPtr, alignedSize, 0, false, false, {}, true);
|
||||
EXPECT_NE(gmm->gmmResourceInfo.get(), nullptr);
|
||||
return gmm;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ TEST_F(Wddm20Tests, GivenExisitingContextWhenInitializingWddmThenCreateContextRe
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenNullPageTableManagerAndCompressedResourceWhenMappingGpuVaThenDontUpdateAuxTable) {
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(getGmmClientContext(), nullptr, 1, 0, false, false, {}, true));
|
||||
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||
mockGmmRes->setUnifiedAuxTranslationCapable();
|
||||
|
||||
@@ -497,7 +497,7 @@ TEST_F(Wddm20Tests, WhenMakingResidentAndEvictingThenReturnIsCorrect) {
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@@ -534,7 +534,7 @@ TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationF
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
@@ -830,7 +830,7 @@ TEST_F(Wddm20Tests, whenCreateAllocation64kFailsThenReturnFalse) {
|
||||
gdi->createAllocation2 = FailingCreateAllocation::mockCreateAllocation2;
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), fakePtr, 100, 0, false, false, StorageInfo{}, true);
|
||||
WddmAllocation allocation(0, AllocationType::UNKNOWN, fakePtr, 100, nullptr, MemoryPool::MemoryNull, 0u, 1u);
|
||||
allocation.setDefaultGmm(gmm.get());
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListen
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
uint64_t gpuPtr = 0u;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
|
||||
wddmWithKmDafMock->mapGpuVirtualAddress(gmm.get(), ALLOCATION_HANDLE, wddmWithKmDafMock->getGfxPartition().Standard.Base,
|
||||
wddmWithKmDafMock->getGfxPartition().Standard.Limit, 0u, gpuPtr);
|
||||
@@ -137,7 +137,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyE
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
auto handle = 0u;
|
||||
auto resourceHandle = 0u;
|
||||
auto ptr = reinterpret_cast<void *>(0x10000);
|
||||
@@ -152,7 +152,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafList
|
||||
}
|
||||
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, StorageInfo{}, true);
|
||||
auto handle = 0u;
|
||||
|
||||
wddmWithKmDafMock->createAllocation(gmm.get(), handle);
|
||||
@@ -167,7 +167,7 @@ TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafLi
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
OsHandleStorage storage;
|
||||
OsHandleWin osHandle;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false));
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 1, 0, false, false, {}, true));
|
||||
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
|
||||
storage.fragmentStorageData[0].fragmentSize = 100;
|
||||
static_cast<OsHandleWin *>(storage.fragmentStorageData[0].osHandleStorage)->gmm = gmm.get();
|
||||
|
||||
@@ -44,7 +44,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNotSetUseSystemMemoryWhenGraphicsAlloca
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -65,12 +65,13 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateInDevice
|
||||
allocData.size = MemoryConstants::pageSize;
|
||||
allocData.flags.allocateMemory = true;
|
||||
allocData.flags.shareable = true;
|
||||
allocData.storageInfo.memoryBanks = 2;
|
||||
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInDevicePool(allocData, status);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
@@ -96,7 +97,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenShareableAllocationWhenAllocateGraphics
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryInPreferredPool(properties, nullptr);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_NE(allocation->peekInternalHandle(memoryManager.get()), 0u);
|
||||
|
||||
EXPECT_EQ(1u, allocation->getDefaultGmm()->resourceParams.Flags.Info.LocalOnly);
|
||||
@@ -121,7 +122,7 @@ struct WddmMemoryManagerDevicePoolAlignmentTests : WddmMemoryManagerSimpleTest {
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_EQ(alignUp(allocationSize, expectedAlignment), allocation->getUnderlyingBufferSize());
|
||||
EXPECT_EQ(expectedAlignment, allocation->getDefaultGmm()->resourceParams.BaseAlignment);
|
||||
|
||||
@@ -329,7 +330,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenEnabledLocalMemoryAndAllowed32BitWhen32
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -517,7 +518,7 @@ TEST_F(WddmMemoryManagerSimpleTestWithLocalMemory, givenLocalMemoryAndImageOrSha
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryManager::AllocationStatus::Success, status);
|
||||
EXPECT_EQ(MemoryPool::LocalMemory, allocation->getMemoryPool());
|
||||
EXPECT_FALSE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_TRUE(allocData.imgInfo->useLocalMemory);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -660,7 +661,7 @@ struct WddmMemoryManagerSimple64BitTest : public WddmMemoryManagerSimpleTest {
|
||||
uint64_t totalSizeFromGmms = 0u;
|
||||
for (uint32_t gmmId = 0u; gmmId < allocation->getNumGmms(); ++gmmId) {
|
||||
Gmm *gmm = allocation->getGmm(gmmId);
|
||||
EXPECT_FALSE(gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, gmm->resourceParams.BaseAlignment);
|
||||
EXPECT_TRUE(isAligned(gmm->resourceParams.BaseWidth64, gmm->resourceParams.BaseAlignment));
|
||||
|
||||
|
||||
@@ -180,7 +180,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemory
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@@ -207,7 +208,10 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesEnabledWhenAl
|
||||
auto allocation = memoryManager->allocateGraphicsMemory64kb(allocationData);
|
||||
EXPECT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System64KBPages, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
@@ -246,7 +250,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocateGraphicsMemory
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, allocation->getMemoryPool());
|
||||
for (size_t i = 0; i < allocation->fragmentsStorage.fragmentCount; i++) {
|
||||
EXPECT_TRUE(static_cast<OsHandleWin *>(allocation->fragmentsStorage.fragmentStorageData[i].osHandleStorage)->gmm->useSystemMemoryPool);
|
||||
EXPECT_EQ(1u, static_cast<OsHandleWin *>(allocation->fragmentsStorage.fragmentStorageData[i].osHandleStorage)->gmm->resourceParams.Flags.Info.NonLocalOnly);
|
||||
}
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -260,7 +264,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenAllocate32BitGraphicsM
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPagesWith32BitGpuAddressing, allocation->getMemoryPool());
|
||||
EXPECT_TRUE(allocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
allocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
@@ -275,7 +280,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWith64KBPagesDisabledWhenA
|
||||
auto svmAllocation = memoryManager->allocateGraphicsMemoryWithProperties({csr->getRootDeviceIndex(), size, AllocationType::SVM_ZERO_COPY, mockDeviceBitfield});
|
||||
EXPECT_NE(nullptr, svmAllocation);
|
||||
EXPECT_EQ(MemoryPool::System4KBPages, svmAllocation->getMemoryPool());
|
||||
EXPECT_TRUE(svmAllocation->getDefaultGmm()->useSystemMemoryPool);
|
||||
EXPECT_EQ(executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->featureTable.flags.ftrLocalMemory,
|
||||
svmAllocation->getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly);
|
||||
memoryManager->freeGraphicsMemory(svmAllocation);
|
||||
}
|
||||
|
||||
@@ -296,7 +302,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -316,7 +322,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenAllocationPropertiesWhenCreateAllocatio
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -342,7 +348,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenCreateAllocationFromHandleAndMapCallFail
|
||||
memoryManager.reset(new MockWddmMemoryManager(false, false, *executionEnvironment));
|
||||
auto osHandle = 1u;
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false);
|
||||
auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, StorageInfo{}, true);
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -601,7 +607,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, mockDeviceBitfield);
|
||||
@@ -617,7 +623,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIs
|
||||
|
||||
TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestroyedThenDestroyAllocationFromGdiIsNotInvoked) {
|
||||
gdi->getQueryResourceInfoArgOut().NumAllocations = 1;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), nullptr, 0, 0, false, false, {}, true));
|
||||
|
||||
D3DDDI_OPENALLOCATIONINFO allocationInfo;
|
||||
allocationInfo.pPrivateDriverData = gmm->gmmResourceInfo->peekHandle();
|
||||
@@ -644,7 +650,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenAllocationCreatedFromSharedHandleIsDestr
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1), 0, AllocationType::SHARED_IMAGE);
|
||||
@@ -676,7 +682,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndRequireSpecificBitness
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@@ -699,7 +705,7 @@ TEST_F(WddmMemoryManagerTest, GivenForce32bitAddressingAndNotRequiredSpecificBit
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
memoryManager->setForce32BitAllocations(true);
|
||||
@@ -721,7 +727,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandl
|
||||
auto osHandle = 1u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, 4096u, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@@ -743,7 +749,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShared
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
AllocationProperties properties(0, false, size, AllocationType::SHARED_BUFFER, false, false, 0);
|
||||
@@ -819,7 +825,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFa
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, size, 0, false, false, {}, true));
|
||||
setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
|
||||
wddm->failOpenSharedHandle = true;
|
||||
@@ -1148,7 +1154,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
|
||||
osHandle0->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[0].freeTheFragment = true;
|
||||
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false);
|
||||
osHandle0->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true);
|
||||
|
||||
storage.fragmentStorageData[1].osHandleStorage = osHandle1;
|
||||
osHandle1->handle = ALLOCATION_HANDLE;
|
||||
@@ -1159,7 +1165,7 @@ TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsT
|
||||
storage.fragmentStorageData[2].osHandleStorage = osHandle2;
|
||||
osHandle2->handle = ALLOCATION_HANDLE;
|
||||
storage.fragmentStorageData[2].freeTheFragment = true;
|
||||
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false);
|
||||
osHandle2->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), pSysMem, 4096u, 0, false, false, {}, true);
|
||||
storage.fragmentStorageData[2].residency = new ResidencyData(maxOsContextCount);
|
||||
|
||||
memoryManager->cleanOsHandles(storage, 0);
|
||||
@@ -1207,7 +1213,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestriction
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
memoryManager->setDeferredDeleter(nullptr);
|
||||
setMapGpuVaFailConfigFcn(0, 1);
|
||||
@@ -1221,7 +1227,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuV
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x10000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@@ -1237,7 +1243,7 @@ TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMap
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true));
|
||||
|
||||
MockDeferredDeleter *deleter = new MockDeferredDeleter;
|
||||
memoryManager->setDeferredDeleter(deleter);
|
||||
@@ -1407,7 +1413,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false);
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@@ -1445,7 +1451,7 @@ TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocati
|
||||
handleStorage.fragmentStorageData[0].residency = new ResidencyData(maxOsContextCount);
|
||||
handleStorage.fragmentStorageData[0].freeTheFragment = true;
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get();
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false);
|
||||
osHandle->gmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), ptr, size, 0, false, false, {}, true);
|
||||
handleStorage.fragmentCount = 1;
|
||||
|
||||
FragmentStorage fragment = {};
|
||||
@@ -1877,7 +1883,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
@@ -1909,7 +1915,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedAllocationWhenMappedGpuVaAndPag
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*executionEnvironment->rootDeviceEnvironments[1].get());
|
||||
@@ -2010,7 +2016,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenReleaseingThen
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
@@ -2036,7 +2042,7 @@ TEST_F(MockWddmMemoryManagerTest, givenNonCompressedAllocationWhenMappedGpuVaThe
|
||||
|
||||
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||
auto rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[1].get();
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false));
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true));
|
||||
gmm->isCompressionEnabled = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm(*rootDeviceEnvironment);
|
||||
@@ -2065,7 +2071,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsUnsetThenD
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true);
|
||||
myGmm->isCompressionEnabled = false;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
@@ -2102,7 +2108,7 @@ TEST_F(MockWddmMemoryManagerTest, givenCompressedFlagSetWhenInternalIsSetThenUpd
|
||||
engine.commandStreamReceiver->pageTableManager.reset(mockMngr);
|
||||
}
|
||||
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false);
|
||||
auto myGmm = new Gmm(rootDeviceEnvironment->getGmmClientContext(), reinterpret_cast<void *>(123), 4096u, 0, false, false, {}, true);
|
||||
myGmm->isCompressionEnabled = true;
|
||||
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;
|
||||
|
||||
@@ -2276,7 +2282,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenSvmCpuAllocationWhenSizeAndAlignmentPro
|
||||
EXPECT_EQ(size, allocation->getUnderlyingBufferSize());
|
||||
EXPECT_NE(nullptr, allocation->getUnderlyingBuffer());
|
||||
EXPECT_EQ(allocation->getUnderlyingBuffer(), allocation->getDriverAllocatedCpuPtr());
|
||||
//limited platforms will not use heap HeapIndex::HEAP_SVM
|
||||
// limited platforms will not use heap HeapIndex::HEAP_SVM
|
||||
if (executionEnvironment->rootDeviceEnvironments[allocation->getRootDeviceIndex()]->isFullRangeSvm()) {
|
||||
EXPECT_EQ(alignUp(allocation->getReservedAddressPtr(), size), reinterpret_cast<void *>(allocation->getGpuAddress()));
|
||||
}
|
||||
@@ -2418,7 +2424,7 @@ TEST(WddmMemoryManager, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsRet
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
//call multiple times to make sure that result is constant
|
||||
// call multiple times to make sure that result is constant
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
|
||||
Reference in New Issue
Block a user