Wddm: Use GMM allocation size during map GPU VA
Change-Id: Ie10898db7c539ce5025ab4a6d658d6e593e94c50
This commit is contained in:
parent
c19918920d
commit
a8ce3ca00a
|
@ -344,26 +344,27 @@ bool Wddm::makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFur
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::mapGpuVirtualAddress(WddmAllocation *allocation, void *cpuPtr, uint64_t size, bool allocation32bit, bool use64kbPages, bool useHeap1) {
|
bool Wddm::mapGpuVirtualAddress(WddmAllocation *allocation, void *cpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1) {
|
||||||
void *mapPtr = allocation->getReservedAddress() != nullptr ? allocation->getReservedAddress() : cpuPtr;
|
void *mapPtr = allocation->getReservedAddress() != nullptr ? allocation->getReservedAddress() : cpuPtr;
|
||||||
return mapGpuVirtualAddressImpl(allocation->gmm, allocation->handle, mapPtr, size, allocation->gpuPtr, allocation32bit, use64kbPages, useHeap1);
|
return mapGpuVirtualAddressImpl(allocation->gmm, allocation->handle, mapPtr, allocation->gpuPtr, allocation32bit, use64kbPages, useHeap1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::mapGpuVirtualAddress(AllocationStorageData *allocationStorageData, bool allocation32bit, bool use64kbPages) {
|
bool Wddm::mapGpuVirtualAddress(AllocationStorageData *allocationStorageData, bool allocation32bit, bool use64kbPages) {
|
||||||
return mapGpuVirtualAddressImpl(allocationStorageData->osHandleStorage->gmm,
|
return mapGpuVirtualAddressImpl(allocationStorageData->osHandleStorage->gmm,
|
||||||
allocationStorageData->osHandleStorage->handle,
|
allocationStorageData->osHandleStorage->handle,
|
||||||
const_cast<void *>(allocationStorageData->cpuPtr),
|
const_cast<void *>(allocationStorageData->cpuPtr),
|
||||||
allocationStorageData->fragmentSize,
|
|
||||||
allocationStorageData->osHandleStorage->gpuPtr,
|
allocationStorageData->osHandleStorage->gpuPtr,
|
||||||
allocation32bit, use64kbPages, false);
|
allocation32bit, use64kbPages, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wddm::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1) {
|
bool Wddm::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1) {
|
||||||
NTSTATUS status = STATUS_SUCCESS;
|
NTSTATUS status = STATUS_SUCCESS;
|
||||||
D3DDDI_MAPGPUVIRTUALADDRESS MapGPUVA = {0};
|
D3DDDI_MAPGPUVIRTUALADDRESS MapGPUVA = {0};
|
||||||
D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE protectionType = {{{0}}};
|
D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE protectionType = {{{0}}};
|
||||||
protectionType.Write = TRUE;
|
protectionType.Write = TRUE;
|
||||||
|
|
||||||
|
uint64_t size = static_cast<uint64_t>(gmm->gmmResourceInfo->getSizeAllocation());
|
||||||
|
|
||||||
MapGPUVA.hPagingQueue = pagingQueue;
|
MapGPUVA.hPagingQueue = pagingQueue;
|
||||||
MapGPUVA.hAllocation = handle;
|
MapGPUVA.hAllocation = handle;
|
||||||
MapGPUVA.Protection = protectionType;
|
MapGPUVA.Protection = protectionType;
|
||||||
|
|
|
@ -68,7 +68,7 @@ class Wddm {
|
||||||
|
|
||||||
MOCKABLE_VIRTUAL bool evict(D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
MOCKABLE_VIRTUAL bool evict(D3DKMT_HANDLE *handleList, uint32_t numOfHandles, uint64_t &sizeToTrim);
|
||||||
MOCKABLE_VIRTUAL bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim);
|
MOCKABLE_VIRTUAL bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim);
|
||||||
bool mapGpuVirtualAddress(WddmAllocation *allocation, void *cpuPtr, uint64_t size, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
bool mapGpuVirtualAddress(WddmAllocation *allocation, void *cpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
||||||
bool mapGpuVirtualAddress(AllocationStorageData *allocationStorageData, bool allocation32bit, bool use64kbPages);
|
bool mapGpuVirtualAddress(AllocationStorageData *allocationStorageData, bool allocation32bit, bool use64kbPages);
|
||||||
MOCKABLE_VIRTUAL bool createContext();
|
MOCKABLE_VIRTUAL bool createContext();
|
||||||
virtual bool createHwQueue() { return false; }
|
virtual bool createHwQueue() { return false; }
|
||||||
|
@ -200,7 +200,7 @@ class Wddm {
|
||||||
uintptr_t minAddress;
|
uintptr_t minAddress;
|
||||||
|
|
||||||
Wddm();
|
Wddm();
|
||||||
MOCKABLE_VIRTUAL bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
MOCKABLE_VIRTUAL bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1);
|
||||||
MOCKABLE_VIRTUAL bool openAdapter();
|
MOCKABLE_VIRTUAL bool openAdapter();
|
||||||
bool createDevice();
|
bool createDevice();
|
||||||
bool createPagingQueue();
|
bool createPagingQueue();
|
||||||
|
|
|
@ -95,7 +95,7 @@ GraphicsAllocation *WddmMemoryManager::allocateGraphicsMemory64kb(size_t size, s
|
||||||
|
|
||||||
wddmAllocation->setAlignedCpuPtr(cpuPtr);
|
wddmAllocation->setAlignedCpuPtr(cpuPtr);
|
||||||
// 64kb map is not needed
|
// 64kb map is not needed
|
||||||
auto status = wddm->mapGpuVirtualAddress(wddmAllocation, cpuPtr, sizeAligned, false, false, false);
|
auto status = wddm->mapGpuVirtualAddress(wddmAllocation, cpuPtr, false, false, false);
|
||||||
DEBUG_BREAK_IF(!status);
|
DEBUG_BREAK_IF(!status);
|
||||||
wddmAllocation->setCpuPtrAndGpuAddress(cpuPtr, (uint64_t)wddmAllocation->gpuPtr);
|
wddmAllocation->setCpuPtrAndGpuAddress(cpuPtr, (uint64_t)wddmAllocation->gpuPtr);
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ GraphicsAllocation *WddmMemoryManager::createAllocationFromHandle(osHandle handl
|
||||||
allocation->is32BitAllocation = true;
|
allocation->is32BitAllocation = true;
|
||||||
allocation->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase());
|
allocation->gpuBaseAddress = GmmHelper::canonize(allocator32Bit->getBase());
|
||||||
}
|
}
|
||||||
status = wddm->mapGpuVirtualAddress(allocation, ptr, size, is32BitAllocation, false, false);
|
status = wddm->mapGpuVirtualAddress(allocation, ptr, is32BitAllocation, false, false);
|
||||||
DEBUG_BREAK_IF(!status);
|
DEBUG_BREAK_IF(!status);
|
||||||
allocation->setGpuAddress(allocation->gpuPtr);
|
allocation->setGpuAddress(allocation->gpuPtr);
|
||||||
|
|
||||||
|
@ -812,10 +812,10 @@ bool WddmMemoryManager::createWddmAllocation(WddmAllocation *allocation, Allocat
|
||||||
wddmSuccess = wddm->createAllocation(allocation);
|
wddmSuccess = wddm->createAllocation(allocation);
|
||||||
}
|
}
|
||||||
if (wddmSuccess == STATUS_SUCCESS) {
|
if (wddmSuccess == STATUS_SUCCESS) {
|
||||||
bool mapSuccess = wddm->mapGpuVirtualAddress(allocation, allocation->getAlignedCpuPtr(), allocation->getAlignedSize(), allocation->is32BitAllocation, false, useHeap1);
|
bool mapSuccess = wddm->mapGpuVirtualAddress(allocation, allocation->getAlignedCpuPtr(), allocation->is32BitAllocation, false, useHeap1);
|
||||||
if (!mapSuccess && deferredDeleter) {
|
if (!mapSuccess && deferredDeleter) {
|
||||||
deferredDeleter->drain(true);
|
deferredDeleter->drain(true);
|
||||||
mapSuccess = wddm->mapGpuVirtualAddress(allocation, allocation->getAlignedCpuPtr(), allocation->getAlignedSize(), allocation->is32BitAllocation, false, useHeap1);
|
mapSuccess = wddm->mapGpuVirtualAddress(allocation, allocation->getAlignedCpuPtr(), allocation->is32BitAllocation, false, useHeap1);
|
||||||
}
|
}
|
||||||
if (!mapSuccess) {
|
if (!mapSuccess) {
|
||||||
wddm->destroyAllocations(&allocation->handle, 1, 0, allocation->resourceHandle);
|
wddm->destroyAllocations(&allocation->handle, 1, 0, allocation->resourceHandle);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Intel Corporation
|
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
@ -90,6 +90,7 @@ class MockGmmResourceInfo : public GmmResourceInfo {
|
||||||
GMM_RESCREATE_PARAMS mockResourceCreateParams = {};
|
GMM_RESCREATE_PARAMS mockResourceCreateParams = {};
|
||||||
|
|
||||||
void overrideReturnedRenderPitch(size_t newPitch) { rowPitch = newPitch; }
|
void overrideReturnedRenderPitch(size_t newPitch) { rowPitch = newPitch; }
|
||||||
|
void overrideReturnedSize(size_t newSize) { size = newSize; }
|
||||||
|
|
||||||
void setUnifiedAuxTranslationCapable();
|
void setUnifiedAuxTranslationCapable();
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,11 @@ bool WddmMock::evict(D3DKMT_HANDLE *handles, uint32_t num, uint64_t &sizeToTrim)
|
||||||
return makeNonResidentResult.success = Wddm::evict(handles, num, sizeToTrim);
|
return makeNonResidentResult.success = Wddm::evict(handles, num, sizeToTrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WddmMock::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32Bit, bool use64kbPages, bool useHeap1) {
|
bool WddmMock::mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32Bit, bool use64kbPages, bool useHeap1) {
|
||||||
mapGpuVirtualAddressResult.called++;
|
mapGpuVirtualAddressResult.called++;
|
||||||
mapGpuVirtualAddressResult.cpuPtrPassed = cpuPtr;
|
mapGpuVirtualAddressResult.cpuPtrPassed = cpuPtr;
|
||||||
if (callBaseMapGpuVa) {
|
if (callBaseMapGpuVa) {
|
||||||
return mapGpuVirtualAddressResult.success = Wddm::mapGpuVirtualAddressImpl(gmm, handle, cpuPtr, size, gpuPtr, allocation32Bit, use64kbPages, useHeap1);
|
return mapGpuVirtualAddressResult.success = Wddm::mapGpuVirtualAddressImpl(gmm, handle, cpuPtr, gpuPtr, allocation32Bit, use64kbPages, useHeap1);
|
||||||
} else {
|
} else {
|
||||||
gpuPtr = reinterpret_cast<D3DGPU_VIRTUAL_ADDRESS>(cpuPtr);
|
gpuPtr = reinterpret_cast<D3DGPU_VIRTUAL_ADDRESS>(cpuPtr);
|
||||||
return mapGpuVaStatus;
|
return mapGpuVaStatus;
|
||||||
|
|
|
@ -65,7 +65,7 @@ class WddmMock : public Wddm20 {
|
||||||
|
|
||||||
bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
bool makeResident(D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) override;
|
||||||
bool evict(D3DKMT_HANDLE *handles, uint32_t num, uint64_t &sizeToTrim) override;
|
bool evict(D3DKMT_HANDLE *handles, uint32_t num, uint64_t &sizeToTrim) override;
|
||||||
bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32Bit, bool use64kbPages, bool useHeap1) override;
|
bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32Bit, bool use64kbPages, bool useHeap1) override;
|
||||||
bool freeGpuVirtualAddres(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) override;
|
bool freeGpuVirtualAddres(D3DGPU_VIRTUAL_ADDRESS &gpuPtr, uint64_t size) override;
|
||||||
NTSTATUS createAllocation(WddmAllocation *alloc) override;
|
NTSTATUS createAllocation(WddmAllocation *alloc) override;
|
||||||
bool createAllocation64k(WddmAllocation *alloc) override;
|
bool createAllocation64k(WddmAllocation *alloc) override;
|
||||||
|
|
|
@ -225,7 +225,7 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedS
|
||||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||||
EXPECT_NE(0, allocation.handle);
|
EXPECT_NE(0, allocation.handle);
|
||||||
|
|
||||||
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), allocation.is32BitAllocation, false, false);
|
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.is32BitAllocation, false, false);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
EXPECT_EQ(alignedPages, getLastCallMapGpuVaArgFcn()->SizeInPages);
|
EXPECT_EQ(alignedPages, getLastCallMapGpuVaArgFcn()->SizeInPages);
|
||||||
|
@ -237,6 +237,25 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedS
|
||||||
delete gmm;
|
delete gmm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||||
|
wddm->init<FamilyType>();
|
||||||
|
|
||||||
|
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||||
|
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr);
|
||||||
|
std::unique_ptr<Gmm> gmm(GmmHelperFunctions::getGmm(allocation.getAlignedCpuPtr(), allocation.getAlignedSize()));
|
||||||
|
|
||||||
|
allocation.gmm = gmm.get();
|
||||||
|
auto status = wddm->createAllocation(&allocation);
|
||||||
|
|
||||||
|
auto mockResourceInfo = static_cast<MockGmmResourceInfo *>(gmm->gmmResourceInfo.get());
|
||||||
|
mockResourceInfo->overrideReturnedSize(allocation.getAlignedSize() + (2 * MemoryConstants::pageSize));
|
||||||
|
|
||||||
|
wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.is32BitAllocation, false, false);
|
||||||
|
|
||||||
|
uint64_t expectedSizeInPages = static_cast<uint64_t>(mockResourceInfo->getSizeAllocation() / MemoryConstants::pageSize);
|
||||||
|
EXPECT_EQ(expectedSizeInPages, getLastCallMapGpuVaArgFcn()->SizeInPages);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST_F(Wddm20Tests, createAllocation32bit) {
|
HWTEST_F(Wddm20Tests, createAllocation32bit) {
|
||||||
wddm->init<FamilyType>();
|
wddm->init<FamilyType>();
|
||||||
ASSERT_TRUE(wddm->isInitialized());
|
ASSERT_TRUE(wddm->isInitialized());
|
||||||
|
@ -259,7 +278,7 @@ HWTEST_F(Wddm20Tests, createAllocation32bit) {
|
||||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||||
EXPECT_TRUE(allocation.handle != 0);
|
EXPECT_TRUE(allocation.handle != 0);
|
||||||
|
|
||||||
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), allocation.is32BitAllocation, false, false);
|
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.is32BitAllocation, false, false);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
EXPECT_EQ(1u, wddm->mapGpuVirtualAddressResult.called);
|
EXPECT_EQ(1u, wddm->mapGpuVirtualAddressResult.called);
|
||||||
|
@ -282,7 +301,7 @@ HWTEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAd
|
||||||
allocation.handle = ALLOCATION_HANDLE;
|
allocation.handle = ALLOCATION_HANDLE;
|
||||||
allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
allocation.gmm = GmmHelperFunctions::getGmm(allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize());
|
||||||
|
|
||||||
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), false, false, true);
|
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), false, false, true);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
auto cannonizedHeapBase = GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base);
|
||||||
|
@ -340,7 +359,7 @@ HWTEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||||
EXPECT_TRUE(allocation.handle != 0);
|
EXPECT_TRUE(allocation.handle != 0);
|
||||||
|
|
||||||
auto error = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getUnderlyingBufferSize(), false, false, false);
|
auto error = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), false, false, false);
|
||||||
EXPECT_TRUE(error);
|
EXPECT_TRUE(error);
|
||||||
EXPECT_TRUE(allocation.gpuPtr != 0);
|
EXPECT_TRUE(allocation.gpuPtr != 0);
|
||||||
|
|
||||||
|
@ -366,7 +385,7 @@ HWTEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||||
auto status = wddm->createAllocation(&allocation);
|
auto status = wddm->createAllocation(&allocation);
|
||||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||||
|
|
||||||
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getAlignedSize(), allocation.is32BitAllocation, false, false);
|
bool ret = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.is32BitAllocation, false, false);
|
||||||
EXPECT_TRUE(ret);
|
EXPECT_TRUE(ret);
|
||||||
|
|
||||||
EXPECT_NE(0u, allocation.gpuPtr);
|
EXPECT_NE(0u, allocation.gpuPtr);
|
||||||
|
@ -390,7 +409,7 @@ HWTEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||||
EXPECT_EQ(STATUS_SUCCESS, status);
|
EXPECT_EQ(STATUS_SUCCESS, status);
|
||||||
EXPECT_TRUE(allocation.handle != 0);
|
EXPECT_TRUE(allocation.handle != 0);
|
||||||
|
|
||||||
auto error = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), allocation.getUnderlyingBufferSize(), false, false, false);
|
auto error = wddm->mapGpuVirtualAddress(&allocation, allocation.getAlignedCpuPtr(), false, false, false);
|
||||||
EXPECT_TRUE(error);
|
EXPECT_TRUE(error);
|
||||||
EXPECT_TRUE(allocation.gpuPtr != 0);
|
EXPECT_TRUE(allocation.gpuPtr != 0);
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ class WddmWithKmDafMock : public Wddm {
|
||||||
return featureTable.get();
|
return featureTable.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, uint64_t size, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1) override {
|
bool mapGpuVirtualAddressImpl(Gmm *gmm, D3DKMT_HANDLE handle, void *cpuPtr, D3DGPU_VIRTUAL_ADDRESS &gpuPtr, bool allocation32bit, bool use64kbPages, bool useHeap1) override {
|
||||||
return Wddm::mapGpuVirtualAddressImpl(gmm, handle, cpuPtr, size, gpuPtr, allocation32bit, use64kbPages, useHeap1);
|
return Wddm::mapGpuVirtualAddressImpl(gmm, handle, cpuPtr, gpuPtr, allocation32bit, use64kbPages, useHeap1);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmD
|
||||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||||
allocation.gmm = gmm.get();
|
allocation.gmm = gmm.get();
|
||||||
|
|
||||||
wddmWithKmDafMock->mapGpuVirtualAddressImpl(allocation.gmm, allocation.handle, allocation.getUnderlyingBuffer(), allocation.getUnderlyingBufferSize(), allocation.gpuPtr, false, false, false);
|
wddmWithKmDafMock->mapGpuVirtualAddressImpl(allocation.gmm, allocation.handle, allocation.getUnderlyingBuffer(), allocation.gpuPtr, false, false, false);
|
||||||
|
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.ftrKmdDaf);
|
EXPECT_EQ(wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.ftrKmdDaf);
|
||||||
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
EXPECT_EQ(wddmWithKmDafMock->getAdapter(), wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.hAdapter);
|
||||||
|
|
|
@ -2027,7 +2027,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
|
||||||
|
|
||||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(1).WillOnce(Invoke([&](const GMM_DDI_UPDATEAUXTABLE *arg) {givenDdiUpdateAuxTable = *arg; return GMM_SUCCESS; }));
|
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(1).WillOnce(Invoke([&](const GMM_DDI_UPDATEAUXTABLE *arg) {givenDdiUpdateAuxTable = *arg; return GMM_SUCCESS; }));
|
||||||
|
|
||||||
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
|
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, gpuVa, false, false, false);
|
||||||
ASSERT_TRUE(result);
|
ASSERT_TRUE(result);
|
||||||
EXPECT_EQ(GmmHelper::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
|
EXPECT_EQ(GmmHelper::canonize(wddm.getGfxPartition().Standard.Base), gpuVa);
|
||||||
|
|
||||||
|
@ -2088,7 +2088,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMapped
|
||||||
|
|
||||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||||
|
|
||||||
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
|
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), ALLOCATION_HANDLE, nullptr, gpuVa, false, false, false);
|
||||||
ASSERT_TRUE(result);
|
ASSERT_TRUE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2099,7 +2099,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenRet
|
||||||
WddmMock wddm;
|
WddmMock wddm;
|
||||||
EXPECT_TRUE(wddm.init<FamilyType>());
|
EXPECT_TRUE(wddm.init<FamilyType>());
|
||||||
|
|
||||||
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), 0, nullptr, 3, gpuVa, false, false, false);
|
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), 0, nullptr, gpuVa, false, false, false);
|
||||||
ASSERT_FALSE(result);
|
ASSERT_FALSE(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2122,7 +2122,7 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUn
|
||||||
|
|
||||||
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
EXPECT_CALL(*mockMngr, updateAuxTable(_)).Times(0);
|
||||||
|
|
||||||
auto result = wddm->mapGpuVirtualAddressImpl(myGmm, ALLOCATION_HANDLE, nullptr, 3, gpuVa, false, false, false);
|
auto result = wddm->mapGpuVirtualAddressImpl(myGmm, ALLOCATION_HANDLE, nullptr, gpuVa, false, false, false);
|
||||||
EXPECT_TRUE(result);
|
EXPECT_TRUE(result);
|
||||||
memoryManager.freeGraphicsMemory(wddmAlloc);
|
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue