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 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).
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]>
Sourcepub fn get_max_gpu_link(&self) -> Option<LINK>
pub fn get_max_gpu_link(&self) -> Option<LINK>
Sourcepub fn get_max_system_link(&self) -> Option<LINK>
pub fn get_max_system_link(&self) -> Option<LINK>
Source§impl DeviceHandle
impl DeviceHandle
pub fn create_context(&self) -> Result<ContextHandle, i32>
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
pub fn ras_enabled_features(&self) -> Result<RasEnabledFeatures, i32>
Source§impl DeviceHandle
impl DeviceHandle
pub fn get_vbios_info(&self) -> Result<VbiosInfo, i32>
pub fn vbios_info(&self) -> Result<drm_amdgpu_info_vbios, i32>
pub fn vbios_size(&self) -> Result<u32, i32>
pub fn get_vbios_image(&self) -> Result<Vec<u8>, i32>
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)