2019-12-23 21:28:33 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 01:46:50 +08:00
|
|
|
#include "command_stream/preemption.h"
|
|
|
|
#include "execution_environment/root_device_environment.h"
|
|
|
|
#include "os_interface/windows/gdi_interface.h"
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
|
|
|
#include "opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h"
|
2019-12-23 21:28:33 +08:00
|
|
|
#include "test.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>();
|
2020-01-24 22:03:28 +08:00
|
|
|
executionEnvironment->initGmm();
|
2019-12-23 21:28:33 +08:00
|
|
|
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
|
2020-02-07 17:29:56 +08:00
|
|
|
wddm.reset(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment)));
|
2020-01-24 22:03:28 +08:00
|
|
|
gmmMemory = new ::testing::NiceMock<GmockGmmMemory>(executionEnvironment->getGmmClientContext());
|
2019-12-23 21:28:33 +08:00
|
|
|
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));
|
|
|
|
|
2020-02-10 18:15:34 +08:00
|
|
|
wddm->init();
|
2019-12-23 21:28:33 +08:00
|
|
|
|
|
|
|
EXPECT_EQ(minAddress, wddm->getWddmMinAddress());
|
|
|
|
}
|