2018-11-30 10:25:47 +01:00
|
|
|
/*
|
2020-01-31 14:35:46 +01:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-11-30 10:25:47 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-04-02 11:28:38 +02:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/windows/os_interface.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-03-16 16:58:04 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_execution_environment.h"
|
|
|
|
#include "opencl/test/unit_test/mocks/mock_wddm.h"
|
2018-11-30 10:25:47 +01:00
|
|
|
#include "test.h"
|
|
|
|
|
2020-03-16 16:58:04 +01:00
|
|
|
using namespace NEO;
|
|
|
|
|
2018-11-30 10:25:47 +01:00
|
|
|
TEST(osInterfaceTests, osInterfaceLocalMemoryEnabledByDefault) {
|
2020-03-16 16:58:04 +01:00
|
|
|
EXPECT_TRUE(OSInterface::osEnableLocalMemory);
|
|
|
|
}
|
|
|
|
|
2020-07-22 12:51:48 +02:00
|
|
|
TEST(osInterfaceTests, whenOsInterfaceSetupGmmInputArgsThenArgsAreSet) {
|
2020-03-16 16:58:04 +01:00
|
|
|
MockExecutionEnvironment executionEnvironment;
|
|
|
|
RootDeviceEnvironment rootDeviceEnvironment(executionEnvironment);
|
|
|
|
auto wddm = new WddmMock(rootDeviceEnvironment);
|
2020-04-08 11:45:54 +02:00
|
|
|
EXPECT_EQ(nullptr, rootDeviceEnvironment.osInterface.get());
|
2020-03-16 16:58:04 +01:00
|
|
|
wddm->init();
|
2020-04-08 11:45:54 +02:00
|
|
|
EXPECT_NE(nullptr, rootDeviceEnvironment.osInterface.get());
|
2020-03-16 16:58:04 +01:00
|
|
|
|
2020-08-05 13:58:44 +02:00
|
|
|
wddm->deviceRegistryPath = "registyPath";
|
|
|
|
auto expectedRegistryPath = wddm->deviceRegistryPath.c_str();
|
2020-03-16 16:58:04 +01:00
|
|
|
auto &adapterBDF = wddm->adapterBDF;
|
|
|
|
adapterBDF.Bus = 0x12;
|
|
|
|
adapterBDF.Device = 0x34;
|
|
|
|
adapterBDF.Function = 0x56;
|
|
|
|
|
|
|
|
GMM_INIT_IN_ARGS gmmInputArgs = {};
|
|
|
|
EXPECT_NE(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
|
2020-08-05 13:58:44 +02:00
|
|
|
EXPECT_STRNE(expectedRegistryPath, gmmInputArgs.DeviceRegistryPath);
|
2020-07-22 12:51:48 +02:00
|
|
|
|
2020-04-08 11:45:54 +02:00
|
|
|
rootDeviceEnvironment.osInterface->setGmmInputArgs(&gmmInputArgs);
|
2020-07-22 12:51:48 +02:00
|
|
|
|
2020-03-16 16:58:04 +01:00
|
|
|
EXPECT_EQ(0, memcmp(&adapterBDF, &gmmInputArgs.stAdapterBDF, sizeof(ADAPTER_BDF)));
|
2020-07-22 12:51:48 +02:00
|
|
|
EXPECT_EQ(GMM_CLIENT::GMM_OCL_VISTA, gmmInputArgs.ClientType);
|
2020-08-05 13:58:44 +02:00
|
|
|
EXPECT_STREQ(expectedRegistryPath, gmmInputArgs.DeviceRegistryPath);
|
2018-11-30 10:25:47 +01:00
|
|
|
}
|