mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Move DriverInfo to shared/source/os_interface
Related-To: NEO-4457 Change-Id: I427cceeee9b2804fdd047c8a6acde3ad5f85923f Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
860cdee774
commit
97bad05923
@@ -12,8 +12,6 @@ set(RUNTIME_SRCS_OS_INTERFACE_WINDOWS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/d3d_sharing_functions.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_caps_init_win.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/device_command_stream.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ocl_reg_path.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/os_metrics_library.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/performance_counters_win.cpp
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opencl/source/device/driver_info.h"
|
||||
|
||||
#include "shared/source/os_interface/windows/debug_registry_reader.h"
|
||||
#include "shared/source/os_interface/windows/os_interface.h"
|
||||
#include "shared/source/os_interface/windows/wddm/wddm.h"
|
||||
|
||||
#include "opencl/source/os_interface/windows/driver_info.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
DriverInfoWindows::DriverInfoWindows(std::string &&fullPath) : path(DriverInfoWindows::trimRegistryKey(fullPath)) {}
|
||||
|
||||
DriverInfo *DriverInfo::create(OSInterface *osInterface) {
|
||||
if (osInterface) {
|
||||
auto wddm = osInterface->get()->getWddm();
|
||||
DEBUG_BREAK_IF(wddm == nullptr);
|
||||
|
||||
std::string path(wddm->getDeviceRegistryPath());
|
||||
|
||||
auto driverInfo = new DriverInfoWindows(std::move(path));
|
||||
|
||||
driverInfo->setRegistryReader(new RegistryReader(false, driverInfo->getRegistryPath()));
|
||||
return driverInfo;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
};
|
||||
|
||||
void DriverInfoWindows::setRegistryReader(SettingsReader *reader) {
|
||||
registryReader.reset(reader);
|
||||
}
|
||||
|
||||
std::string DriverInfoWindows::trimRegistryKey(std::string path) {
|
||||
std::string prefix("\\REGISTRY\\MACHINE\\");
|
||||
auto pos = prefix.find(prefix);
|
||||
if (pos != std::string::npos)
|
||||
path.erase(pos, prefix.length());
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string DriverInfoWindows::getDeviceName(std::string defaultName) {
|
||||
return registryReader.get()->getSetting("HardwareInformation.AdapterString", defaultName);
|
||||
}
|
||||
|
||||
std::string DriverInfoWindows::getVersion(std::string defaultVersion) {
|
||||
return registryReader.get()->getSetting("DriverVersion", defaultVersion);
|
||||
};
|
||||
|
||||
const std::string &DriverInfoWindows::getRegistryPath() const {
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "opencl/source/device/driver_info.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
class SettingsReader;
|
||||
|
||||
class DriverInfoWindows : public DriverInfo {
|
||||
public:
|
||||
DriverInfoWindows(std::string &&path);
|
||||
std::string getDeviceName(std::string defaultName);
|
||||
std::string getVersion(std::string defaultVersion);
|
||||
|
||||
void setRegistryReader(SettingsReader *reader);
|
||||
const std::string &getRegistryPath() const;
|
||||
|
||||
protected:
|
||||
static std::string trimRegistryKey(std::string key);
|
||||
const std::string path;
|
||||
std::unique_ptr<SettingsReader> registryReader;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user