2018-11-30 10:25:47 +01:00
|
|
|
/*
|
2023-01-23 14:55:52 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-11-30 10:25:47 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-01-23 14:55:52 +00:00
|
|
|
#include "shared/source/gmm_helper/gmm_lib.h"
|
2020-04-02 11:28:38 +02:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2021-05-21 01:17:57 +02:00
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2021-07-06 15:44:16 +02:00
|
|
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
|
|
|
|
#include "shared/test/common/mocks/mock_wddm.h"
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/test/common/test_macros/hw_test.h"
|
2018-11-30 10:25:47 +01:00
|
|
|
|
2020-03-16 16:58:04 +01:00
|
|
|
using namespace NEO;
|
|
|
|
|
|
2021-01-04 10:47:00 +01:00
|
|
|
TEST(osInterfaceTests, GivenDefaultOsInterfaceThenLocalMemoryEnabled) {
|
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
|
|
|
|
2021-02-01 15:50:27 +00:00
|
|
|
wddm->deviceRegistryPath = "registryPath";
|
2020-08-05 13:58:44 +02:00
|
|
|
auto expectedRegistryPath = wddm->deviceRegistryPath.c_str();
|
2020-03-16 16:58:04 +01:00
|
|
|
auto &adapterBDF = wddm->adapterBDF;
|
2021-07-11 00:12:15 +00:00
|
|
|
uint32_t bus = 0x12;
|
|
|
|
|
adapterBDF.Bus = bus;
|
|
|
|
|
uint32_t device = 0x34;
|
|
|
|
|
adapterBDF.Device = device;
|
|
|
|
|
uint32_t function = 0x56;
|
|
|
|
|
adapterBDF.Function = function;
|
|
|
|
|
|
2020-03-16 16:58:04 +01:00
|
|
|
GMM_INIT_IN_ARGS gmmInputArgs = {};
|
2023-06-13 15:19:02 +00:00
|
|
|
EXPECT_NE(0, memcmp(&wddm->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
|
|
|
|
2021-05-21 01:17:57 +02:00
|
|
|
rootDeviceEnvironment.osInterface->getDriverModel()->setGmmInputArgs(&gmmInputArgs);
|
2020-07-22 12:51:48 +02:00
|
|
|
|
2023-06-13 15:19:02 +00:00
|
|
|
EXPECT_EQ(0, memcmp(&wddm->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
|
|
|
}
|