Skip to content

Commit 02ec657

Browse files
Fix reading device pci path
Signed-off-by: Kamil Diedrich <[email protected]>
1 parent d69ffd3 commit 02ec657

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

opencl/source/sharings/va/va_device_shared.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ ClDevice *VADevice::getRootDeviceFromVaDisplay(Platform *pPlatform, VADisplay va
4747
return nullptr;
4848
}
4949

50-
std::string_view prefixView = "../../devices/pci0000:00/0000:";
5150
std::string_view devicePathView(devicePath, static_cast<size_t>(readLinkSize));
52-
devicePathView.remove_prefix(prefixView.size());
53-
devicePathView = devicePathView.substr(0, 7);
51+
devicePathView = devicePathView.substr(devicePathView.find("/drm/render") - 7u, 7u);
5452

5553
for (size_t i = 0; i < pPlatform->getNumDevices(); ++i) {
5654
auto device = pPlatform->getClDevice(i);

opencl/test/unit_test/os_interface/linux/sys_calls_linux_ult.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ int readlink(const char *path, char *buf, size_t bufsize) {
8585
return -1;
8686
}
8787

88-
constexpr size_t sizeofPath = sizeof("../../devices/pci0000:00/0000:00:02.0/drm/renderD128");
88+
constexpr size_t sizeofPath = sizeof("../../devices/pci0000:4a/0000:4a:02.0/0000:4b:00.0/0000:4c:01.0/0000:00:02.0/drm/renderD128");
8989

90-
strcpy_s(buf, sizeofPath, "../../devices/pci0000:00/0000:00:02.0/drm/renderD128");
90+
strcpy_s(buf, sizeofPath, "../../devices/pci0000:4a/0000:4a:02.0/0000:4b:00.0/0000:4c:01.0/0000:00:02.0/drm/renderD128");
9191
return sizeofPath;
9292
}
9393

0 commit comments

Comments
 (0)