Refactor configuring device address space logic:
1. call GmmSetDeviceInfo 2. call ConfigureDeviceAddressSpace 3. obtain min address - only for gen12lp platforms remove getConfigureAddressSpaceMode method Resolves: NEO-4076 Change-Id: Ib72789c834df1307a3d105131943dcf9a54afc03 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
902ee28217
commit
c858a2b79f
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -37,7 +37,6 @@ class HwHelper {
|
|||
virtual void setupHardwareCapabilities(HardwareCapabilities *caps, const HardwareInfo &hwInfo) = 0;
|
||||
virtual bool isL3Configurable(const HardwareInfo &hwInfo) = 0;
|
||||
virtual SipKernelType getSipKernelType(bool debuggingActive) = 0;
|
||||
virtual uint32_t getConfigureAddressSpaceMode() = 0;
|
||||
virtual bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPageTableManagerSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual const AubMemDump::LrcaHelper &getCsTraits(aub_stream::EngineType engineType) const = 0;
|
||||
|
@ -134,8 +133,6 @@ class HwHelperHw : public HwHelper {
|
|||
|
||||
SipKernelType getSipKernelType(bool debuggingActive) override;
|
||||
|
||||
uint32_t getConfigureAddressSpaceMode() override;
|
||||
|
||||
bool isLocalMemoryEnabled(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool hvAlign4Required() const override;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -25,11 +25,6 @@ void HwHelperHw<GfxFamily>::setCapabilityCoherencyFlag(const HardwareInfo *pHwIn
|
|||
coherencyFlag = true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t HwHelperHw<GfxFamily>::getConfigureAddressSpaceMode() {
|
||||
return 0u;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
|
||||
return false;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -45,11 +45,6 @@ uint32_t HwHelperHw<Family>::getComputeUnitsUsedForScratch(const HardwareInfo *p
|
|||
return pHwInfo->gtSystemInfo.MaxSubSlicesSupported * pHwInfo->gtSystemInfo.MaxEuPerSubSlice * 8;
|
||||
}
|
||||
|
||||
template <>
|
||||
uint32_t HwHelperHw<Family>::getConfigureAddressSpaceMode() {
|
||||
return 1u;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool HwHelperHw<Family>::isLocalMemoryEnabled(const HardwareInfo &hwInfo) const {
|
||||
return Gen12LPHelpers::isLocalMemoryEnabled(hwInfo);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -39,9 +39,22 @@ bool GmmMemoryBase::configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
|||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
GMM_GFX_PARTITIONING &gfxPartition,
|
||||
uintptr_t &minAddress) {
|
||||
uintptr_t &minAddress,
|
||||
bool obtainMinAddress) {
|
||||
minAddress = windowsMinAddress;
|
||||
return configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
|
||||
auto retVal = configureDeviceAddressSpace(hAdapter, hDevice, pfnEscape, SvmSize, BDWL3Coherency);
|
||||
if (obtainMinAddress) {
|
||||
minAddress = getInternalGpuVaRangeLimit();
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
uintptr_t GmmMemoryBase::getInternalGpuVaRangeLimit() {
|
||||
return static_cast<uintptr_t>(clientContext->GetInternalGpuVaRangeLimit());
|
||||
}
|
||||
|
||||
bool GmmMemoryBase::setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) {
|
||||
auto status = clientContext->GmmSetDeviceInfo(deviceInfo);
|
||||
DEBUG_BREAK_IF(status != GMM_SUCCESS);
|
||||
return GMM_SUCCESS == status;
|
||||
}
|
||||
}; // namespace NEO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -21,13 +21,17 @@ class GmmMemoryBase {
|
|||
GMM_GFX_SIZE_T SvmSize,
|
||||
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);
|
||||
bool configureDevice(GMM_ESCAPE_HANDLE hAdapter,
|
||||
GMM_ESCAPE_HANDLE hDevice,
|
||||
GMM_ESCAPE_FUNC_TYPE pfnEscape,
|
||||
GMM_GFX_SIZE_T SvmSize,
|
||||
BOOLEAN BDWL3Coherency,
|
||||
uintptr_t &minAddress,
|
||||
bool obtainMinAddress);
|
||||
|
||||
MOCKABLE_VIRTUAL uintptr_t getInternalGpuVaRangeLimit();
|
||||
|
||||
MOCKABLE_VIRTUAL bool setDeviceInfo(GMM_DEVICE_INFO *deviceInfo);
|
||||
|
||||
protected:
|
||||
GmmMemoryBase();
|
||||
|
|
|
@ -52,7 +52,6 @@ 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${BRANCH_DIR_SUFFIX}/wddm_configure_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm/wddm_interface.cpp
|
||||
)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "core/utilities/stackvec.h"
|
||||
#include "runtime/execution_environment/execution_environment.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/helpers/windows/gmm_callbacks.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
#include "runtime/os_interface/hw_info_config.h"
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
|
@ -938,7 +939,37 @@ int Wddm::virtualFree(void *ptr, size_t size, unsigned long flags) {
|
|||
return virtualFreeFnc(ptr, size, flags);
|
||||
}
|
||||
|
||||
bool Wddm::configureDeviceAddressSpaceImpl() {
|
||||
long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate) {
|
||||
return notifyAubCaptureImpl(csrHandle, gfxAddress, gfxSize, allocate);
|
||||
}
|
||||
bool Wddm::configureDeviceAddressSpace() {
|
||||
GMM_DEVICE_CALLBACKS_INT deviceCallbacks{};
|
||||
deviceCallbacks.Adapter.KmtHandle = adapter;
|
||||
deviceCallbacks.hCsr = nullptr;
|
||||
deviceCallbacks.hDevice.KmtHandle = device;
|
||||
deviceCallbacks.PagingQueue = pagingQueue;
|
||||
deviceCallbacks.PagingFence = pagingQueueSyncObject;
|
||||
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnAllocate = gdi->createAllocation;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnDeallocate = gdi->destroyAllocation;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = gdi->mapGpuVirtualAddress;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnMakeResident = gdi->makeResident;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEvict = gdi->evict;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = gdi->reserveGpuVirtualAddress;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = gdi->updateGpuVirtualAddress;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = gdi->waitForSynchronizationObjectFromCpu;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnLock = gdi->lock2;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnUnLock = gdi->unlock2;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnEscape = gdi->escape;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA = gdi->freeGpuVirtualAddress;
|
||||
deviceCallbacks.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCapture;
|
||||
|
||||
GMM_DEVICE_INFO deviceInfo{};
|
||||
deviceInfo.pGfxPartition = &gfxPartition;
|
||||
deviceInfo.pDeviceCb = &deviceCallbacks;
|
||||
if (!gmmMemory->setDeviceInfo(&deviceInfo)) {
|
||||
return false;
|
||||
}
|
||||
SYSTEM_INFO sysInfo;
|
||||
Wddm::getSystemInfo(&sysInfo);
|
||||
maximumApplicationAddress = reinterpret_cast<uintptr_t>(sysInfo.lpMaximumApplicationAddress);
|
||||
|
@ -950,7 +981,8 @@ bool Wddm::configureDeviceAddressSpaceImpl() {
|
|||
? maximumApplicationAddress + 1u
|
||||
: 0u;
|
||||
|
||||
return gmmMemory->configureDevice(adapter, device, gdi->escape, svmSize, featureTable->ftrL3IACoherency, gfxPartition, minAddress);
|
||||
bool obtainMinAddress = gfxPlatform->eRenderCoreFamily == IGFX_GEN12LP_CORE;
|
||||
return gmmMemory->configureDevice(adapter, device, gdi->escape, svmSize, featureTable->ftrL3IACoherency, minAddress, obtainMinAddress);
|
||||
}
|
||||
|
||||
void Wddm::waitOnPagingFenceFromCpu() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -195,7 +195,6 @@ class Wddm {
|
|||
bool closeAdapter();
|
||||
void getDeviceState();
|
||||
void handleCompletion(OsContextWin &osContext);
|
||||
bool configureDeviceAddressSpaceImpl();
|
||||
|
||||
static CreateDXGIFactoryFcn createDxgiFactory;
|
||||
static GetSystemInfoFcn getSystemInfo;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
namespace NEO {
|
||||
bool Wddm::configureDeviceAddressSpace() {
|
||||
return configureDeviceAddressSpaceImpl();
|
||||
}
|
||||
|
||||
} // namespace NEO
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -42,11 +42,6 @@ GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIs
|
|||
testDefaultImplementationOfSetupHardwareCapabilities(helper, hardwareInfo);
|
||||
}
|
||||
|
||||
GEN11TEST_F(HwHelperTestGen11, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
|
||||
GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnTwoRcsEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>();
|
||||
EXPECT_EQ(2u, pDevice->engines.size());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -71,11 +71,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenGen12LpPlatformWhenSetupHardwareCapabili
|
|||
}
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, whenGetConfigureAddressSpaceModeThenReturnOne) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(1u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, givenCompressionFtrEnabledWhenAskingForPageTableManagerThenReturnCorrectValue) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#
|
||||
# Copyright (C) 2019 Intel Corporation
|
||||
# Copyright (C) 2019-2020 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(IGDRCL_SRCS_tests_gen12lp_windows
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks_tests_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_gen12lp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wddm_tests_gen12lp.cpp
|
||||
)
|
||||
if(WIN32)
|
||||
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12lp_windows})
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/execution_environment/root_device_environment.h"
|
||||
#include "runtime/os_interface/windows/gdi_interface.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/mocks/mock_execution_environment.h"
|
||||
#include "unit_tests/mocks/mock_wddm.h"
|
||||
#include "unit_tests/os_interface/windows/gdi_dll_fixture.h"
|
||||
|
||||
#include "mock_gmm_memory.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct Gen12LpWddmTest : public GdiDllFixture, ::testing::Test {
|
||||
void SetUp() override {
|
||||
GdiDllFixture::SetUp();
|
||||
|
||||
executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
||||
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(*rootDeviceEnvironment)));
|
||||
gmmMemory = new ::testing::NiceMock<GmockGmmMemory>();
|
||||
wddm->gmmMemory.reset(gmmMemory);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
GdiDllFixture::TearDown();
|
||||
}
|
||||
|
||||
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||
std::unique_ptr<WddmMock> wddm;
|
||||
GmockGmmMemory *gmmMemory = nullptr;
|
||||
};
|
||||
|
||||
GEN12LPTEST_F(Gen12LpWddmTest, whenConfigureDeviceAddressSpaceThenObtainMinAddress) {
|
||||
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.WillByDefault(::testing::Return(true));
|
||||
|
||||
uintptr_t minAddress = 0x12345u;
|
||||
|
||||
EXPECT_NE(NEO::windowsMinAddress, minAddress);
|
||||
|
||||
EXPECT_CALL(*gmmMemory,
|
||||
getInternalGpuVaRangeLimit())
|
||||
.Times(1)
|
||||
.WillRepeatedly(::testing::Return(minAddress));
|
||||
|
||||
auto hwInfoMock = *platformDevices[0];
|
||||
wddm->init(hwInfoMock);
|
||||
|
||||
EXPECT_EQ(minAddress, wddm->getWddmMinAddress());
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -48,11 +48,6 @@ GEN8TEST_F(HwHelperTestGen8, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCal
|
|||
EXPECT_FALSE(hwCaps.isStatelesToStatefullWithOffsetSupported);
|
||||
}
|
||||
|
||||
GEN8TEST_F(HwHelperTestGen8, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
|
||||
GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnTwoRcsEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>();
|
||||
EXPECT_EQ(2u, pDevice->engines.size());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -49,11 +49,6 @@ GEN9TEST_F(HwHelperTestGen9, givenDebuggingActiveWhenSipKernelTypeIsQueriedThenD
|
|||
EXPECT_EQ(SipKernelType::DbgCsrLocal, sipType);
|
||||
}
|
||||
|
||||
GEN9TEST_F(HwHelperTestGen9, whenGetConfigureAddressSpaceModeThenReturnZero) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
EXPECT_EQ(0u, helper.getConfigureAddressSpaceMode());
|
||||
}
|
||||
|
||||
GEN9TEST_F(HwHelperTestGen9, whenGetGpgpuEnginesThenReturnTwoRcsEngines) {
|
||||
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>();
|
||||
EXPECT_EQ(2u, pDevice->engines.size());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -26,13 +26,37 @@ class MockGmmMemoryBase : public GmmMemory {
|
|||
BOOLEAN BDWL3Coherency) override {
|
||||
return true;
|
||||
}
|
||||
|
||||
uintptr_t getInternalGpuVaRangeLimit() override {
|
||||
return NEO::windowsMinAddress;
|
||||
}
|
||||
|
||||
bool setDeviceInfo(GMM_DEVICE_INFO *deviceInfo) override {
|
||||
partition = deviceInfo->pGfxPartition;
|
||||
deviceCallbacks = *deviceInfo->pDeviceCb;
|
||||
return setDeviceInfoValue;
|
||||
}
|
||||
|
||||
GMM_GFX_PARTITIONING *partition = nullptr;
|
||||
bool setDeviceInfoValue = true;
|
||||
GMM_DEVICE_CALLBACKS_INT deviceCallbacks{};
|
||||
};
|
||||
|
||||
class GmockGmmMemoryBase : public GmmMemory {
|
||||
public:
|
||||
~GmockGmmMemoryBase() = default;
|
||||
|
||||
GmockGmmMemoryBase() = default;
|
||||
GmockGmmMemoryBase() {
|
||||
ON_CALL(*this, getInternalGpuVaRangeLimit())
|
||||
.WillByDefault(::testing::Return(NEO::windowsMinAddress));
|
||||
|
||||
ON_CALL(*this, setDeviceInfo(::testing::_))
|
||||
.WillByDefault(::testing::Return(true));
|
||||
}
|
||||
|
||||
MOCK_METHOD0(getInternalGpuVaRangeLimit, uintptr_t());
|
||||
|
||||
MOCK_METHOD1(setDeviceInfo, bool(GMM_DEVICE_INFO *));
|
||||
|
||||
MOCK_METHOD5(configureDeviceAddressSpace,
|
||||
bool(GMM_ESCAPE_HANDLE hAdapter,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -1136,3 +1136,80 @@ TEST_F(Wddm20WithMockGdiDllTests, WhenDestroyingSeparateMonitorFenceThenExpectGd
|
|||
|
||||
EXPECT_EQ(monitorFence.fenceHandle, getDestroySynchronizationObjectDataFcn()->hSyncObject);
|
||||
}
|
||||
namespace NEO {
|
||||
long __stdcall notifyAubCapture(void *csrHandle, uint64_t gfxAddress, size_t gfxSize, bool allocate);
|
||||
}
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoSucceedsThenDeviceCallbacksArePassedToGmmMemory) {
|
||||
GMM_DEVICE_CALLBACKS_INT expectedDeviceCb{};
|
||||
auto hwInfoMock = *platformDevices[0];
|
||||
wddm->init(hwInfoMock);
|
||||
auto gdi = wddm->getGdi();
|
||||
auto gmmMemory = static_cast<MockGmmMemory *>(wddm->getGmmMemory());
|
||||
|
||||
expectedDeviceCb.Adapter.KmtHandle = wddm->getAdapter();
|
||||
expectedDeviceCb.hDevice.KmtHandle = wddm->getDevice();
|
||||
expectedDeviceCb.hCsr = nullptr;
|
||||
expectedDeviceCb.PagingQueue = wddm->getPagingQueue();
|
||||
expectedDeviceCb.PagingFence = wddm->getPagingQueueSyncObject();
|
||||
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnAllocate = gdi->createAllocation;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnDeallocate = gdi->destroyAllocation;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMapGPUVA = gdi->mapGpuVirtualAddress;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnMakeResident = gdi->makeResident;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEvict = gdi->evict;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnReserveGPUVA = gdi->reserveGpuVirtualAddress;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUpdateGPUVA = gdi->updateGpuVirtualAddress;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnWaitFromCpu = gdi->waitForSynchronizationObjectFromCpu;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnLock = gdi->lock2;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnUnLock = gdi->unlock2;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnEscape = gdi->escape;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnFreeGPUVA = gdi->freeGpuVirtualAddress;
|
||||
expectedDeviceCb.DevCbPtrs.KmtCbPtrs.pfnNotifyAubCapture = notifyAubCapture;
|
||||
|
||||
EXPECT_TRUE(memcmp(&expectedDeviceCb, &gmmMemory->deviceCallbacks, sizeof(GMM_DEVICE_CALLBACKS_INT)) == 0);
|
||||
EXPECT_TRUE(memcmp(&expectedDeviceCb.Adapter, &gmmMemory->deviceCallbacks.Adapter, sizeof(GMM_HANDLE_EXT)) == 0);
|
||||
EXPECT_TRUE(memcmp(&expectedDeviceCb.hDevice, &gmmMemory->deviceCallbacks.hDevice, sizeof(GMM_HANDLE_EXT)) == 0);
|
||||
EXPECT_TRUE(memcmp(&expectedDeviceCb.DevCbPtrs.KmtCbPtrs, &gmmMemory->deviceCallbacks.DevCbPtrs.KmtCbPtrs, sizeof(GMM_DEVICE_CB_PTRS::KmtCbPtrs)) == 0);
|
||||
}
|
||||
|
||||
TEST_F(Wddm20WithMockGdiDllTests, whenSetDeviceInfoFailsThenDeviceIsNotConfigured) {
|
||||
|
||||
auto gmockGmmMemory = new ::testing::NiceMock<GmockGmmMemory>();
|
||||
ON_CALL(*gmockGmmMemory, setDeviceInfo(::testing::_))
|
||||
.WillByDefault(::testing::Return(false));
|
||||
EXPECT_CALL(*gmockGmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.Times(0);
|
||||
|
||||
wddm->gmmMemory.reset(gmockGmmMemory);
|
||||
|
||||
auto hwInfoMock = *platformDevices[0];
|
||||
wddm->init(hwInfoMock);
|
||||
}
|
||||
|
||||
HWTEST_F(Wddm20WithMockGdiDllTests, givenNonGen12LPPlatformWhenConfigureDeviceAddressSpaceThenDontObtainMinAddress) {
|
||||
if (platformDevices[0]->platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
auto gmmMemory = new ::testing::NiceMock<GmockGmmMemory>();
|
||||
wddm->gmmMemory.reset(gmmMemory);
|
||||
ON_CALL(*gmmMemory, configureDeviceAddressSpace(::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_,
|
||||
::testing::_))
|
||||
.WillByDefault(::testing::Return(true));
|
||||
|
||||
EXPECT_CALL(*gmmMemory,
|
||||
getInternalGpuVaRangeLimit())
|
||||
.Times(0);
|
||||
|
||||
auto hwInfoMock = *platformDevices[0];
|
||||
wddm->init(hwInfoMock);
|
||||
|
||||
EXPECT_EQ(NEO::windowsMinAddress, wddm->getWddmMinAddress());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue