mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
refactor: cleanup setupHardwareInfo
Use only `usDeviceID` and `usRevId` (known to be correct) instead of declaring `hwInfo` pointer until the type of the latter is completely initialized. Put initialization of all `hwInfo` fields into `setupHardwareInfo()` for consistency and make overrides explicit. Related-To: NEO-9754 Signed-off-by: Maciej Bielski <maciej.bielski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
38872b7e1b
commit
bfaf2309e8
@@ -36,30 +36,29 @@ Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> &&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");
|
||||
|
||||
Reference in New Issue
Block a user