Added driver_name to amdsmi_cli tool
Signed-off-by: Maisam Arif <maisarif@amd.com>
Change-Id: I8f3d52e0b23298443b2b16afec418cbbbc5f77e0
[ROCm/amdsmi commit: 572bf563d1]
This commit is contained in:
1 förälder
0a655243a4
incheckning
401d3f229c
11 files changed
+50
-4
No files matched your search
@@ -1721,18 +1721,30 @@ amdsmi_status_t amdsmi_get_gpu_driver_info(amdsmi_processor_handle processor_han
|
||||
return r;
|
||||
|
||||
int length = AMDSMI_MAX_STRING_LENGTH;
|
||||
|
||||
// Get the driver version
|
||||
status = smi_amdgpu_get_driver_version(gpu_device,
|
||||
&length, info->driver_version);
|
||||
|
||||
// Get the driver date
|
||||
std::string driver_date;
|
||||
status = gpu_device->amdgpu_query_driver_date(driver_date);
|
||||
if (status != AMDSMI_STATUS_SUCCESS) return r;
|
||||
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
// Reformat the driver date from 20150101 to 2015/01/01 00:00
|
||||
if (driver_date.length() == 8) {
|
||||
driver_date = driver_date.substr(0, 4) + "/" + driver_date.substr(4, 2)
|
||||
+ "/" + driver_date.substr(6, 2) + " 00:00";
|
||||
}
|
||||
strncpy(info->driver_date, driver_date.c_str(), AMDSMI_MAX_STRING_LENGTH-1);
|
||||
|
||||
// Get the driver name
|
||||
std::string driver_name;
|
||||
status = gpu_device->amdgpu_query_driver_name(driver_name);
|
||||
if (status != AMDSMI_STATUS_SUCCESS)
|
||||
return r;
|
||||
strncpy(info->driver_name, driver_name.c_str(), AMDSMI_MAX_STRING_LENGTH-1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
@@ -197,6 +197,18 @@ amdsmi_status_t AMDSmiDrm::cleanup() {
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiDrm::amdgpu_query_driver_name(int fd, std::string& driver_name) {
|
||||
// RAII handler
|
||||
using drm_version_ptr = std::unique_ptr<drmVersion,
|
||||
decltype(&drmFreeVersion)>;
|
||||
std::lock_guard<std::mutex> guard(drm_mutex_);
|
||||
auto version = drm_version_ptr(
|
||||
drm_get_version_(fd), drm_free_version_);
|
||||
if (version == nullptr) return AMDSMI_STATUS_DRM_ERROR;
|
||||
driver_name = version->name;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiDrm::amdgpu_query_driver_date(int fd, std::string& driver_date) {
|
||||
// RAII handler
|
||||
using drm_version_ptr = std::unique_ptr<drmVersion,
|
||||
|
||||
@@ -105,6 +105,15 @@ amdsmi_status_t AMDSmiGPUDevice::amdgpu_query_info(unsigned info_id,
|
||||
return drm_.amdgpu_query_info(fd, info_id, size, value);
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiGPUDevice::amdgpu_query_driver_name(std::string& name) const {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t fd = 0;
|
||||
ret = drm_.get_drm_fd_by_index(gpu_id_, &fd);
|
||||
if (ret != AMDSMI_STATUS_SUCCESS) return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
|
||||
return drm_.amdgpu_query_driver_name(fd, name);
|
||||
}
|
||||
|
||||
amdsmi_status_t AMDSmiGPUDevice::amdgpu_query_driver_date(std::string& date) const {
|
||||
amdsmi_status_t ret;
|
||||
uint32_t fd = 0;
|
||||
|
||||
Reference in new issue
Block a user