diff --git a/shared/source/dll/linux/drm_neo_create.cpp b/shared/source/dll/linux/drm_neo_create.cpp index 5859b7af4e..7d701e98cd 100644 --- a/shared/source/dll/linux/drm_neo_create.cpp +++ b/shared/source/dll/linux/drm_neo_create.cpp @@ -36,30 +36,29 @@ Drm *Drm::create(std::unique_ptr &&hwDeviceId, RootDeviceEnvironm if (!drm->queryDeviceIdAndRevision()) { return nullptr; } - auto hwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); - if (!DeviceFactory::isAllowedDeviceId(hwInfo->platform.usDeviceID, debugManager.flags.FilterDeviceId.get())) { + + const auto usDeviceID = rootDeviceEnvironment.getHardwareInfo()->platform.usDeviceID; + const auto usRevId = rootDeviceEnvironment.getHardwareInfo()->platform.usRevId; + if (!DeviceFactory::isAllowedDeviceId(usDeviceID, debugManager.flags.FilterDeviceId.get())) { return nullptr; } const DeviceDescriptor *deviceDescriptor = nullptr; - const char *deviceName = ""; for (auto &deviceDescriptorEntry : deviceDescriptorTable) { - if (hwInfo->platform.usDeviceID == deviceDescriptorEntry.deviceId) { + if (usDeviceID == deviceDescriptorEntry.deviceId) { deviceDescriptor = &deviceDescriptorEntry; - deviceName = deviceDescriptorEntry.devName; break; } } if (!deviceDescriptor) { printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, - "FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", hwInfo->platform.usDeviceID, hwInfo->platform.usRevId); + "FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", usDeviceID, usRevId); return nullptr; } if (drm->setupHardwareInfo(deviceDescriptor, true)) { return nullptr; } - hwInfo->capabilityTable.deviceName = deviceName; if (drm->enableTurboBoost()) { printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n"); diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 4fc44dd70d..52ee0038d1 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -461,11 +461,15 @@ int Drm::getErrno() { } int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTableAndWorkaroundTable) { - HardwareInfo *hwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); - auto deviceId = hwInfo->platform.usDeviceID; - auto revisionId = hwInfo->platform.usRevId; + const auto usDeviceIdOverride = rootDeviceEnvironment.getHardwareInfo()->platform.usDeviceID; + const auto usRevIdOverride = rootDeviceEnvironment.getHardwareInfo()->platform.usRevId; + // reset hwInfo and apply overrides rootDeviceEnvironment.setHwInfo(device->pHwInfo); + HardwareInfo *hwInfo = rootDeviceEnvironment.getMutableHardwareInfo(); + hwInfo->platform.usDeviceID = usDeviceIdOverride; + hwInfo->platform.usRevId = usRevIdOverride; + rootDeviceEnvironment.initProductHelper(); rootDeviceEnvironment.initGfxCoreHelper(); rootDeviceEnvironment.initApiGfxCoreHelper(); @@ -477,9 +481,6 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl return -1; } - hwInfo->platform.usDeviceID = deviceId; - hwInfo->platform.usRevId = revisionId; - const auto productFamily = hwInfo->platform.eProductFamily; setupIoctlHelper(productFamily); ioctlHelper->setupIpVersion(); @@ -539,6 +540,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl } setupCacheInfo(*hwInfo); + hwInfo->capabilityTable.deviceName = device->devName; return 0; }