Skip to content

Commit 0e75f43

Browse files
Add device ids
Signed-off-by: Bartosz Dunajski <[email protected]>
1 parent b93fa8b commit 0e75f43

File tree

7 files changed

+119
-0
lines changed

7 files changed

+119
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
set(IGDRCL_SRCS_tests_xe_hp_core_xehp_linux
8+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9+
)
10+
if(UNIX)
11+
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_xe_hp_core_xehp_linux})
12+
add_subdirectory(dll)
13+
endif()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
set(IGDRCL_SRCS_linux_dll_tests_xe_hp_core_xehp
8+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9+
${CMAKE_CURRENT_SOURCE_DIR}/device_id_tests_xehp.cpp
10+
)
11+
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_xe_hp_core_xehp})
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/os_interface/linux/drm_neo.h"
9+
10+
#include "test.h"
11+
12+
using namespace NEO;
13+
14+
TEST(XeHPDeviceIdTest, GivenSupportedDeviceIdThenConfigIsCorrect) {
15+
DeviceDescriptor expectedDescriptor = {0x0201, &XE_HP_SDV_CONFIG::hwInfo, &XE_HP_SDV_CONFIG::setupHardwareInfo, GTTYPE_GT4};
16+
17+
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
18+
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
19+
first->setupHardwareInfo == second->setupHardwareInfo && first->eGtType == second->eGtType;
20+
};
21+
22+
bool found = false;
23+
24+
for (size_t i = 0; deviceDescriptorTable[i].deviceId != 0; i++) {
25+
if (compareStructs(&expectedDescriptor, &deviceDescriptorTable[i])) {
26+
found = true;
27+
break;
28+
}
29+
};
30+
31+
EXPECT_TRUE(found);
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Copyright (C) 2021 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
7+
set(IGDRCL_SRCS_linux_dll_tests_xe_hpg_core_dg2
8+
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
9+
${CMAKE_CURRENT_SOURCE_DIR}/${BRANCH_DIR_SUFFIX}/device_id_tests_dg2.cpp
10+
)
11+
target_sources(igdrcl_linux_dll_tests PRIVATE ${IGDRCL_SRCS_linux_dll_tests_xe_hpg_core_dg2})
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (C) 2021 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/os_interface/linux/drm_neo.h"
9+
10+
#include "test.h"
11+
12+
#include <array>
13+
14+
using namespace NEO;
15+
16+
TEST(Dg2AdditionalDeviceIdTest, GivenSupportedDeviceIdThenDeviceDescriptorTableExists) {
17+
std::array<DeviceDescriptor, 2> expectedDescriptors = {{
18+
{0x4F80, &DG2_CONFIG::hwInfo, &DG2_CONFIG::setupHardwareInfo, GTTYPE_GT4},
19+
{0x4F87, &DG2_CONFIG::hwInfo, &DG2_CONFIG::setupHardwareInfo, GTTYPE_GT4},
20+
}};
21+
22+
auto compareStructs = [](const DeviceDescriptor *first, const DeviceDescriptor *second) {
23+
return first->deviceId == second->deviceId && first->pHwInfo == second->pHwInfo &&
24+
first->setupHardwareInfo == second->setupHardwareInfo && first->eGtType == second->eGtType;
25+
};
26+
27+
size_t startIndex = 0;
28+
while (!compareStructs(&expectedDescriptors[0], &deviceDescriptorTable[startIndex]) &&
29+
deviceDescriptorTable[startIndex].deviceId != 0) {
30+
startIndex++;
31+
};
32+
EXPECT_NE(0u, deviceDescriptorTable[startIndex].deviceId);
33+
34+
for (auto &expected : expectedDescriptors) {
35+
EXPECT_TRUE(compareStructs(&expected, &deviceDescriptorTable[startIndex]));
36+
startIndex++;
37+
}
38+
}

shared/source/dll/devices/devices_additional.inl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
*
66
*/
77

8+
#ifdef SUPPORT_XE_HPG_CORE
9+
#ifdef SUPPORT_DG2
10+
DEVICE(0x4F80, DG2_CONFIG, GTTYPE_GT4)
11+
DEVICE(0x4F87, DG2_CONFIG, GTTYPE_GT4)
12+
#endif
13+
#endif
14+
815
#ifdef SUPPORT_GEN12LP
916
#ifdef SUPPORT_ADLP
1017
DEVICE(0x46A0, ADLP_CONFIG, GTTYPE_GT2)

shared/source/dll/devices/devices_base.inl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
*/
77

88
// clang-format off
9+
#ifdef SUPPORT_XE_HP_CORE
10+
#ifdef SUPPORT_XE_HP_SDV
11+
DEVICE(0x0201, XE_HP_SDV_CONFIG, GTTYPE_GT4)
12+
#endif
13+
#endif
14+
15+
916
#ifdef SUPPORT_GEN12LP
1017
#ifdef SUPPORT_TGLLP
1118
DEVICE( 0xFF20, TGLLP_1x6x16, GTTYPE_GT2 )

0 commit comments

Comments
 (0)