Move static methods from Gmm to new GmmHelper class

Change-Id: I84fbe94f0e1072324164086b456c71a46ae5040c
This commit is contained in:
Dunajski, Bartosz
2018-06-21 11:36:47 +02:00
committed by sys_ocldev
parent a95cca71e4
commit e18e9fb94e
54 changed files with 563 additions and 477 deletions

View File

@@ -1858,7 +1858,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndUnifiedAuxCapableAllocation
mock->ioctl_expected.gemWait = 1;
mock->ioctl_expected.gemClose = 1;
auto gmm = Gmm::create(nullptr, 123, false);
auto gmm = GmmHelper::create(nullptr, 123, false);
auto allocation = memoryManager->allocateGraphicsMemory(123, 123);
allocation->gmm = gmm;

View File

@@ -22,6 +22,8 @@
#include "unit_tests/os_interface/windows/wddm_fixture.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/hw_info.h"
#include "runtime/helpers/options.h"
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
@@ -105,7 +107,7 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerWhenUpdateAuxTableCalledThenReturnF
wddm->resetPageTableManager(nullptr);
EXPECT_EQ(nullptr, wddm->getPageTableManager());
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
auto mockGmmRes = reinterpret_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
mockGmmRes->setUnifiedAuxTranslationCapable();
@@ -301,8 +303,8 @@ HWTEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAd
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), false, false, true);
EXPECT_TRUE(ret);
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
EXPECT_GE(allocation.gpuPtr, cannonizedHeapBase);
EXPECT_LE(allocation.gpuPtr, cannonizedHeapEnd);
@@ -386,7 +388,7 @@ HWTEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
EXPECT_TRUE(ret);
EXPECT_NE(0u, allocation.gpuPtr);
EXPECT_EQ(allocation.gpuPtr, Gmm::canonize(allocation.gpuPtr));
EXPECT_EQ(allocation.gpuPtr, GmmHelper::canonize(allocation.gpuPtr));
delete gmm;
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
@@ -466,7 +468,7 @@ TEST_F(Wddm20Tests, GetCpuGpuTime) {
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status);
@@ -504,7 +506,7 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocatio
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
void *pSysMem = (void *)0x1000;
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
EXPECT_EQ(0u, status);

View File

@@ -20,6 +20,8 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/os_interface/windows/wddm/wddm.h"
#include "runtime/os_interface/windows/wddm_allocation.h"
#include "unit_tests/os_interface/windows/mock_kmdaf_listener.h"
@@ -93,7 +95,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafList
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
allocation.handle = ALLOCATION_HANDLE;
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
allocation.gmm = gmm.get();
wddmWithKmDafMock->mapGpuVirtualAddressImpl(allocation.gmm, allocation.handle, allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), allocation.gpuPtr, false, false, false);
@@ -102,7 +104,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmD
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
EXPECT_EQ(allocation.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
EXPECT_EQ(Gmm::decanonize(allocation.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
EXPECT_EQ(GmmHelper::decanonize(allocation.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
}
@@ -148,7 +150,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotif
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
allocation.gmm = gmm.get();
wddmWithKmDafMock->createAllocation(&allocation);
@@ -162,7 +164,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafLi
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr);
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
allocation.gmm = gmm.get();
wddmWithKmDafMock->createAllocation64k(&allocation);
@@ -177,7 +179,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDaf
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
OsHandleStorage storage;
OsHandle osHandle = {0};
auto gmm = std::unique_ptr<Gmm>(Gmm::create(nullptr, 1, false));
auto gmm = std::unique_ptr<Gmm>(GmmHelper::create(nullptr, 1, false));
storage.fragmentStorageData[0].osHandleStorage = &osHandle;
storage.fragmentStorageData[0].fragmentSize = 100;
storage.fragmentStorageData[0].osHandleStorage->gmm = gmm.get();
@@ -194,7 +196,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalle
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
EXPECT_EQ(wddmWithKmDafMock->getDevice(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hDevice);
EXPECT_EQ(osHandle.handle, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAllocation);
EXPECT_EQ(Gmm::decanonize(osHandle.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
EXPECT_EQ(GmmHelper::decanonize(osHandle.gpuPtr), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.GpuVirtualAddress);
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
}

View File

@@ -20,6 +20,7 @@
* OTHER DEALINGS IN THE SOFTWARE.
*/
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/gmm_helper.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/mem_obj/buffer.h"
@@ -151,7 +152,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
@@ -168,7 +169,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCa
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromNTHandle(reinterpret_cast<void *>(1));
@@ -202,7 +203,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllo
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true);
@@ -213,7 +214,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllo
EXPECT_TRUE(gpuAllocation->is32BitAllocation);
uint64_t base = memoryManager->allocator32Bit->getBase();
EXPECT_EQ(Gmm::canonize(base), gpuAllocation->gpuBaseAddress);
EXPECT_EQ(GmmHelper::canonize(base), gpuAllocation->gpuBaseAddress);
}
memoryManager->freeGraphicsMemory(gpuAllocation);
@@ -225,7 +226,7 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32B
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
memoryManager->setForce32BitAllocations(true);
@@ -248,7 +249,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHan
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, 4096u, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto gpuAllocation = (WddmAllocation *)memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
@@ -270,7 +271,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShar
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, size, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, size, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
auto *gpuAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(osHandle, false);
@@ -285,7 +286,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
auto size = 4096u;
void *pSysMem = reinterpret_cast<void *>(0x1000);
std::unique_ptr<Gmm> gmm(Gmm::create(pSysMem, size, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(pSysMem, size, false));
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
wddm->failOpenSharedHandle = true;
@@ -562,8 +563,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, AllocationOrigin::EXTERNAL_ALLOCATION);
ASSERT_NE(nullptr, gpuAllocation);
EXPECT_LE(Gmm::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
EXPECT_GT(Gmm::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
EXPECT_LE(GmmHelper::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
memoryManager->freeGraphicsMemory(gpuAllocation);
@@ -580,8 +581,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotD
EXPECT_EQ(alignSizeWholePage(misalignedPtr, misalignedSize), gpuAllocation->getUnderlyingBufferSize());
EXPECT_LE(Gmm::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
EXPECT_GT(Gmm::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
EXPECT_LE(GmmHelper::canonize(wddm->getHeap32Base()), gpuAllocation->getGpuAddress());
EXPECT_GT(GmmHelper::canonize(wddm->getHeap32Base()) + wddm->getHeap32Size() - 1, gpuAllocation->getGpuAddress());
EXPECT_EQ(0u, gpuAllocation->fragmentsStorage.fragmentCount);
@@ -598,7 +599,7 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress)
ASSERT_NE(nullptr, gpuAllocation);
uint64_t cannonizedAddress = Gmm::canonize(wddm->getHeap32Base());
uint64_t cannonizedAddress = GmmHelper::canonize(wddm->getHeap32Base());
EXPECT_EQ(cannonizedAddress, gpuAllocation->gpuBaseAddress);
memoryManager->freeGraphicsMemory(gpuAllocation);
@@ -614,7 +615,7 @@ HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocation
storage.fragmentStorageData[0].osHandleStorage->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[0].freeTheFragment = true;
storage.fragmentStorageData[0].osHandleStorage->gmm = Gmm::create(pSysMem, 4096u, false);
storage.fragmentStorageData[0].osHandleStorage->gmm = GmmHelper::create(pSysMem, 4096u, false);
storage.fragmentStorageData[1].osHandleStorage = new OsHandle;
storage.fragmentStorageData[1].osHandleStorage->handle = ALLOCATION_HANDLE;
@@ -625,7 +626,7 @@ HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocation
storage.fragmentStorageData[2].osHandleStorage = new OsHandle;
storage.fragmentStorageData[2].osHandleStorage->handle = ALLOCATION_HANDLE;
storage.fragmentStorageData[2].freeTheFragment = true;
storage.fragmentStorageData[2].osHandleStorage->gmm = Gmm::create(pSysMem, 4096u, false);
storage.fragmentStorageData[2].osHandleStorage->gmm = GmmHelper::create(pSysMem, 4096u, false);
storage.fragmentStorageData[2].residency = new ResidencyData;
memoryManager->cleanOsHandles(storage);
@@ -675,7 +676,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGp
SetUpMm<FamilyType>();
void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
memoryManager->setDeferredDeleter(nullptr);
setMapGpuVaFailConfigFcn(0, 1);
@@ -690,7 +691,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstM
SetUpMm<FamilyType>();
void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter);
@@ -708,7 +709,7 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstA
SetUpMm<FamilyType>();
void *ptr = reinterpret_cast<void *>(0x1000);
size_t size = 0x1000;
std::unique_ptr<Gmm> gmm(Gmm::create(ptr, size, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(ptr, size, false));
MockDeferredDeleter *deleter = new MockDeferredDeleter;
memoryManager->setDeferredDeleter(deleter);
@@ -725,12 +726,12 @@ HWTEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocat
SetUpMm<FamilyType>();
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION));
ASSERT_NE(nullptr, wddmAllocation);
EXPECT_EQ(wddmAllocation->gpuBaseAddress, Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
EXPECT_EQ(wddmAllocation->gpuBaseAddress, GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
EXPECT_NE(nullptr, wddmAllocation->getUnderlyingBuffer());
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
@@ -745,12 +746,12 @@ HWTEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationW
auto ptr = reinterpret_cast<void *>(0x1000000);
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, ptr, AllocationOrigin::INTERNAL_ALLOCATION));
ASSERT_NE(nullptr, wddmAllocation);
EXPECT_EQ(wddmAllocation->gpuBaseAddress, Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
EXPECT_EQ(wddmAllocation->gpuBaseAddress, GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
EXPECT_EQ(ptr, wddmAllocation->getUnderlyingBuffer());
EXPECT_EQ(4096u, wddmAllocation->getUnderlyingBufferSize());
EXPECT_NE((uint64_t)wddmAllocation->getUnderlyingBuffer(), wddmAllocation->getGpuAddress());
auto cannonizedHeapBase = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = Gmm::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
auto cannonizedHeapEnd = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Limit);
EXPECT_GE(wddmAllocation->getGpuAddress(), cannonizedHeapBase);
EXPECT_LE(wddmAllocation->getGpuAddress(), cannonizedHeapEnd);
@@ -1953,7 +1954,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledTh
}
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
gmm->isRenderCompressed = true;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm;
@@ -1964,7 +1965,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
GMM_DDI_UPDATEAUXTABLE givenDdiUpdateAuxTable = {};
GMM_DDI_UPDATEAUXTABLE expectedDdiUpdateAuxTable = {};
expectedDdiUpdateAuxTable.BaseGpuVA = Gmm::canonize(wddm.getGfxPartition().Standard.Base);
expectedDdiUpdateAuxTable.BaseGpuVA = GmmHelper::canonize(wddm.getGfxPartition().Standard.Base);
expectedDdiUpdateAuxTable.BaseResInfo = gmm->gmmResourceInfo->peekHandle();
expectedDdiUpdateAuxTable.DoNotWait = true;
expectedDdiUpdateAuxTable.Map = true;
@@ -1973,7 +1974,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
ASSERT_TRUE(result);
EXPECT_EQ(Gmm::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
EXPECT_EQ(GmmHelper::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &givenDdiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0);
}
@@ -2021,7 +2022,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleas
}
HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
gmm->isRenderCompressed = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm;
@@ -2037,7 +2038,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMapped
}
HWTEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
std::unique_ptr<Gmm> gmm(Gmm::create(reinterpret_cast<void *>(123), 4096u, false));
std::unique_ptr<Gmm> gmm(GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false));
gmm->isRenderCompressed = false;
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
WddmMock wddm;
@@ -2056,7 +2057,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUn
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
wddm->resetPageTableManager(mockMngr);
auto myGmm = Gmm::create(reinterpret_cast<void *>(123), 4096u, false);
auto myGmm = GmmHelper::create(reinterpret_cast<void *>(123), 4096u, false);
myGmm->isRenderCompressed = false;
myGmm->gmmResourceInfo->getResourceFlags()->Info.RenderCompressed = 1;