Struct libamdgpu_top::AMDGPU::DeviceHandle
source · pub struct DeviceHandle(/* private fields */);Implementations§
source§impl DeviceHandle
impl DeviceHandle
sourcepub fn init(fd: i32) -> Result<(DeviceHandle, u32, u32), i32>
pub fn init(fd: i32) -> Result<(DeviceHandle, u32, u32), i32>
Initialization.
Example of fd: /dev/dri/renderD128, /dev/dri/by-path/pci-{[PCI::BUS]}-render
It may require a write option (std::fs::OpenOptions::new().read(true).write(true))
for GUI context.
ref: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2424
pub fn get_fd(&self) -> i32
sourcepub fn get_drm_version(&self) -> Result<(i32, i32, i32), ()>
👎Deprecated since 0.1.3: superseded by get_drm_version_struct
pub fn get_drm_version(&self) -> Result<(i32, i32, i32), ()>
get_drm_version_struct(major, minor, patchlevel)
pub fn get_drm_version_struct(&self) -> Result<drmVersion, i32>
sourcepub fn read_mm_registers(&self, offset: u32) -> Result<u32, i32>
pub fn read_mm_registers(&self, offset: u32) -> Result<u32, i32>
Returns the result of reading the register at the specified offset.
If the offset is not allowed, returns Err(i32).
sourcepub fn get_marketing_name(&self) -> Result<String, Utf8Error>
👎Deprecated since 0.1.3: superseded by get_marketing_name_or_default
pub fn get_marketing_name(&self) -> Result<String, Utf8Error>
get_marketing_name_or_defaultFrom libdrm-2.4.114, it returns the default name (“AMD Radeon Graphics”)
if there is no name that matches amdgpu.ids
https://gitlab.freedesktop.org/mesa/drm/-/commit/a81b9ab8f3fb6840b36f732c1dd25fe5e0d68d0a
sourcepub fn get_marketing_name_or_default(&self) -> String
pub fn get_marketing_name_or_default(&self) -> String
Returns the default marketing name (“AMD Radeon Graphics”) when the device name is not available.
pub fn query_gpu_info(&self) -> Result<amdgpu_gpu_info, i32>
pub fn query_gds_info(&self) -> Result<amdgpu_gds_resource_info, i32>
pub fn query_sw_info(&self, info: amdgpu_sw_info) -> Result<u32, i32>
pub fn device_info(&self) -> Result<drm_amdgpu_info_device, i32>
sourcepub fn vram_gtt_info(&self) -> Result<drm_amdgpu_info_vram_gtt, i32>
pub fn vram_gtt_info(&self) -> Result<drm_amdgpu_info_vram_gtt, i32>
Note: usable_heap_size equal real_size - pin_size - reserved_size, is not fixed.
pub fn memory_info(&self) -> Result<drm_amdgpu_memory_info, i32>
pub fn vram_usage_info(&self) -> Result<u64, i32>
pub fn vis_vram_usage_info(&self) -> Result<u64, i32>
pub fn gtt_usage_info(&self) -> Result<u64, i32>
pub fn gds_info(&self) -> Result<drm_amdgpu_info_gds, i32>
sourcepub fn vce_clock_info(&self) -> Result<drm_amdgpu_info_vce_clock_table, i32>
pub fn vce_clock_info(&self) -> Result<drm_amdgpu_info_vce_clock_table, i32>
AMDGPU driver returns invalid drm_amdgpu_info_vce_clock_table. ref: https://gitlab.freedesktop.org/drm/amd/-/issues/2391
sourcepub fn num_vram_cpu_page_faults(&self) -> Result<u64, i32>
pub fn num_vram_cpu_page_faults(&self) -> Result<u64, i32>
Number of VRAM page faults on CPU access
sourcepub fn num_bytes_moved(&self) -> Result<u64, i32>
pub fn num_bytes_moved(&self) -> Result<u64, i32>
Number of bytes moved for TTM migration
sourcepub fn num_evictions(&self) -> Result<u64, i32>
pub fn num_evictions(&self) -> Result<u64, i32>
Number of TTM buffer evictions
pub fn vram_lost_counter(&self) -> Result<u32, i32>
sourcepub fn get_pci_bus_info(&self) -> Result<BUS_INFO, i32>
pub fn get_pci_bus_info(&self) -> Result<BUS_INFO, i32>
Get PCI::BUS_INFO
sourcepub fn get_min_max_memory_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
pub fn get_min_max_memory_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)
sourcepub fn get_min_max_gpu_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
pub fn get_min_max_gpu_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)
sourcepub fn get_min_max_memory_clock_from_sysfs<P>(
&self,
path: P
) -> Option<(u32, u32)>
pub fn get_min_max_memory_clock_from_sysfs<P>( &self, path: P ) -> Option<(u32, u32)>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)
sourcepub fn get_min_max_memory_clock(&self) -> Option<(u32, u32)>
pub fn get_min_max_memory_clock(&self) -> Option<(u32, u32)>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)
sourcepub fn get_min_max_gpu_clock_from_sysfs<P>(&self, path: P) -> Option<(u32, u32)>
pub fn get_min_max_gpu_clock_from_sysfs<P>(&self, path: P) -> Option<(u32, u32)>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)
sourcepub fn get_min_max_gpu_clock(&self) -> Option<(u32, u32)>
pub fn get_min_max_gpu_clock(&self) -> Option<(u32, u32)>
Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)
sourcepub fn get_sysfs_path(&self) -> Result<PathBuf, i32>
pub fn get_sysfs_path(&self) -> Result<PathBuf, i32>
sourcepub fn get_hwmon_path(&self) -> Option<PathBuf>
pub fn get_hwmon_path(&self) -> Option<PathBuf>
sourcepub fn check_if_secondary_die(&self) -> bool
pub fn check_if_secondary_die(&self) -> bool
ref: drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c ref: https://github.com/RadeonOpenCompute/rocm_smi_lib/blob/master/python_smi_tools/rocm_smi.py
pub fn get_min_max_link_info_from_dpm(&self) -> Option<[LINK; 2]>
pub fn get_max_gpu_link(&self) -> Option<LINK>
pub fn get_max_system_link(&self) -> Option<LINK>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_gpu_metrics_from_sysfs_path<P>( &self, path: P ) -> Result<GpuMetrics, Error>
pub fn get_gpu_metrics(&self) -> Result<GpuMetrics, Error>
pub fn get_raw_gpu_metrics(&self) -> Result<Vec<u8>, Error>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_hwmon_temp(&self, type_: HwmonTempType) -> Option<HwmonTemp>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_power_cap(&self) -> Option<PowerCap>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_all_supported_profiles(&self) -> Vec<PowerProfile>
pub fn get_current_profile(&self) -> Option<PowerProfile>
source§impl DeviceHandle
impl DeviceHandle
source§impl DeviceHandle
impl DeviceHandle
pub fn get_video_caps_info( &self, cap_type: CAP_TYPE ) -> Result<VideoCapsInfo, i32>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_video_caps( &self, type_: CAP_TYPE ) -> Result<drm_amdgpu_info_video_caps, i32>
source§impl DeviceHandle
impl DeviceHandle
pub fn get_hw_ip_info(&self, ip_type: HW_IP_TYPE) -> Result<HwIpInfo, i32>
pub fn query_hw_ip_count(&self, type_: HW_IP_TYPE) -> Result<u32, i32>
sourcepub fn query_hw_ip_info(
&self,
type_: HW_IP_TYPE,
ip_instance: u32
) -> Result<drm_amdgpu_info_hw_ip, i32>
pub fn query_hw_ip_info( &self, type_: HW_IP_TYPE, ip_instance: u32 ) -> Result<drm_amdgpu_info_hw_ip, i32>
Note: ip_instance must be less than AMDGPU_HW_IP_INSTANCE_MAX_COUNT (0 recommended)