mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +08:00
Remove template parameter from Wddm methods
Change-Id: Icd700c7215184d4c0f9564c61868a1f9f29a75e5 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
e6131293d1
commit
9ac3529c6b
@@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "hw_cmds.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.inl"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
|
||||
|
||||
@@ -30,9 +28,5 @@ namespace OCLRT {
|
||||
|
||||
typedef CNLFamily Family;
|
||||
|
||||
template bool Wddm::configureDeviceAddressSpace<Family>();
|
||||
|
||||
template bool Wddm::init<Family>();
|
||||
|
||||
template class WddmEngineMapper<CNLFamily>;
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "hw_cmds.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.inl"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
|
||||
|
||||
@@ -30,9 +28,5 @@ namespace OCLRT {
|
||||
|
||||
typedef BDWFamily Family;
|
||||
|
||||
template bool Wddm::init<Family>();
|
||||
|
||||
template bool Wddm::configureDeviceAddressSpace<Family>();
|
||||
|
||||
template class WddmEngineMapper<BDWFamily>;
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "hw_cmds.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.inl"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.inl"
|
||||
|
||||
@@ -30,9 +28,5 @@ namespace OCLRT {
|
||||
|
||||
typedef SKLFamily Family;
|
||||
|
||||
template bool Wddm::configureDeviceAddressSpace<Family>();
|
||||
|
||||
template bool Wddm::init<Family>();
|
||||
|
||||
template class WddmEngineMapper<SKLFamily>;
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "gmm_client_context.h"
|
||||
#include "runtime/gmm_helper/gmm_memory_base.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/os_interface/windows/windows_defs.h"
|
||||
|
||||
namespace OCLRT {
|
||||
GmmMemoryBase::GmmMemoryBase() {
|
||||
@@ -32,20 +33,27 @@ bool GmmMemoryBase::configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN FaultableSvm,
|
||||
BOOLEAN SparseReady,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) {
|
||||
BOOLEAN BDWL3Coherency) {
|
||||
return clientContext->ConfigureDeviceAddressSpace(
|
||||
{hAdapter},
|
||||
{hDevice},
|
||||
{pfnEscape},
|
||||
SvmSize,
|
||||
FaultableSvm,
|
||||
SparseReady,
|
||||
0,
|
||||
0,
|
||||
BDWL3Coherency,
|
||||
SizeOverride,
|
||||
SlmGfxSpaceReserve) != 0;
|
||||
0,
|
||||
0) != 0;
|
||||
}
|
||||
|
||||
bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_PARTITIONING &gfxPartition,
|
||||
uintptr_t &minAddress) {
|
||||
minAddress = windowsMinAddress;
|
||||
return configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
|
||||
}
|
||||
}; // namespace OCLRT
|
||||
|
||||
@@ -33,11 +33,15 @@ class GmmMemoryBase {
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN FaultableSvm,
|
||||
BOOLEAN SparseReady,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve);
|
||||
BOOLEAN BDWL3Coherency);
|
||||
|
||||
virtual bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_PARTITIONING &gfxPartition,
|
||||
uintptr_t &minAddress);
|
||||
|
||||
protected:
|
||||
GmmMemoryBase();
|
||||
|
||||
@@ -45,6 +45,7 @@ class HwHelper {
|
||||
virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo) = 0;
|
||||
virtual void setupHardwareCapabilities(HardwareCapabilities *caps) = 0;
|
||||
virtual SipKernelType getSipKernelType(bool debuggingActive) = 0;
|
||||
virtual uint32_t getConfigureAddressSpaceMode() = 0;
|
||||
|
||||
protected:
|
||||
HwHelper(){};
|
||||
@@ -94,6 +95,8 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
SipKernelType getSipKernelType(bool debuggingActive) override;
|
||||
|
||||
uint32_t getConfigureAddressSpaceMode() override;
|
||||
|
||||
private:
|
||||
HwHelperHw(){};
|
||||
};
|
||||
|
||||
@@ -59,4 +59,8 @@ SipKernelType HwHelperHw<Family>::getSipKernelType(bool debuggingActive) {
|
||||
return SipKernelType::DbgCsr;
|
||||
}
|
||||
|
||||
template <typename Family>
|
||||
uint32_t HwHelperHw<Family>::getConfigureAddressSpaceMode() {
|
||||
return 0u;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -74,17 +74,13 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
file(GLOB RUNTIME_SRCS_WDDM_INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm2[0-9]\.*")
|
||||
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE
|
||||
${RUNTIME_SRCS_OS_INTERFACE_WINDOWS}
|
||||
${RUNTIME_SRCS_WDDM_INTERFACE}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "runtime/gmm_helper/page_table_mngr.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||
#include "runtime/os_interface/windows/registry_reader.h"
|
||||
@@ -893,4 +894,50 @@ MonitoredFence &Wddm::getMonitoredFence() { return osContext->getMonitoredFence(
|
||||
D3DKMT_HANDLE Wddm::getOsDeviceContext() const {
|
||||
return osContext->getContext();
|
||||
}
|
||||
|
||||
bool Wddm::configureDeviceAddressSpace() {
|
||||
SYSTEM_INFO sysInfo;
|
||||
Wddm::getSystemInfo(&sysInfo);
|
||||
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
|
||||
|
||||
return gmmMemory->configureDevice(adapter, device, gdi->escape,
|
||||
maximumApplicationAddress + 1u,
|
||||
featureTable->ftrL3IACoherency,
|
||||
gfxPartition, minAddress);
|
||||
}
|
||||
|
||||
bool Wddm::init() {
|
||||
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
|
||||
if (!openAdapter()) {
|
||||
return false;
|
||||
}
|
||||
if (!queryAdapterInfo()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!wddmInterface) {
|
||||
if (featureTable->ftrWddmHwQueues) {
|
||||
wddmInterface = std::make_unique<WddmInterface23>(*this);
|
||||
} else {
|
||||
wddmInterface = std::make_unique<WddmInterface20>(*this);
|
||||
}
|
||||
}
|
||||
|
||||
if (!createDevice()) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
if (!gmmMemory) {
|
||||
gmmMemory.reset(GmmMemory::create());
|
||||
}
|
||||
if (!configureDeviceAddressSpace()) {
|
||||
return false;
|
||||
}
|
||||
osContext = std::make_unique<OsContextWin>(*this);
|
||||
initialized = osContext->isInitialized();
|
||||
}
|
||||
return initialized;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -98,10 +98,8 @@ class Wddm {
|
||||
MOCKABLE_VIRTUAL void *virtualAlloc(void *inPtr, size_t size, unsigned long flags, unsigned long type);
|
||||
MOCKABLE_VIRTUAL int virtualFree(void *ptr, size_t size, unsigned long flags);
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool configureDeviceAddressSpace();
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool init();
|
||||
|
||||
bool isInitialized() const {
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
#include "runtime/os_interface/windows/os_context_win.h"
|
||||
|
||||
namespace OCLRT {
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool Wddm::configureDeviceAddressSpace() {
|
||||
SYSTEM_INFO sysInfo;
|
||||
Wddm::getSystemInfo(&sysInfo);
|
||||
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
|
||||
minAddress = windowsMinAddress;
|
||||
|
||||
return gmmMemory->configureDeviceAddressSpace(adapter, device, gdi->escape,
|
||||
maximumApplicationAddress + 1u,
|
||||
0, 0, featureTable->ftrL3IACoherency, 0, 0);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool Wddm::init() {
|
||||
if (gdi != nullptr && gdi->isInitialized() && !initialized) {
|
||||
if (!openAdapter()) {
|
||||
return false;
|
||||
}
|
||||
if (!queryAdapterInfo()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!wddmInterface) {
|
||||
if (featureTable->ftrWddmHwQueues) {
|
||||
wddmInterface = std::make_unique<WddmInterface23>(*this);
|
||||
} else {
|
||||
wddmInterface = std::make_unique<WddmInterface20>(*this);
|
||||
}
|
||||
}
|
||||
|
||||
if (!createDevice()) {
|
||||
return false;
|
||||
}
|
||||
if (!createPagingQueue()) {
|
||||
return false;
|
||||
}
|
||||
if (!gmmMemory) {
|
||||
gmmMemory.reset(GmmMemory::create());
|
||||
}
|
||||
if (!configureDeviceAddressSpace<GfxFamily>()) {
|
||||
return false;
|
||||
}
|
||||
osContext = std::make_unique<OsContextWin>(*this);
|
||||
initialized = osContext->isInitialized();
|
||||
}
|
||||
return initialized;
|
||||
}
|
||||
} // namespace OCLRT
|
||||
@@ -75,7 +75,7 @@ WddmCommandStreamReceiver<GfxFamily>::WddmCommandStreamReceiver(const HardwareIn
|
||||
this->dispatchMode = (DispatchMode)DebugManager.flags.CsrDispatchMode.get();
|
||||
}
|
||||
|
||||
bool success = this->wddm->init<GfxFamily>();
|
||||
bool success = this->wddm->init();
|
||||
DEBUG_BREAK_IF(!success);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,11 +32,11 @@ namespace ULT {
|
||||
|
||||
typedef ::testing::Test MockOSTimeWinTest;
|
||||
|
||||
HWTEST_F(MockOSTimeWinTest, DynamicResolution) {
|
||||
TEST_F(MockOSTimeWinTest, DynamicResolution) {
|
||||
auto wddmMock = std::unique_ptr<WddmMock>(new WddmMock());
|
||||
auto mDev = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
bool error = wddmMock->init<FamilyType>();
|
||||
bool error = wddmMock->init();
|
||||
EXPECT_EQ(1u, wddmMock->createContextResult.called);
|
||||
|
||||
std::unique_ptr<MockOSTimeWin> timeWin(new MockOSTimeWin(wddmMock.get()));
|
||||
|
||||
@@ -80,3 +80,8 @@ GEN10TEST_F(HwHelperTestCnl, givenGen10PlatformWhenSetupHardwareCapabilitiesIsCa
|
||||
// Test default method implementation
|
||||
testDefaultImplementationOfSetupHardwareCapabilities(helper);
|
||||
}
|
||||
|
||||
GEN10TEST_F(HwHelperTestCnl, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
|
||||
@@ -67,4 +67,9 @@ GEN8TEST_F(HwHelperTestBdw, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCall
|
||||
EXPECT_EQ(2048u, hwCaps.image3DMaxWidth);
|
||||
EXPECT_EQ(2 * MemoryConstants::gigaByte - 8 * MemoryConstants::megaByte, hwCaps.maxMemAllocSize);
|
||||
EXPECT_FALSE(hwCaps.isStatelesToStatefullWithOffsetSupported);
|
||||
}
|
||||
|
||||
GEN8TEST_F(HwHelperTestBdw, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
@@ -70,4 +70,9 @@ GEN9TEST_F(HwHelperTestSkl, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenDb
|
||||
|
||||
auto sipType = helper.getSipKernelType(true);
|
||||
EXPECT_EQ(SipKernelType::DbgCsrLocal, sipType);
|
||||
}
|
||||
|
||||
GEN9TEST_F(HwHelperTestSkl, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
@@ -37,11 +37,7 @@ class MockGmmMemoryBase : public GmmMemory {
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN FaultableSvm,
|
||||
BOOLEAN SparseReady,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve) override {
|
||||
BOOLEAN BDWL3Coherency) override {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -52,15 +48,11 @@ class GmockGmmMemoryBase : public GmmMemory {
|
||||
|
||||
GmockGmmMemoryBase() = default;
|
||||
|
||||
MOCK_METHOD9(configureDeviceAddressSpace,
|
||||
MOCK_METHOD5(configureDeviceAddressSpace,
|
||||
bool(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN FaultableSvm,
|
||||
BOOLEAN SparseReady,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_SIZE_T SizeOverride,
|
||||
GMM_GFX_SIZE_T SlmGfxSpaceReserve));
|
||||
BOOLEAN BDWL3Coherency));
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -95,14 +95,13 @@ class WddmMock : public Wddm {
|
||||
bool reserveValidAddressRange(size_t size, void *&reservedMem);
|
||||
GmmMemory *getGmmMemory() const;
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool configureDeviceAddressSpace() {
|
||||
configureDeviceAddressSpaceResult.called++;
|
||||
//create context cant be called before configureDeviceAddressSpace
|
||||
if (createContextResult.called > 0) {
|
||||
return configureDeviceAddressSpaceResult.success = false;
|
||||
} else {
|
||||
return configureDeviceAddressSpaceResult.success = Wddm::configureDeviceAddressSpace<GfxFamily>();
|
||||
return configureDeviceAddressSpaceResult.success = Wddm::configureDeviceAddressSpace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,26 +60,26 @@ using Wddm20Tests = WddmTest;
|
||||
using Wddm20WithMockGdiDllTests = WddmTestWithMockGdiDll;
|
||||
using Wddm20InstrumentationTest = WddmInstrumentationTest;
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenMinWindowsAddressWhenWddmIsInitializedThenWddmUseThisAddress) {
|
||||
TEST_F(Wddm20Tests, givenMinWindowsAddressWhenWddmIsInitializedThenWddmUseThisAddress) {
|
||||
uintptr_t expectedAddress = 0x200000;
|
||||
EXPECT_EQ(expectedAddress, OCLRT::windowsMinAddress);
|
||||
|
||||
bool status = wddm->init<FamilyType>();
|
||||
bool status = wddm->init();
|
||||
EXPECT_TRUE(status);
|
||||
EXPECT_TRUE(wddm->isInitialized());
|
||||
EXPECT_EQ(expectedAddress, wddm->getWddmMinAddress());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, creation) {
|
||||
bool error = wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, creation) {
|
||||
bool error = wddm->init();
|
||||
EXPECT_TRUE(error);
|
||||
EXPECT_TRUE(wddm->isInitialized());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, doubleCreation) {
|
||||
bool error = wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, doubleCreation) {
|
||||
bool error = wddm->init();
|
||||
EXPECT_EQ(1u, wddm->createContextResult.called);
|
||||
error |= wddm->init<FamilyType>();
|
||||
error |= wddm->init();
|
||||
EXPECT_EQ(1u, wddm->createContextResult.called);
|
||||
|
||||
EXPECT_TRUE(error);
|
||||
@@ -177,9 +177,9 @@ TEST(Wddm20EnumAdaptersTest, givenUnknownPlatformWhenEnumAdapterIsCalledThenFals
|
||||
EXPECT_EQ(nullptr, outHwInfo.pWaTable);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
TEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
EXPECT_TRUE(wddm->osContext == nullptr);
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
auto context = wddm->osContext->getContext();
|
||||
@@ -188,8 +188,8 @@ HWTEST_F(Wddm20Tests, whenInitializeWddmThenContextIsCreated) {
|
||||
EXPECT_TRUE(wddm->destroyContext(context));
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, allocation) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, allocation) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
WddmAllocation allocation(mm.allocateSystemMemory(100, 0), 100, nullptr, MemoryPool::MemoryNull);
|
||||
@@ -208,8 +208,8 @@ HWTEST_F(Wddm20Tests, allocation) {
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSizeWhenCreatedThenWddmUseAligned) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedSizeWhenCreatedThenWddmUseAligned) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
@@ -240,8 +240,8 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenAllocationSmallerUnderlyingThanAlignedS
|
||||
delete gmm;
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGmmSize) {
|
||||
wddm->init();
|
||||
|
||||
void *fakePtr = reinterpret_cast<void *>(0x123);
|
||||
WddmAllocation allocation(fakePtr, 100, fakePtr, 200, nullptr, MemoryPool::MemoryNull);
|
||||
@@ -259,8 +259,8 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenWddmAllocationWhenMappingGpuVaThenUseGm
|
||||
EXPECT_EQ(expectedSizeInPages, getLastCallMapGpuVaArgFcn()->SizeInPages);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
uint64_t heap32baseAddress = 0x40000;
|
||||
@@ -295,8 +295,8 @@ HWTEST_F(Wddm20Tests, createAllocation32bit) {
|
||||
delete gmm;
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAddressWithingHeap1Limits) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAddressWithingHeap1Limits) {
|
||||
wddm->init();
|
||||
void *alignedPtr = (void *)0x12000;
|
||||
size_t alignedSize = 0x2000;
|
||||
WddmAllocation allocation(alignedPtr, alignedSize, nullptr, MemoryPool::MemoryNull);
|
||||
@@ -315,8 +315,8 @@ HWTEST_F(Wddm20Tests, givenGraphicsAllocationWhenItIsMappedInHeap1ThenItHasGpuAd
|
||||
delete allocation.gmm;
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocationsThenAllMarkedAllocationsAreDestroyed) {
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
TEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAllocationsThenAllMarkedAllocationsAreDestroyed) {
|
||||
EXPECT_TRUE(wddm->init());
|
||||
OsHandleStorage storage;
|
||||
OsHandle osHandle1 = {0};
|
||||
OsHandle osHandle2 = {0};
|
||||
@@ -348,8 +348,8 @@ HWTEST_F(Wddm20WithMockGdiDllTests, GivenThreeOsHandlesWhenAskedForDestroyAlloca
|
||||
EXPECT_EQ(1u, ptrToDestroyAlloc2->Flags.AssumeNotInUse);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
@@ -376,8 +376,8 @@ HWTEST_F(Wddm20Tests, mapAndFreeGpuVa) {
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
|
||||
@@ -398,8 +398,8 @@ HWTEST_F(Wddm20Tests, givenNullAllocationWhenCreateThenAllocateAndMap) {
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, makeResidentNonResident) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
@@ -470,13 +470,13 @@ TEST_F(Wddm20Tests, GetCpuGpuTime) {
|
||||
EXPECT_GT(CPUGPUTime02.CPUTimeinNS, CPUGPUTime01.CPUTimeinNS);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenGraphicsAllocationWithSharedPropertiesIsCreated) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
WddmMemoryManager mm(false, wddm.get());
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, false, false);
|
||||
@@ -508,14 +508,14 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocatio
|
||||
EXPECT_EQ(1u, destroyWithResourceHandleCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocationFromSharedHandleIsCalledThenMapGpuVaWithCpuPtrDepensOnBitness) {
|
||||
void *pSysMem = (void *)0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(pSysMem, 4096u, false));
|
||||
auto status = setSizesFcn(gmm->gmmResourceInfo.get(), 1u, 1024u, 1u);
|
||||
EXPECT_EQ(0u, status);
|
||||
|
||||
auto mockWddm = wddm.get();
|
||||
mockWddm->init<FamilyType>();
|
||||
mockWddm->init();
|
||||
WddmMemoryManager mm(false, mockWddm);
|
||||
|
||||
auto graphicsAllocation = mm.createGraphicsAllocationFromSharedHandle(ALLOCATION_HANDLE, false, false);
|
||||
@@ -531,14 +531,14 @@ HWTEST_F(Wddm20WithMockGdiDllTests, givenSharedHandleWhenCreateGraphicsAllocatio
|
||||
mm.freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenWddmCreatedWhenNotInitedThenMinAddressZero) {
|
||||
TEST_F(Wddm20Tests, givenWddmCreatedWhenNotInitedThenMinAddressZero) {
|
||||
uintptr_t expected = 0;
|
||||
uintptr_t actual = wddm->getWddmMinAddress();
|
||||
EXPECT_EQ(expected, actual);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenWddmCreatedWhenInitedThenMinAddressValid) {
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, givenWddmCreatedWhenInitedThenMinAddressValid) {
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
uintptr_t expected = windowsMinAddress;
|
||||
@@ -546,7 +546,7 @@ HWTEST_F(Wddm20Tests, givenWddmCreatedWhenInitedThenMinAddressValid) {
|
||||
EXPECT_EQ(expected, actual);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
|
||||
TEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
|
||||
SYSTEM_INFO sysInfo = {};
|
||||
WddmMock::getSystemInfo(&sysInfo);
|
||||
uintptr_t maxAddr = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress) + 1;
|
||||
@@ -561,39 +561,31 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceOnInit) {
|
||||
deviceHandle,
|
||||
wddm->gdi->escape.mFunc,
|
||||
maxAddr,
|
||||
0,
|
||||
0,
|
||||
FtrL3IACoherency,
|
||||
0,
|
||||
0))
|
||||
FtrL3IACoherency))
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(true));
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
|
||||
EXPECT_TRUE(wddm->isInitialized());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoAdapter) {
|
||||
TEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoAdapter) {
|
||||
wddm->adapter = static_cast<D3DKMT_HANDLE>(0);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initGmm(*platformDevices);
|
||||
EXPECT_CALL(*gmmMem, configureDeviceAddressSpace(static_cast<D3DKMT_HANDLE>(0),
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(false));
|
||||
auto ret = wddm->configureDeviceAddressSpace<FamilyType>();
|
||||
auto ret = wddm->configureDeviceAddressSpace();
|
||||
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoDevice) {
|
||||
TEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoDevice) {
|
||||
wddm->device = static_cast<D3DKMT_HANDLE>(0);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initGmm(*platformDevices);
|
||||
@@ -601,19 +593,15 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoDevice) {
|
||||
static_cast<D3DKMT_HANDLE>(0),
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(false));
|
||||
auto ret = wddm->configureDeviceAddressSpace<FamilyType>();
|
||||
auto ret = wddm->configureDeviceAddressSpace();
|
||||
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoEscFunc) {
|
||||
TEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoEscFunc) {
|
||||
wddm->gdi->escape = static_cast<PFND3DKMT_ESCAPE>(nullptr);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initGmm(*platformDevices);
|
||||
@@ -621,20 +609,16 @@ HWTEST_F(Wddm20InstrumentationTest, configureDeviceAddressSpaceNoEscFunc) {
|
||||
::testing::_,
|
||||
static_cast<PFND3DKMT_ESCAPE>(nullptr),
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(false));
|
||||
auto ret = wddm->configureDeviceAddressSpace<FamilyType>();
|
||||
auto ret = wddm->configureDeviceAddressSpace();
|
||||
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, getMaxApplicationAddress) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, getMaxApplicationAddress) {
|
||||
wddm->init();
|
||||
EXPECT_TRUE(wddm->isInitialized());
|
||||
|
||||
uint64_t maxAddr = wddm->getMaxApplicationAddress();
|
||||
@@ -645,60 +629,60 @@ HWTEST_F(Wddm20Tests, getMaxApplicationAddress) {
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, dontCallCreateContextBeforeConfigureDeviceAddressSpace) {
|
||||
TEST_F(Wddm20Tests, dontCallCreateContextBeforeConfigureDeviceAddressSpace) {
|
||||
wddm->wddmInterface = std::make_unique<WddmInterface20>(*wddm);
|
||||
D3DKMT_HANDLE context;
|
||||
wddm->createContext(context);
|
||||
EXPECT_EQ(1u, wddm->createContextResult.called); // dont care about the result
|
||||
|
||||
wddm->configureDeviceAddressSpace<FamilyType>();
|
||||
wddm->configureDeviceAddressSpace();
|
||||
|
||||
EXPECT_EQ(1u, wddm->configureDeviceAddressSpaceResult.called);
|
||||
EXPECT_FALSE(wddm->configureDeviceAddressSpaceResult.success);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenUseNoRingFlushesKmdModeDebugFlagToFalseWhenCreateContextIsCalledThenNoRingFlushesKmdModeIsSetToFalse) {
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenUseNoRingFlushesKmdModeDebugFlagToFalseWhenCreateContextIsCalledThenNoRingFlushesKmdModeIsSetToFalse) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.UseNoRingFlushesKmdMode.set(false);
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
auto createContextParams = this->getCreateContextDataFcn();
|
||||
auto privateData = (CREATECONTEXT_PVTDATA *)createContextParams->pPrivateDriverData;
|
||||
EXPECT_FALSE(!!privateData->NoRingFlushes);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenUseNoRingFlushesKmdModeDebugFlagToTrueWhenCreateContextIsCalledThenNoRingFlushesKmdModeIsSetToTrue) {
|
||||
TEST_F(Wddm20WithMockGdiDllTests, givenUseNoRingFlushesKmdModeDebugFlagToTrueWhenCreateContextIsCalledThenNoRingFlushesKmdModeIsSetToTrue) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.UseNoRingFlushesKmdMode.set(true);
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
auto createContextParams = this->getCreateContextDataFcn();
|
||||
auto privateData = (CREATECONTEXT_PVTDATA *)createContextParams->pPrivateDriverData;
|
||||
EXPECT_TRUE(!!privateData->NoRingFlushes);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, whenCreateContextIsCalledThenDisableHwQueues) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20WithMockGdiDllTests, whenCreateContextIsCalledThenDisableHwQueues) {
|
||||
wddm->init();
|
||||
EXPECT_FALSE(wddm->wddmInterface->hwQueuesSupported());
|
||||
EXPECT_EQ(0u, getCreateContextDataFcn()->Flags.HwQueueSupported);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, whenCreateHwQueueIsCalledThenAlwaysReturnFalse) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, whenCreateHwQueueIsCalledThenAlwaysReturnFalse) {
|
||||
wddm->init();
|
||||
EXPECT_FALSE(wddm->wddmInterface->createHwQueue(wddm->preemptionMode, *wddm->osContext));
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, whenWddmIsInitializedThenGdiDoesntHaveHwQueueDDIs) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, whenWddmIsInitializedThenGdiDoesntHaveHwQueueDDIs) {
|
||||
wddm->init();
|
||||
EXPECT_EQ(nullptr, wddm->gdi->createHwQueue.mFunc);
|
||||
EXPECT_EQ(nullptr, wddm->gdi->destroyHwQueue.mFunc);
|
||||
EXPECT_EQ(nullptr, wddm->gdi->submitCommandToHwQueue.mFunc);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledThenTrueIsReturned) {
|
||||
TEST_F(Wddm20Tests, givenDebugManagerWhenGetForUseNoRingFlushesKmdModeIsCalledThenTrueIsReturned) {
|
||||
EXPECT_TRUE(DebugManager.flags.UseNoRingFlushesKmdMode.get());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
@@ -722,8 +706,8 @@ HWTEST_F(Wddm20Tests, makeResidentMultipleHandles) {
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
wddm->init();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
|
||||
OsAgnosticMemoryManager mm(false);
|
||||
@@ -748,8 +732,8 @@ HWTEST_F(Wddm20Tests, makeResidentMultipleHandlesWithReturnBytesToTrim) {
|
||||
mm.freeSystemMemory(allocation.getUnderlyingBuffer());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
wddm->init();
|
||||
|
||||
D3DKMT_HANDLE handle = (D3DKMT_HANDLE)0x1234;
|
||||
|
||||
@@ -768,8 +752,8 @@ HWTEST_F(Wddm20Tests, makeNonResidentCallsEvict) {
|
||||
EXPECT_EQ(0u, gdi->getEvictArg().NumBytesToTrim);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueGreaterThanCurrentValueCallsWaitFromCpu) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueGreaterThanCurrentValueCallsWaitFromCpu) {
|
||||
wddm->init();
|
||||
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.getResidencyData().lastFence = 20;
|
||||
@@ -803,8 +787,8 @@ HWTEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueGreaterThanCurrentValue
|
||||
EXPECT_NE(nullptr, gdi->getDestroyArg().phAllocationList);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueLessEqualToCurrentValueDoesNotCallWaitFromCpu) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueLessEqualToCurrentValueDoesNotCallWaitFromCpu) {
|
||||
wddm->init();
|
||||
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.getResidencyData().lastFence = 10;
|
||||
@@ -838,8 +822,8 @@ HWTEST_F(Wddm20Tests, destroyAllocationWithLastFenceValueLessEqualToCurrentValue
|
||||
EXPECT_NE(nullptr, gdi->getDestroyArg().phAllocationList);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCalled) {
|
||||
wddm->init();
|
||||
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.getResidencyData().lastFence = 10;
|
||||
@@ -863,8 +847,8 @@ HWTEST_F(Wddm20Tests, WhenLastFenceLessEqualThanMonitoredThenWaitFromCpuIsNotCal
|
||||
EXPECT_EQ(nullptr, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled) {
|
||||
wddm->init();
|
||||
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.getResidencyData().lastFence = 10;
|
||||
@@ -888,8 +872,8 @@ HWTEST_F(Wddm20Tests, WhenLastFenceGreaterThanMonitoredThenWaitFromCpuIsCalled)
|
||||
EXPECT_NE(nullptr, gdi->getWaitFromCpuArg().ObjectHandleArray);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, createMonitoredFenceIsInitializedWithFenceValueZeroAndCurrentFenceValueIsSetToOne) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, createMonitoredFenceIsInitializedWithFenceValueZeroAndCurrentFenceValueIsSetToOne) {
|
||||
wddm->init();
|
||||
|
||||
gdi->createSynchronizationObject2 = gdi->createSynchronizationObject2Mock;
|
||||
|
||||
@@ -906,8 +890,8 @@ NTSTATUS APIENTRY queryResourceInfoMock(D3DKMT_QUERYRESOURCEINFO *pData) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm20Tests, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
|
||||
wddm->init();
|
||||
|
||||
D3DKMT_HANDLE handle = 0;
|
||||
WddmAllocation *alloc = nullptr;
|
||||
@@ -918,7 +902,7 @@ HWTEST_F(Wddm20Tests, givenOpenSharedHandleWhenZeroAllocationsThenReturnNull) {
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemoryThenCorrectStatusIsReturned) {
|
||||
TEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMemoryThenCorrectStatusIsReturned) {
|
||||
class MockCreateAllocation {
|
||||
public:
|
||||
static NTSTATUS APIENTRY mockCreateAllocation(D3DKMT_CREATEALLOCATION *param) {
|
||||
@@ -926,7 +910,7 @@ HWTEST_F(Wddm20Tests, givenReadOnlyMemoryWhenCreateAllocationFailsWithNoVideoMem
|
||||
};
|
||||
};
|
||||
gdi->createAllocation = MockCreateAllocation::mockCreateAllocation;
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
|
||||
OsHandleStorage handleStorage;
|
||||
OsHandle handle = {0};
|
||||
|
||||
@@ -52,15 +52,15 @@ struct Wddm23Tests : public ::testing::Test, GdiDllFixture, public GmmEnvironmen
|
||||
WddmMockInterface23 *wddmMockInterface = nullptr;
|
||||
};
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) {
|
||||
wddm->init();
|
||||
EXPECT_TRUE(wddm->wddmInterface->hwQueuesSupported());
|
||||
EXPECT_EQ(1u, getCreateContextDataFcn()->Flags.HwQueueSupported);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenCreateHwQueueIsCalledThenSetAllRequiredFieldsAndMonitoredFence) {
|
||||
TEST_F(Wddm23Tests, whenCreateHwQueueIsCalledThenSetAllRequiredFieldsAndMonitoredFence) {
|
||||
EXPECT_EQ(nullptr, wddm->osContext);
|
||||
wddm->init<FamilyType>();
|
||||
wddm->init();
|
||||
|
||||
EXPECT_EQ(wddm->osContext->getContext(), getCreateHwQueueDataFcn()->hHwContext);
|
||||
EXPECT_EQ(0u, getCreateHwQueueDataFcn()->PrivateDriverDataSize);
|
||||
@@ -73,8 +73,8 @@ HWTEST_F(Wddm23Tests, whenCreateHwQueueIsCalledThenSetAllRequiredFieldsAndMonito
|
||||
EXPECT_EQ(0u, wddm->getMonitoredFence().lastSubmittedFence);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) {
|
||||
wddm->init();
|
||||
wddm->setPreemptionMode(PreemptionMode::Disabled);
|
||||
wddm->wddmInterface->createHwQueue(wddm->preemptionMode, *wddm->osContext);
|
||||
EXPECT_EQ(0u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout);
|
||||
@@ -84,8 +84,8 @@ HWTEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeou
|
||||
EXPECT_EQ(1u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenDestroyHwQueueCalledThenPassExistingHandle) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, whenDestroyHwQueueCalledThenPassExistingHandle) {
|
||||
wddm->init();
|
||||
D3DKMT_HANDLE hwQueue = 123;
|
||||
wddm->osContext->setHwQueue(hwQueue);
|
||||
wddmMockInterface->destroyHwQueue(wddm->osContext->getHwQueue());
|
||||
@@ -97,16 +97,16 @@ HWTEST_F(Wddm23Tests, whenDestroyHwQueueCalledThenPassExistingHandle) {
|
||||
EXPECT_NE(hwQueue, getDestroyHwQueueDataFcn()->hHwQueue); // gdi not called when 0
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenObjectIsDestructedThenDestroyHwQueue) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, whenObjectIsDestructedThenDestroyHwQueue) {
|
||||
wddm->init();
|
||||
D3DKMT_HANDLE hwQueue = 123;
|
||||
wddm->osContext->setHwQueue(hwQueue);
|
||||
wddm.reset(nullptr);
|
||||
EXPECT_EQ(hwQueue, getDestroyHwQueueDataFcn()->hHwQueue);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, givenCmdBufferWhenSubmitCalledThenSetAllRequiredFiledsAndUpdateMonitoredFence) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, givenCmdBufferWhenSubmitCalledThenSetAllRequiredFiledsAndUpdateMonitoredFence) {
|
||||
wddm->init();
|
||||
uint64_t cmdBufferAddress = 123;
|
||||
size_t cmdSize = 456;
|
||||
auto hwQueue = wddm->osContext->getHwQueue();
|
||||
@@ -130,8 +130,8 @@ HWTEST_F(Wddm23Tests, givenCmdBufferWhenSubmitCalledThenSetAllRequiredFiledsAndU
|
||||
EXPECT_EQ(1u, wddm->getMonitoredFence().lastSubmittedFence);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, givenCurrentPendingFenceValueGreaterThanPendingFenceValueWhenSubmitCalledThenCallWaitOnGpu) {
|
||||
wddm->init<FamilyType>();
|
||||
TEST_F(Wddm23Tests, givenCurrentPendingFenceValueGreaterThanPendingFenceValueWhenSubmitCalledThenCallWaitOnGpu) {
|
||||
wddm->init();
|
||||
uint64_t cmdBufferAddress = 123;
|
||||
size_t cmdSize = 456;
|
||||
COMMAND_BUFFER_HEADER cmdBufferHeader = {};
|
||||
@@ -146,12 +146,12 @@ HWTEST_F(Wddm23Tests, givenCurrentPendingFenceValueGreaterThanPendingFenceValueW
|
||||
EXPECT_EQ(1u, wddm->waitOnGPUResult.called);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenInitCalledThenInitializeNewGdiDDIsAndCallToCreateHwQueue) {
|
||||
TEST_F(Wddm23Tests, whenInitCalledThenInitializeNewGdiDDIsAndCallToCreateHwQueue) {
|
||||
EXPECT_EQ(nullptr, wddm->gdi->createHwQueue.mFunc);
|
||||
EXPECT_EQ(nullptr, wddm->gdi->destroyHwQueue.mFunc);
|
||||
EXPECT_EQ(nullptr, wddm->gdi->submitCommandToHwQueue.mFunc);
|
||||
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
EXPECT_EQ(1u, wddmMockInterface->createHwQueueCalled);
|
||||
|
||||
EXPECT_NE(nullptr, wddm->gdi->createHwQueue.mFunc);
|
||||
@@ -159,12 +159,12 @@ HWTEST_F(Wddm23Tests, whenInitCalledThenInitializeNewGdiDDIsAndCallToCreateHwQue
|
||||
EXPECT_NE(nullptr, wddm->gdi->submitCommandToHwQueue.mFunc);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, whenCreateHwQueueFailedThenReturnFalseFromInit) {
|
||||
TEST_F(Wddm23Tests, whenCreateHwQueueFailedThenReturnFalseFromInit) {
|
||||
wddmMockInterface->forceCreateHwQueueFail = true;
|
||||
EXPECT_FALSE(wddm->init<FamilyType>());
|
||||
EXPECT_FALSE(wddm->init());
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm23Tests, givenFailureOnGdiInitializationWhenCreatingHwQueueThenReturnFailure) {
|
||||
TEST_F(Wddm23Tests, givenFailureOnGdiInitializationWhenCreatingHwQueueThenReturnFailure) {
|
||||
struct MyMockGdi : public Gdi {
|
||||
bool setupHwQueueProcAddresses() override {
|
||||
return false;
|
||||
@@ -172,7 +172,7 @@ HWTEST_F(Wddm23Tests, givenFailureOnGdiInitializationWhenCreatingHwQueueThenRetu
|
||||
};
|
||||
auto myMockGdi = new MyMockGdi();
|
||||
wddm->gdi.reset(myMockGdi);
|
||||
EXPECT_FALSE(wddm->init<FamilyType>());
|
||||
EXPECT_FALSE(wddm->init());
|
||||
EXPECT_EQ(1u, wddmMockInterface->createHwQueueCalled);
|
||||
EXPECT_FALSE(wddmMockInterface->createHwQueueResult);
|
||||
}
|
||||
|
||||
@@ -70,12 +70,12 @@ class WddmMockReserveAddress : public WddmMock {
|
||||
|
||||
using WddmReserveAddressTest = Test<GmmEnvironmentFixture>;
|
||||
|
||||
HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserveAddress) {
|
||||
TEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserveAddress) {
|
||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
||||
size_t size = 0x1000;
|
||||
void *reserve = nullptr;
|
||||
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
wddm->returnGood = 1;
|
||||
@@ -87,12 +87,12 @@ HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsSuccessfulThenReturnReserve
|
||||
wddm->releaseReservedAddress(reserve);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
||||
TEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
||||
size_t size = 0x1000;
|
||||
void *reserve = nullptr;
|
||||
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
uintptr_t expectedReserve = 0;
|
||||
ret = wddm->reserveValidAddressRange(size, reserve);
|
||||
@@ -100,12 +100,12 @@ HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsNullThenReturnNull) {
|
||||
EXPECT_EQ(expectedReserve, reinterpret_cast<uintptr_t>(reserve));
|
||||
}
|
||||
|
||||
HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThenReturnSecond) {
|
||||
TEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThenReturnSecond) {
|
||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
||||
size_t size = 0x1000;
|
||||
void *reserve = nullptr;
|
||||
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
wddm->returnInvalidCount = 1;
|
||||
@@ -117,12 +117,12 @@ HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondSuccessfulThen
|
||||
wddm->releaseReservedAddress(reserve);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThenReturnThird) {
|
||||
TEST_F(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThenReturnThird) {
|
||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
||||
size_t size = 0x1000;
|
||||
void *reserve = nullptr;
|
||||
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
wddm->returnInvalidCount = 2;
|
||||
@@ -134,12 +134,12 @@ HWTEST_F(WddmReserveAddressTest, givenWddmWhenSecondIsInvalidThirdSuccessfulThen
|
||||
wddm->releaseReservedAddress(reserve);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondNullThenReturnSecondNull) {
|
||||
TEST_F(WddmReserveAddressTest, givenWddmWhenFirstIsInvalidSecondNullThenReturnSecondNull) {
|
||||
std::unique_ptr<WddmMockReserveAddress> wddm(new WddmMockReserveAddress());
|
||||
size_t size = 0x1000;
|
||||
void *reserve = nullptr;
|
||||
|
||||
bool ret = wddm->init<FamilyType>();
|
||||
bool ret = wddm->init();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
wddm->returnInvalidCount = 2;
|
||||
|
||||
@@ -60,7 +60,7 @@ class WddmKmDafListenerTest : public GmmEnvironmentFixture, public ::testing::Te
|
||||
GmmEnvironmentFixture::SetUp();
|
||||
wddmWithKmDafMock.reset(new WddmWithKmDafMock());
|
||||
wddmWithKmDafMock->gdi.reset(new MockGdi());
|
||||
wddmWithKmDafMock->init<DEFAULT_TEST_FAMILY_NAME>();
|
||||
wddmWithKmDafMock->init();
|
||||
wddmWithKmDafMock->getFeatureTable()->ftrKmdDaf = true;
|
||||
}
|
||||
void TearDown() {
|
||||
@@ -70,7 +70,7 @@ class WddmKmDafListenerTest : public GmmEnvironmentFixture, public ::testing::Te
|
||||
std::unique_ptr<WddmWithKmDafMock> wddmWithKmDafMock;
|
||||
};
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -84,7 +84,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenLockResourceIsCalledThenKmDafListen
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyLockParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListenerNotifyUnlockIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafListenerNotifyUnlockIsFedWithCorrectParams) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
@@ -98,7 +98,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenUnlockResourceIsCalledThenKmDafList
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyUnlockParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmDafListenerNotifyMapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
@@ -114,7 +114,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMapGpuVirtualAddressIsCalledThenKmD
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKmDafListenerNotifyUnmapGpuVAIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
allocation.gpuPtr = GPUVA;
|
||||
|
||||
@@ -127,7 +127,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenFreeGpuVirtualAddressIsCalledThenKm
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyUnmapGpuVAParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListenerNotifyMakeResidentIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListenerNotifyMakeResidentIsFedWithCorrectParams) {
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
wddmWithKmDafMock->makeResident(&allocation.handle, 1, false, nullptr);
|
||||
@@ -140,7 +140,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenMakeResidentIsCalledThenKmDafListen
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMakeResidentParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyEvictIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotifyEvictIsFedWithCorrectParams) {
|
||||
MockWddmAllocation allocation;
|
||||
uint64_t sizeToTrim;
|
||||
|
||||
@@ -154,7 +154,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenEvictIsCalledThenKmDafListenerNotif
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyEvictParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -168,7 +168,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationIsCalledThenKmDafLi
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDafListenerNotifyWriteTargetIsFedWithCorrectParams) {
|
||||
WddmAllocation allocation((void *)0x23000, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
allocation.gmm = gmm.get();
|
||||
@@ -182,7 +182,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocation64IsCalledThenKmDaf
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyWriteTargetParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalledThenKmDafListenerNotifyWriteTargetAndMapGpuVAIsFedWithCorrectParams) {
|
||||
OsHandleStorage storage;
|
||||
OsHandle osHandle = {0};
|
||||
auto gmm = std::unique_ptr<Gmm>(new Gmm(nullptr, 1, false));
|
||||
@@ -206,7 +206,7 @@ HWTEST_F(WddmKmDafListenerTest, givenWddmWhenCreateAllocationsAndMapGpuVaIsCalle
|
||||
EXPECT_EQ(wddmWithKmDafMock->getGdi()->escape, wddmWithKmDafMock->getKmDafListenerMock().notifyMapGpuVAParametrization.pfnEscape);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmKmDafListenerTest, givenWddmWhenKmDafLockIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
TEST_F(WddmKmDafListenerTest, givenWddmWhenKmDafLockIsCalledThenKmDafListenerNotifyLockIsFedWithCorrectParams) {
|
||||
MockWddmAllocation allocation;
|
||||
allocation.handle = ALLOCATION_HANDLE;
|
||||
|
||||
|
||||
@@ -175,15 +175,15 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMemoryManagerWhenCreateAllocationFromHa
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, AllocateAndFree) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, AllocateAndFree) {
|
||||
SetUpMm();
|
||||
auto *ptr = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
EXPECT_NE(nullptr, ptr);
|
||||
memoryManager->freeGraphicsMemory(ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForVirtualPaddingSupportThenFalseIsReturned) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForVirtualPaddingSupportThenFalseIsReturned) {
|
||||
SetUpMm();
|
||||
EXPECT_FALSE(memoryManager->peekVirtualPaddingSupport());
|
||||
}
|
||||
|
||||
@@ -227,8 +227,8 @@ TEST_F(WddmMemoryManagerTest, GivenGraphicsAllocationWhenAddAndRemoveAllocationT
|
||||
EXPECT_EQ(fragment, nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtr) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtr) {
|
||||
SetUpMm();
|
||||
// three pages
|
||||
void *ptr = alignedMalloc(3 * 4096, 4096);
|
||||
ASSERT_NE(nullptr, ptr);
|
||||
@@ -241,8 +241,8 @@ HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtr) {
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenDefaultMemoryManagerWhenAllocateWithSizeIsCalledThenResourceHandleIsZero) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultMemoryManagerWhenAllocateWithSizeIsCalledThenResourceHandleIsZero) {
|
||||
SetUpMm();
|
||||
auto *gpuAllocation = memoryManager->allocateGraphicsMemory(0x1000);
|
||||
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(gpuAllocation);
|
||||
@@ -252,8 +252,8 @@ HWTEST_F(WddmMemoryManagerTest, givenDefaultMemoryManagerWhenAllocateWithSizeIsC
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -270,8 +270,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCalledThenNonNullGraphicsAllocationIsReturned) {
|
||||
SetUpMm();
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
@@ -287,8 +287,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromNTHandleIsCa
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenLockUnlockIsCalledThenReturnPtr) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenLockUnlockIsCalledThenReturnPtr) {
|
||||
SetUpMm();
|
||||
auto alloc = memoryManager->allocateGraphicsMemory(1);
|
||||
|
||||
auto ptr = memoryManager->lockResource(alloc);
|
||||
@@ -303,8 +303,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenLockUnlockIsCalledThen
|
||||
memoryManager->freeGraphicsMemory(alloc);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocWhenForce32bitAddressingIsSetAndRequireSpecificBitnessIsTrue) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllocWhenForce32bitAddressingIsSetAndRequireSpecificBitnessIsTrue) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -326,8 +326,8 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleReturns32BitAllo
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32BitAllocWhenForce32bitAddressingIsSetAndRequireSpecificBitnessIsFalse) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32BitAllocWhenForce32bitAddressingIsSetAndRequireSpecificBitnessIsFalse) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -349,8 +349,8 @@ HWTEST_F(WddmMemoryManagerTest, createAllocationFromSharedHandleDoesNotReturn32B
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandleIsCalledThenDestroyResourceHandle) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHandleIsCalledThenDestroyResourceHandle) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -371,8 +371,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenFreeAllocFromSharedHan
|
||||
EXPECT_EQ(lastDestroyed, expectedDestroyHandle);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromSharedHandleIsCalledThenUpdateSize) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromSharedHandleIsCalledThenUpdateSize) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -386,8 +386,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerSizeZeroWhenCreateFromShar
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFailsThenReturnNull) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandleFailsThenReturnNull) {
|
||||
SetUpMm();
|
||||
auto osHandle = 1u;
|
||||
auto size = 4096u;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
@@ -401,8 +401,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCreateFromSharedHandle
|
||||
EXPECT_EQ(nullptr, gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountZeroIsBeingCreatedThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountZeroIsBeingCreatedThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm();
|
||||
MockContext context;
|
||||
context.setMemoryManager(memoryManager.get());
|
||||
|
||||
@@ -429,8 +429,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCount
|
||||
EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE, imageGraphicsAllocation->gmm->resourceParams.Usage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNonZeroIsBeingCreatedThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCountNonZeroIsBeingCreatedThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm();
|
||||
MockContext context;
|
||||
context.setMemoryManager(memoryManager.get());
|
||||
|
||||
@@ -459,8 +459,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageWithMipCount
|
||||
EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE, imageGraphicsAllocation->gmm->resourceParams.Usage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreatedFromHostPtrThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreatedFromHostPtrThenallocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm();
|
||||
MockContext context;
|
||||
context.setMemoryManager(memoryManager.get());
|
||||
|
||||
@@ -489,8 +489,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat
|
||||
EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE, imageGraphicsAllocation->gmm->resourceParams.Usage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZeroisBeingCreatedThenAllocateGraphicsMemoryIsUsed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountZeroisBeingCreatedThenAllocateGraphicsMemoryIsUsed) {
|
||||
SetUpMm();
|
||||
MockContext context;
|
||||
context.setMemoryManager(memoryManager.get());
|
||||
|
||||
@@ -518,8 +518,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCoun
|
||||
EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_BUFFER, imageGraphicsAllocation->gmm->resourceParams.Usage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountNonZeroisBeingCreatedThenAllocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCountNonZeroisBeingCreatedThenAllocateGraphicsMemoryForImageIsUsed) {
|
||||
SetUpMm();
|
||||
MockContext context;
|
||||
context.setMemoryManager(memoryManager.get());
|
||||
|
||||
@@ -547,8 +547,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenNonTiledImgWithMipCoun
|
||||
EXPECT_EQ(GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_IMAGE, imageGraphicsAllocation->gmm->resourceParams.Usage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtrOffseted) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtrOffseted) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation alloc, allocOffseted;
|
||||
bool success = false;
|
||||
// three pages
|
||||
@@ -602,8 +602,8 @@ HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemHostPtrOffseted) {
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemCheckGmm) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, AllocateGpuMemCheckGmm) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
bool success = false;
|
||||
// three pages
|
||||
@@ -624,8 +624,8 @@ HWTEST_F(WddmMemoryManagerTest, AllocateGpuMemCheckGmm) {
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
bool success = false;
|
||||
uint32_t size = 4096;
|
||||
@@ -636,8 +636,8 @@ HWTEST_F(WddmMemoryManagerTest, GivenAlignedPointerWhenAllocate32BitMemoryThenGm
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMemoryThenGmmCalledWithCorrectPointerAndSize) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
bool success = false;
|
||||
uint32_t size = 0x1001;
|
||||
@@ -648,14 +648,14 @@ HWTEST_F(WddmMemoryManagerTest, GivenUnAlignedPointerAndSizeWhenAllocate32BitMem
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, getSystemSharedMemory) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, getSystemSharedMemory) {
|
||||
SetUpMm();
|
||||
int64_t mem = memoryManager->getSystemSharedMemory();
|
||||
EXPECT_EQ(mem, 4249540608);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, getMaxApplicationAddress) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, getMaxApplicationAddress) {
|
||||
SetUpMm();
|
||||
uint64_t maxAddr = memoryManager->getMaxApplicationAddress();
|
||||
if (is32bit) {
|
||||
EXPECT_EQ(maxAddr, MemoryConstants::max32BitAppAddress);
|
||||
@@ -664,8 +664,8 @@ HWTEST_F(WddmMemoryManagerTest, getMaxApplicationAddress) {
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
|
||||
SetUpMm();
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
@@ -676,8 +676,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithNullptr) {
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotDoTripleAlloc) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotDoTripleAlloc) {
|
||||
SetUpMm();
|
||||
size_t misalignedSize = 0x2500;
|
||||
void *misalignedPtr = reinterpret_cast<void *>(0x12500);
|
||||
|
||||
@@ -699,8 +699,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemoryWithMisalignedHostPtrDoesNotD
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress) {
|
||||
SetUpMm();
|
||||
auto *gpuAllocation = memoryManager->allocate32BitGraphicsMemory(3 * MemoryConstants::pageSize, nullptr, AllocationOrigin::EXTERNAL_ALLOCATION);
|
||||
|
||||
ASSERT_NE(nullptr, gpuAllocation);
|
||||
@@ -711,8 +711,8 @@ HWTEST_F(WddmMemoryManagerTest, Allocate32BitMemorySetsCannonizedGpuBaseAddress)
|
||||
memoryManager->freeGraphicsMemory(gpuAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsThenAllMarkedAllocationsAreDestroyed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocationsThenAllMarkedAllocationsAreDestroyed) {
|
||||
SetUpMm();
|
||||
OsHandleStorage storage;
|
||||
void *pSysMem = reinterpret_cast<void *>(0x1000);
|
||||
|
||||
@@ -751,20 +751,20 @@ HWTEST_F(WddmMemoryManagerTest, GivenThreeOsHandlesWhenAskedForDestroyAllocation
|
||||
delete storage.fragmentStorageData[1].residency;
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, freeNullAllocationNoCrash) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, freeNullAllocationNoCrash) {
|
||||
SetUpMm();
|
||||
memoryManager->freeGraphicsMemory(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForAlignedMallocRestrictionsThenValueIsReturned) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenDefaultWddmMemoryManagerWhenAskedForAlignedMallocRestrictionsThenValueIsReturned) {
|
||||
SetUpMm();
|
||||
AlignedMallocRestrictions *mallocRestrictions = memoryManager->getAlignedMallocRestrictions();
|
||||
ASSERT_NE(nullptr, mallocRestrictions);
|
||||
EXPECT_EQ(OCLRT::windowsMinAddress, mallocRestrictions->minAddress);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestrictionsThenReserveMemRangeForMap) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestrictionsThenReserveMemRangeForMap) {
|
||||
SetUpMm();
|
||||
void *cpuPtr = reinterpret_cast<void *>(memoryManager->getAlignedMallocRestrictions()->minAddress - 0x1000);
|
||||
size_t size = 0x1000;
|
||||
|
||||
@@ -778,8 +778,8 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenCpuMemNotMeetRestricti
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGpuVaFailThenFailToCreateAllocation) {
|
||||
SetUpMm();
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(ptr, size, false));
|
||||
@@ -793,8 +793,8 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithDisabledDeferredDeleterWhenMapGp
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstMapGpuVaFailSecondAfterDrainSuccessThenCreateAllocation) {
|
||||
SetUpMm();
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(ptr, size, false));
|
||||
@@ -811,8 +811,8 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstM
|
||||
EXPECT_EQ(reinterpret_cast<uint64_t>(ptr), allocation.getGpuAddress());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstAndMapGpuVaFailSecondAfterDrainFailThenFailToCreateAllocation) {
|
||||
SetUpMm();
|
||||
void *ptr = reinterpret_cast<void *>(0x1000);
|
||||
size_t size = 0x1000;
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(ptr, size, false));
|
||||
@@ -828,8 +828,8 @@ HWTEST_F(WddmMemoryManagerTest, givenManagerWithEnabledDeferredDeleterWhenFirstA
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeap1) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeap1) {
|
||||
SetUpMm();
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, nullptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
EXPECT_EQ(wddmAllocation->gpuBaseAddress, GmmHelper::canonize(this->wddm->getGfxPartition().Heap32[1].Base));
|
||||
@@ -847,8 +847,8 @@ HWTEST_F(WddmMemoryManagerTest, givenNullPtrAndSizePassedToCreateInternalAllocat
|
||||
memoryManager->freeGraphicsMemory(wddmAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeap1) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationWhenCallIsMadeThenAllocationIsCreatedIn32BitHeap1) {
|
||||
SetUpMm();
|
||||
auto ptr = reinterpret_cast<void *>(0x1000000);
|
||||
auto wddmAllocation = static_cast<WddmAllocation *>(memoryManager->allocate32BitGraphicsMemory(MemoryConstants::pageSize, ptr, AllocationOrigin::INTERNAL_ALLOCATION));
|
||||
ASSERT_NE(nullptr, wddmAllocation);
|
||||
@@ -867,8 +867,8 @@ HWTEST_F(WddmMemoryManagerTest, givenPtrAndSizePassedToCreateInternalAllocationW
|
||||
memoryManager->freeGraphicsMemory(wddmAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListPlacesAllocationInContainerAndAssignsPosition) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListPlacesAllocationInContainerAndAssignsPosition) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation);
|
||||
@@ -882,8 +882,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListPlacesAllocationI
|
||||
EXPECT_EQ(&allocation, memoryManager->trimCandidateList[position]);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListDoesNotInsertAllocationAlreadyOnTheList) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListDoesNotInsertAllocationAlreadyOnTheList) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
memoryManager->trimCandidateList.resize(0);
|
||||
@@ -904,8 +904,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, addToTrimCandidateListDoesNotInsertAllo
|
||||
EXPECT_EQ(position, allocation.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListAssignsUnusedPosition) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListAssignsUnusedPosition) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation);
|
||||
@@ -914,8 +914,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListAssignsUnuse
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesAllocationInAssignedPosition) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesAllocationInAssignedPosition) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation);
|
||||
@@ -928,8 +928,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesAlloc
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastAllocation) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastAllocation) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation;
|
||||
|
||||
memoryManager->trimCandidateList.resize(0);
|
||||
@@ -941,8 +941,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastA
|
||||
EXPECT_EQ(0u, memoryManager->trimCandidateList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastAllocationAndAllPreviousEmptyEntries) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastAllocationAndAllPreviousEmptyEntries) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2;
|
||||
|
||||
memoryManager->trimCandidateList.resize(0);
|
||||
@@ -962,8 +962,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, removeFromTrimCandidateListRemovesLastA
|
||||
EXPECT_EQ(1u, memoryManager->trimCandidateList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, successiveAddingToTrimCandidateListAssignsNewPositions) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, successiveAddingToTrimCandidateListAssignsNewPositions) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation1);
|
||||
@@ -975,8 +975,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, successiveAddingToTrimCandidateListAssi
|
||||
EXPECT_NE(allocation2.getTrimCandidateListPosition(), allocation3.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, DISABLED_removingNotLastAllocationFromTrimCandidateListSubstituesLastPositionAllocation) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, DISABLED_removingNotLastAllocationFromTrimCandidateListSubstituesLastPositionAllocation) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation1);
|
||||
@@ -991,8 +991,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, DISABLED_removingNotLastAllocationFromT
|
||||
EXPECT_NE(allocation2.getTrimCandidateListPosition(), allocation3.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, removingNotLastAllocationFromTrimCandidateListPutsNullEntry) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, removingNotLastAllocationFromTrimCandidateListPutsNullEntry) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation1);
|
||||
@@ -1008,8 +1008,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, removingNotLastAllocationFromTrimCandid
|
||||
EXPECT_EQ(nullptr, memoryManager->trimCandidateList[position2]);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListRemovesInitialNullEntriesAndUpdatesPositions) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListRemovesInitialNullEntriesAndUpdatesPositions) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation1);
|
||||
@@ -1036,8 +1036,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListRemovesInitialN
|
||||
EXPECT_EQ(1u, allocation4.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListWithNonNullEntries) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListWithNonNullEntries) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
memoryManager->addToTrimCandidateList(&allocation1);
|
||||
@@ -1052,8 +1052,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, compactTrimCandidateListWithNonNullEntr
|
||||
EXPECT_EQ(4u, memoryManager->trimCandidateList.size());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksAllocationsResident) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksAllocationsResident) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
memoryManager->pushAllocationForResidency(&allocation1);
|
||||
@@ -1069,8 +1069,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksAl
|
||||
EXPECT_TRUE(allocation4.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsUpdatesLastFence) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsUpdatesLastFence) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
memoryManager->pushAllocationForResidency(&allocation1);
|
||||
@@ -1088,8 +1088,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsUpdates
|
||||
EXPECT_EQ(20u, allocation4.getResidencyData().lastFence);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksTripleAllocationsResident) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksTripleAllocationsResident) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2;
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1500);
|
||||
|
||||
@@ -1110,8 +1110,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsMarksTr
|
||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsSetsLastFencePLusOneForTripleAllocations) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsSetsLastFencePLusOneForTripleAllocations) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2;
|
||||
|
||||
WddmAllocation *allocationTriple = (WddmAllocation *)memoryManager->allocateGraphicsMemory(8196, reinterpret_cast<void *>(0x1500));
|
||||
@@ -1131,15 +1131,15 @@ HWTEST_F(WddmMemoryManagerResidencyTest, makeResidentResidencyAllocationsSetsLas
|
||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimCallbackIsRegisteredInWddmMemoryManagerCtor) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimCallbackIsRegisteredInWddmMemoryManagerCtor) {
|
||||
SetUpMm();
|
||||
EXPECT_EQ((PFND3DKMT_TRIMNOTIFICATIONCALLBACK)memoryManager->trimCallback, gdi->getRegisterTrimNotificationArg().Callback);
|
||||
EXPECT_EQ(reinterpret_cast<void *>(memoryManager.get()), gdi->getRegisterTrimNotificationArg().Context);
|
||||
EXPECT_EQ(wddm->getDevice(), gdi->getRegisterTrimNotificationArg().hDevice);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenAllocationsAreEvictedMarkedAndRemovedFromTrimCandidateList) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenAllocationsAreEvictedMarkedAndRemovedFromTrimCandidateList) {
|
||||
SetUpMm();
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.PeriodicTrim = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
@@ -1172,8 +1172,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenNotUsedAllocationsFromPreviousPeri
|
||||
EXPECT_FALSE(allocation2.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenOneUsedAllocationFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenOneAllocationIsTrimmed) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenOneUsedAllocationFromPreviousPeriodicTrimWhenTrimResidencyPeriodicTrimIsCalledThenOneAllocationIsTrimmed) {
|
||||
SetUpMm();
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.PeriodicTrim = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
@@ -1210,8 +1210,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenOneUsedAllocationFromPreviousPerio
|
||||
EXPECT_TRUE(allocation2.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenTripleAllocationWithUsedAndUnusedFragmentsSincePreviousTrimWhenTrimResidencyPeriodicTrimIsCalledThenProperFragmentsAreEvictedAndMarked) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenTripleAllocationWithUsedAndUnusedFragmentsSincePreviousTrimWhenTrimResidencyPeriodicTrimIsCalledThenProperFragmentsAreEvictedAndMarked) {
|
||||
SetUpMm();
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.PeriodicTrim = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
@@ -1253,8 +1253,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenTripleAllocationWithUsedAndUnusedF
|
||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenPeriodicTrimWhenTrimCallbackCalledThenLastPeriodicTrimFenceIsSetToCurrentFenceValue) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenPeriodicTrimWhenTrimCallbackCalledThenLastPeriodicTrimFenceIsSetToCurrentFenceValue) {
|
||||
SetUpMm();
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.PeriodicTrim = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
@@ -1270,8 +1270,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenPeriodicTrimWhenTrimCallbackCalled
|
||||
EXPECT_EQ(20u, memoryManager->lastPeriodicTrimFenceValue);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenRestartPeriodicTrimWhenTrimCallbackCalledThenLastPeriodicTrimFenceIsSetToCurrentFenceValue) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenRestartPeriodicTrimWhenTrimCallbackCalledThenLastPeriodicTrimFenceIsSetToCurrentFenceValue) {
|
||||
SetUpMm();
|
||||
D3DKMT_TRIMNOTIFICATION trimNotification = {0};
|
||||
trimNotification.Flags.RestartPeriodicTrim = 1;
|
||||
trimNotification.NumBytesToTrim = 0;
|
||||
@@ -1287,15 +1287,15 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenRestartPeriodicTrimWhenTrimCallbac
|
||||
EXPECT_EQ(20u, memoryManager->lastPeriodicTrimFenceValue);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWithZeroSizeReturnsTrue) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWithZeroSizeReturnsTrue) {
|
||||
SetUpMm();
|
||||
bool status = memoryManager->trimResidencyToBudget(0);
|
||||
|
||||
EXPECT_TRUE(status);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
|
||||
MockWddmAllocation allocation1, allocation2, allocation3;
|
||||
@@ -1333,8 +1333,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetAllDoneAllocations) {
|
||||
EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTrimIsNotZero) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToTrimIsNotZero) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
|
||||
MockWddmAllocation allocation1;
|
||||
@@ -1357,8 +1357,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetReturnsFalseWhenNumBytesToT
|
||||
EXPECT_FALSE(status);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesToTrimIsZero) {
|
||||
SetUpMm();
|
||||
WddmAllocation allocation1(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation2(reinterpret_cast<void *>(0x1000), 0x3000, reinterpret_cast<void *>(0x1000), 0x3000, nullptr, MemoryPool::MemoryNull),
|
||||
allocation3(reinterpret_cast<void *>(0x1000), 0x1000, reinterpret_cast<void *>(0x1000), 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
@@ -1395,8 +1395,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetStopsEvictingWhenNumBytesTo
|
||||
EXPECT_NE(trimListUnusedPosition, allocation3.getTrimCandidateListPosition());
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonResident) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonResident) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
|
||||
MockWddmAllocation allocation1, allocation2, allocation3;
|
||||
@@ -1428,8 +1428,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetMarksEvictedAllocationNonRe
|
||||
EXPECT_TRUE(allocation3.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGreaterThanMonitored) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIsGreaterThanMonitored) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
|
||||
MockWddmAllocation allocation1;
|
||||
@@ -1457,8 +1457,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetWaitsFromCpuWhenLastFenceIs
|
||||
EXPECT_EQ(wddm->getDevice(), gdi->getWaitFromCpuArg().hDevice);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
void *ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
WddmAllocation allocation1(ptr, 0x1000, ptr, 0x1000, nullptr, MemoryPool::MemoryNull);
|
||||
@@ -1508,8 +1508,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, trimToBudgetEvictsDoneFragmentsOnly) {
|
||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, checkTrimCandidateListCompaction) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, checkTrimCandidateListCompaction) {
|
||||
SetUpMm();
|
||||
memoryManager->trimCandidatesCount = 10;
|
||||
memoryManager->trimCandidateList.resize(20);
|
||||
|
||||
@@ -1532,8 +1532,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, checkTrimCandidateListCompaction) {
|
||||
EXPECT_FALSE(comapctionRequired);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerThanAllocSizeWhenBudgetEqualTwoAlignedAllocationThenEvictOnlyTwo) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerThanAllocSizeWhenBudgetEqualTwoAlignedAllocationThenEvictOnlyTwo) {
|
||||
SetUpMm();
|
||||
gdi->setNonZeroNumBytesToTrimInEvict();
|
||||
size_t underlyingSize = 0xF00;
|
||||
size_t alignedSize = 0x1000;
|
||||
@@ -1579,8 +1579,8 @@ HWTEST_F(WddmMemoryManagerResidencyTest, givenThreeAllocationsAlignedSizeBiggerT
|
||||
EXPECT_TRUE(allocation3.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, ValidHostPtr) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, ValidHostPtr) {
|
||||
SetUpMm();
|
||||
flags = CL_MEM_USE_HOST_PTR;
|
||||
|
||||
auto ptr = alignedMalloc(MemoryConstants::preferredAlignment, MemoryConstants::preferredAlignment);
|
||||
@@ -1604,8 +1604,8 @@ HWTEST_F(BufferWithWddmMemory, ValidHostPtr) {
|
||||
alignedFree(ptr);
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, NullOsHandleStorageAskedForPopulationReturnsFilledPointer) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, NullOsHandleStorageAskedForPopulationReturnsFilledPointer) {
|
||||
SetUpMm();
|
||||
OsHandleStorage storage;
|
||||
storage.fragmentStorageData[0].cpuPtr = reinterpret_cast<void *>(0x1000);
|
||||
storage.fragmentStorageData[0].fragmentSize = MemoryConstants::pageSize;
|
||||
@@ -1618,8 +1618,8 @@ HWTEST_F(BufferWithWddmMemory, NullOsHandleStorageAskedForPopulationReturnsFille
|
||||
memoryManager->cleanOsHandles(storage);
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, GivenMisalignedHostPtrAndMultiplePagesSizeWhenAskedForGraphicsAllcoationThenItContainsAllFragmentsWithProperGpuAdrresses) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, GivenMisalignedHostPtrAndMultiplePagesSizeWhenAskedForGraphicsAllcoationThenItContainsAllFragmentsWithProperGpuAdrresses) {
|
||||
SetUpMm();
|
||||
auto ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1001);
|
||||
auto size = MemoryConstants::pageSize * 10;
|
||||
auto graphicsAllocation = memoryManager->allocateGraphicsMemory(size, ptr);
|
||||
@@ -1647,8 +1647,8 @@ HWTEST_F(BufferWithWddmMemory, GivenMisalignedHostPtrAndMultiplePagesSizeWhenAsk
|
||||
EXPECT_EQ(0u, hostPtrManager.getFragmentCount());
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, GivenPointerAndSizeWhenAskedToCreateGrahicsAllocationThenGraphicsAllocationIsCreated) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, GivenPointerAndSizeWhenAskedToCreateGrahicsAllocationThenGraphicsAllocationIsCreated) {
|
||||
SetUpMm();
|
||||
OsHandleStorage handleStorage;
|
||||
|
||||
auto ptr = reinterpret_cast<void *>(wddm->virtualAllocAddress + 0x1000);
|
||||
@@ -1680,8 +1680,8 @@ HWTEST_F(BufferWithWddmMemory, GivenPointerAndSizeWhenAskedToCreateGrahicsAlloca
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocationIsBeingCreatedThenGraphicsAddressIsPopulatedFromProperFragment) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocationIsBeingCreatedThenGraphicsAddressIsPopulatedFromProperFragment) {
|
||||
SetUpMm();
|
||||
memoryManager->setForce32bitAllocations(true);
|
||||
OsHandleStorage handleStorage = {};
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuAdress = MemoryConstants::pageSize * 1;
|
||||
@@ -1712,8 +1712,8 @@ HWTEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAlloca
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocationIsBeingCreatedNotAllignedToPageThenGraphicsAddressIsPopulatedFromProperFragmentAndOffsetisAssigned) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAllocationIsBeingCreatedNotAllignedToPageThenGraphicsAddressIsPopulatedFromProperFragmentAndOffsetisAssigned) {
|
||||
SetUpMm();
|
||||
memoryManager->setForce32bitAllocations(true);
|
||||
OsHandleStorage handleStorage = {};
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuAdress = MemoryConstants::pageSize * 1;
|
||||
@@ -1747,8 +1747,8 @@ HWTEST_F(BufferWithWddmMemory, givenFragmentsThatAreNotInOrderWhenGraphicsAlloca
|
||||
memoryManager->freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkAllocationsResidentWhenMakeResidentFails) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkAllocationsResidentWhenMakeResidentFails) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
auto makeResidentWithOutBytesToTrim = [](D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) -> bool { *numberOfBytesToTrim = 4 * 4096; return false; };
|
||||
@@ -1771,8 +1771,8 @@ HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkAllo
|
||||
EXPECT_FALSE(allocation4.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkTripleAllocationsResidentWhenMakeResidentFails) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkTripleAllocationsResidentWhenMakeResidentFails) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2;
|
||||
void *ptr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1500);
|
||||
WddmAllocation *allocationTriple = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemory(8196, ptr));
|
||||
@@ -1798,8 +1798,8 @@ HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsDoesNotMarkTrip
|
||||
memoryManager->freeGraphicsMemory(allocationTriple);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsFailsWhenMakeResidentFailsAndCantTrimFurther) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsFailsWhenMakeResidentFailsAndCantTrimFurther) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1, allocation2, allocation3, allocation4;
|
||||
|
||||
auto makeResidentWithOutBytesToTrim = [](D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) -> bool { *numberOfBytesToTrim = 4 * 4096; return false; };
|
||||
@@ -1822,8 +1822,8 @@ HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsFailsWhenMakeRe
|
||||
EXPECT_FALSE(allocation4.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsCallsMakeResidentWithCantTrimFurtherSetToTrueWhenTrimToBudgetReturnsFalse) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsCallsMakeResidentWithCantTrimFurtherSetToTrueWhenTrimToBudgetReturnsFalse) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1;
|
||||
|
||||
auto makeResidentWithOutBytesToTrim = [](D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) -> bool { *numberOfBytesToTrim = 4 * 4096; return false; };
|
||||
@@ -1839,8 +1839,8 @@ HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsCallsMakeReside
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, givenAllocationPackWhenTheyArePassedToMakeResidentThenTheyAreUsedInsteadOfMemoryManagerMembers) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, givenAllocationPackWhenTheyArePassedToMakeResidentThenTheyAreUsedInsteadOfMemoryManagerMembers) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1;
|
||||
MockWddmAllocation allocation2;
|
||||
MockWddmAllocation allocation3;
|
||||
@@ -1865,8 +1865,8 @@ HWTEST_F(WddmMemoryManagerTest2, givenAllocationPackWhenTheyArePassedToMakeResid
|
||||
EXPECT_TRUE(result);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsSucceedsWhenMakeResidentFailsAndTrimToBudgetSucceeds) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsSucceedsWhenMakeResidentFailsAndTrimToBudgetSucceeds) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1;
|
||||
void *cpuPtr = reinterpret_cast<void *>(wddm->getWddmMinAddress() + 0x1000);
|
||||
size_t allocationSize = 0x1000;
|
||||
@@ -1889,8 +1889,8 @@ HWTEST_F(WddmMemoryManagerTest2, makeResidentResidencyAllocationsSucceedsWhenMak
|
||||
EXPECT_TRUE(allocation1.getResidencyData().resident);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, givenMemoryManagerWhenMakeResidentFailsThenMemoryBudgetExhaustedIsReturnedAsTrue) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, givenMemoryManagerWhenMakeResidentFailsThenMemoryBudgetExhaustedIsReturnedAsTrue) {
|
||||
SetUpMm();
|
||||
MockWddmAllocation allocation1;
|
||||
|
||||
auto makeResidentThatFails = [](D3DKMT_HANDLE *handles, uint32_t count, bool cantTrimFurther, uint64_t *numberOfBytesToTrim) -> bool { return false; };
|
||||
@@ -1992,9 +1992,9 @@ TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForI
|
||||
EXPECT_EQ(heapBase, memoryManager.getInternalHeapBaseAddress());
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledWithTripleAllocationThenSuccessIsReturned) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalledWithTripleAllocationThenSuccessIsReturned) {
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
MockWddmMemoryManager memoryManager(wddm.get());
|
||||
|
||||
auto wddmAlloc = (WddmAllocation *)memoryManager.allocateGraphicsMemory(4096u, reinterpret_cast<void *>(0x1000));
|
||||
@@ -2004,10 +2004,10 @@ HWTEST_F(MockWddmMemoryManagerTest, givenValidateAllocationFunctionWhenItIsCalle
|
||||
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemoryForBufferWithoutHostPtrThen64kbAdressIsAllocated) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMemoryForBufferWithoutHostPtrThen64kbAdressIsAllocated) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
DebugManager.flags.Enable64kbpages.set(true);
|
||||
WddmMemoryManager memoryManager64k(true, wddm.get());
|
||||
EXPECT_EQ(0, wddm->createAllocationResult.called);
|
||||
@@ -2022,10 +2022,10 @@ HWTEST_F(MockWddmMemoryManagerTest, givenEnabled64kbpagesWhenCreatingGraphicsMem
|
||||
memoryManager64k.freeGraphicsMemory(galloc);
|
||||
}
|
||||
|
||||
HWTEST_F(OsAgnosticMemoryManagerUsingWddmTest, givenEnabled64kbPagesWhenAllocationIsCreatedWithSizeSmallerThan64kbThenGraphicsAllocationsHas64kbAlignedUnderlyingSize) {
|
||||
TEST_F(OsAgnosticMemoryManagerUsingWddmTest, givenEnabled64kbPagesWhenAllocationIsCreatedWithSizeSmallerThan64kbThenGraphicsAllocationsHas64kbAlignedUnderlyingSize) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
DebugManager.flags.Enable64kbpages.set(true);
|
||||
WddmMemoryManager memoryManager(true, wddm.get());
|
||||
auto graphicsAllocation = memoryManager.allocateGraphicsMemory64kb(1, MemoryConstants::pageSize64k, false, false);
|
||||
@@ -2041,11 +2041,11 @@ HWTEST_F(OsAgnosticMemoryManagerUsingWddmTest, givenEnabled64kbPagesWhenAllocati
|
||||
memoryManager.freeGraphicsMemory(graphicsAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenWddmWhenallocateGraphicsMemory64kbThenLockResultAndmapGpuVirtualAddressIsCalled) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenWddmWhenallocateGraphicsMemory64kbThenLockResultAndmapGpuVirtualAddressIsCalled) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.Enable64kbpages.set(true);
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
MockWddmMemoryManager memoryManager64k(wddm.get());
|
||||
uint32_t lockCount = wddm->lockResult.called;
|
||||
uint32_t mapGpuVirtualAddressResult = wddm->mapGpuVirtualAddressResult.called;
|
||||
@@ -2089,9 +2089,9 @@ TEST_F(MockWddmMemoryManagerTest, givenDisabledAsyncDeleterFlagWhenMemoryManager
|
||||
DebugManager.flags.EnableDeferredDeleter.set(defaultEnableDeferredDeleterFlag);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThenUseWddmToMap) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledThenUseWddmToMap) {
|
||||
auto myWddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(myWddm->init<FamilyType>());
|
||||
EXPECT_TRUE(myWddm->init());
|
||||
WddmMemoryManager memoryManager(false, myWddm.get());
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
@@ -2114,12 +2114,12 @@ HWTEST_F(MockWddmMemoryManagerTest, givenPageTableManagerWhenMapAuxGpuVaCalledTh
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpuVaThenMapAuxVa) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = true;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm;
|
||||
EXPECT_TRUE(wddm.init<FamilyType>());
|
||||
EXPECT_TRUE(wddm.init());
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm.resetPageTableManager(mockMngr);
|
||||
@@ -2140,9 +2140,9 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenMappedGpu
|
||||
EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &givenDdiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleaseingThenUnmapAuxVa) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleaseingThenUnmapAuxVa) {
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
WddmMemoryManager memoryManager(false, wddm.get());
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 123;
|
||||
|
||||
@@ -2166,9 +2166,9 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedAllocationWhenReleasein
|
||||
EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &givenDdiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleaseingThenDontUnmapAuxVa) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleaseingThenDontUnmapAuxVa) {
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
WddmMemoryManager memoryManager(false, wddm.get());
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
@@ -2182,12 +2182,12 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenReleas
|
||||
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMappedGpuVaThenDontMapAuxVa) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm;
|
||||
EXPECT_TRUE(wddm.init<FamilyType>());
|
||||
EXPECT_TRUE(wddm.init());
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
wddm.resetPageTableManager(mockMngr);
|
||||
@@ -2198,21 +2198,21 @@ HWTEST_F(MockWddmMemoryManagerTest, givenNonRenderCompressedAllocationWhenMapped
|
||||
ASSERT_TRUE(result);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenFailingAllocationWhenMappedGpuVaThenReturnFalse) {
|
||||
std::unique_ptr<Gmm> gmm(new Gmm(reinterpret_cast<void *>(123), 4096u, false));
|
||||
gmm->isRenderCompressed = false;
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
WddmMock wddm;
|
||||
EXPECT_TRUE(wddm.init<FamilyType>());
|
||||
EXPECT_TRUE(wddm.init());
|
||||
|
||||
auto result = wddm.mapGpuVirtualAddressImpl(gmm.get(), 0, nullptr, gpuVa, false, false, false);
|
||||
ASSERT_FALSE(result);
|
||||
}
|
||||
|
||||
HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnsetThenDontUpdateAuxTable) {
|
||||
TEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUnsetThenDontUpdateAuxTable) {
|
||||
D3DGPU_VIRTUAL_ADDRESS gpuVa = 0;
|
||||
auto wddm = std::make_unique<WddmMock>();
|
||||
EXPECT_TRUE(wddm->init<FamilyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
WddmMemoryManager memoryManager(false, wddm.get());
|
||||
|
||||
auto mockMngr = new NiceMock<MockGmmPageTableMngr>();
|
||||
@@ -2233,8 +2233,8 @@ HWTEST_F(MockWddmMemoryManagerTest, givenRenderCompressedFlagSetWhenInternalIsUn
|
||||
memoryManager.freeGraphicsMemory(wddmAlloc);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThenPopulateOsHandlesReturnsInvalidPointer) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThenPopulateOsHandlesReturnsInvalidPointer) {
|
||||
SetUpMm();
|
||||
OsHandleStorage handleStorage;
|
||||
handleStorage.fragmentCount = 1;
|
||||
handleStorage.fragmentStorageData[0].cpuPtr = reinterpret_cast<void *>(0x1000);
|
||||
@@ -2250,8 +2250,8 @@ HWTEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryWhenCreateAllocationFailsThe
|
||||
memoryManager->cleanOsHandles(handleStorage);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryPassedToPopulateOsHandlesWhenCreateAllocationFailsThenAllocatedFragmentsAreNotStored) {
|
||||
SetUpMm<FamilyType>();
|
||||
TEST_F(WddmMemoryManagerTest2, givenReadOnlyMemoryPassedToPopulateOsHandlesWhenCreateAllocationFailsThenAllocatedFragmentsAreNotStored) {
|
||||
SetUpMm();
|
||||
OsHandleStorage handleStorage;
|
||||
OsHandle handle;
|
||||
handleStorage.fragmentCount = 2;
|
||||
|
||||
@@ -47,9 +47,8 @@ class WddmMemoryManagerFixture : public GmmEnvironmentFixture, public GdiDllFixt
|
||||
GmmEnvironmentFixture::TearDown();
|
||||
}
|
||||
|
||||
template <typename FamiltyType>
|
||||
void SetUpMm() {
|
||||
EXPECT_TRUE(wddm->init<FamiltyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
uint64_t heap32Base = (uint64_t)(0x800000000000);
|
||||
if (sizeof(uintptr_t) == 4) {
|
||||
heap32Base = 0x1000;
|
||||
@@ -75,9 +74,8 @@ class MockWddmMemoryManagerFixture : public GmmEnvironmentFixture {
|
||||
wddm->gdi.reset(gdi);
|
||||
}
|
||||
|
||||
template <typename FamiltyType>
|
||||
void SetUpMm() {
|
||||
EXPECT_TRUE(wddm->init<FamiltyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
uint64_t heap32Base = (uint64_t)(0x800000000000);
|
||||
if (sizeof(uintptr_t) == 4) {
|
||||
heap32Base = 0x1000;
|
||||
@@ -138,9 +136,8 @@ class WddmMemoryManagerFixtureWithGmockWddm : public GmmEnvironmentFixture {
|
||||
ASSERT_NE(nullptr, wddm);
|
||||
}
|
||||
|
||||
template <typename FamiltyType>
|
||||
void SetUpMm() {
|
||||
wddm->init<FamiltyType>();
|
||||
wddm->init();
|
||||
memoryManager = new (std::nothrow) MockWddmMemoryManager(wddm.get());
|
||||
//assert we have memory manager
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
@@ -167,9 +164,8 @@ class BufferWithWddmMemory : public ::testing::Test,
|
||||
tmp = context.getMemoryManager();
|
||||
}
|
||||
|
||||
template <typename FamiltyType>
|
||||
void SetUpMm() {
|
||||
EXPECT_TRUE(wddm->init<FamiltyType>());
|
||||
EXPECT_TRUE(wddm->init());
|
||||
uint64_t heap32Base = (uint64_t)(0x800000000000);
|
||||
if (sizeof(uintptr_t) == 4) {
|
||||
heap32Base = 0x1000;
|
||||
@@ -197,7 +193,7 @@ class WddmMemoryManagerSimpleTest : public MockWddmMemoryManagerFixture, public
|
||||
public:
|
||||
void SetUp() override {
|
||||
MockWddmMemoryManagerFixture::SetUp();
|
||||
wddm->init<DEFAULT_TEST_FAMILY_NAME>();
|
||||
wddm->init();
|
||||
}
|
||||
void TearDown() override {
|
||||
MockWddmMemoryManagerFixture::TearDown();
|
||||
|
||||
@@ -41,7 +41,6 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
||||
WddmFixtureWithMockGdiDll::TearDown();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void createAndInitWddm(unsigned int forceReturnPreemptionRegKeyValue) {
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm()));
|
||||
auto regReader = new RegistryReaderMock();
|
||||
@@ -49,63 +48,63 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
||||
regReader->forceRetValue = forceReturnPreemptionRegKeyValue;
|
||||
PreemptionMode preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoTest);
|
||||
wddm->setPreemptionMode(preemptionMode);
|
||||
wddm->init<GfxFamily>();
|
||||
wddm->init();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore *dbgRestorer = nullptr;
|
||||
HardwareInfo hwInfoTest;
|
||||
};
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionEnabledDebugFlagDontForceWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOn) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionEnabledDebugFlagDontForceWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOn) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(-1); // dont force
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
unsigned int expectedVal = 1u;
|
||||
createAndInitWddm<FamilyType>(1u);
|
||||
createAndInitWddm(1u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagDontForceWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOff) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagDontForceWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOff) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(-1); // dont force
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
unsigned int expectedVal = 0u;
|
||||
createAndInitWddm<FamilyType>(1u);
|
||||
createAndInitWddm(1u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionEnabledDebugFlagDontForceWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionEnabledDebugFlagDontForceWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(-1); // dont force
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
unsigned int expectedVal = 0u;
|
||||
createAndInitWddm<FamilyType>(0u);
|
||||
createAndInitWddm(0u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagDontForceWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagDontForceWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(-1); // dont force
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
unsigned int expectedVal = 0u;
|
||||
createAndInitWddm<FamilyType>(0u);
|
||||
createAndInitWddm(0u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagForcePreemptionWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOn) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagForcePreemptionWhenPreemptionRegKeySetThenSetGpuTimeoutFlagOn) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread)); // force preemption
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
unsigned int expectedVal = 1u;
|
||||
createAndInitWddm<FamilyType>(1u);
|
||||
createAndInitWddm(1u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
HWTEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagForcePreemptionWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
TEST_F(WddmPreemptionTests, givenDevicePreemptionDisabledDebugFlagForcePreemptionWhenPreemptionRegKeyNotSetThenSetGpuTimeoutFlagOff) {
|
||||
DebugManager.flags.ForcePreemptionMode.set(static_cast<int32_t>(PreemptionMode::MidThread)); // force preemption
|
||||
hwInfoTest.capabilityTable.defaultPreemptionMode = PreemptionMode::Disabled;
|
||||
unsigned int expectedVal = 0u;
|
||||
createAndInitWddm<FamilyType>(0u);
|
||||
createAndInitWddm(0u);
|
||||
EXPECT_EQ(expectedVal, getMockCreateDeviceParamsFcn().Flags.DisableGpuTimeout);
|
||||
EXPECT_EQ(expectedVal, getCreateContextDataFcn()->Flags.DisableGpuTimeout);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user