[2/n] Initialize Wddm interface in Wddm init.

Change-Id: If7184e64df54b4e6840970fec67cb5bc11909b7c
This commit is contained in:
Mrozek, Michal
2018-08-14 09:45:57 +02:00
committed by sys_ocldev
parent a5950500a3
commit 6c5875f805
9 changed files with 27 additions and 12 deletions

View File

@ -246,6 +246,13 @@ bool WddmMock::initializeWithoutConfiguringAddressSpace() {
if (!queryAdapterInfo()) {
return false;
}
if (featureTable->ftrWddmHwQueues) {
wddmInterface = std::make_unique<WddmInterface23>(*this);
} else {
wddmInterface = std::make_unique<WddmInterface20>(*this);
}
if (!createDevice()) {
return false;
}

View File

@ -27,6 +27,7 @@
namespace OCLRT {
class WddmMock23 : public Wddm23 {
public:
using Wddm::featureTable;
using Wddm::preemptionMode;
using Wddm::wddmInterface;
using Wddm23::context;

View File

@ -647,6 +647,7 @@ HWTEST_F(Wddm20Tests, getMaxApplicationAddress) {
}
HWTEST_F(Wddm20Tests, dontCallCreateContextBeforeConfigureDeviceAddressSpace) {
wddm->wddmInterface = std::make_unique<WddmInterface20>(*wddm);
wddm->createContext();
EXPECT_EQ(1u, wddm->createContextResult.called); // dont care about the result
@ -680,7 +681,8 @@ HWTEST_F(Wddm20WithMockGdiDllTests, whenCreateContextIsCalledThenDisableHwQueues
EXPECT_EQ(0u, getCreateContextDataFcn()->Flags.HwQueueSupported);
}
TEST_F(Wddm20Tests, whenCreateHwQueueIsCalledThenAlwaysReturnFalse) {
HWTEST_F(Wddm20Tests, whenCreateHwQueueIsCalledThenAlwaysReturnFalse) {
wddm->init<FamilyType>();
EXPECT_FALSE(wddm->wddmInterface->createHwQueue(wddm->preemptionMode));
}

View File

@ -34,7 +34,9 @@ struct Wddm23Tests : public ::testing::Test, GdiDllFixture, public GmmEnvironmen
void SetUp() override {
GmmEnvironmentFixture::SetUp();
GdiDllFixture::SetUp();
wddm.reset(static_cast<WddmMock23 *>(Wddm::createWddm(WddmInterfaceVersion::Wddm23)));
wddm->featureTable->ftrWddmHwQueues = true;
wddmMockInterface = new WddmMockInterface23(*wddm);
wddm->wddmInterface.reset(wddmMockInterface);
wddm->registryReader.reset(new RegistryReaderMock());
@ -94,11 +96,11 @@ TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutI
HWTEST_F(Wddm23Tests, whenDestroyHwQueueCalledThenPassExistingHandle) {
wddm->init<FamilyType>();
wddmMockInterface->hwQueueHandle = 123;
wddm->wddmInterface->destroyHwQueue();
wddmMockInterface->destroyHwQueue();
EXPECT_EQ(wddmMockInterface->hwQueueHandle, getDestroyHwQueueDataFcn()->hHwQueue);
wddmMockInterface->hwQueueHandle = 0;
wddm->wddmInterface->destroyHwQueue();
wddmMockInterface->destroyHwQueue();
EXPECT_NE(wddmMockInterface->hwQueueHandle, getDestroyHwQueueDataFcn()->hHwQueue); // gdi not called when 0
}