Skip to main content

DeviceHandle

Struct DeviceHandle 

Source
pub struct DeviceHandle { /* private fields */ }

Implementations§

Source§

impl DeviceHandle

Source

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

Source

pub fn get_fd(&self) -> i32

Source

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).

Source

pub fn query_gpu_info(&self) -> Result<amdgpu_gpu_info, i32>

Source

pub fn query_gds_info(&self) -> Result<amdgpu_gds_resource_info, i32>

Source

pub fn query_sw_info(&self, info: amdgpu_sw_info) -> Result<u32, i32>

Source

pub fn device_info(&self) -> Result<drm_amdgpu_info_device, i32>

Source

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.

Source

pub fn memory_info(&self) -> Result<drm_amdgpu_memory_info, i32>

Source

pub fn vram_usage_info(&self) -> Result<u64, i32>

Source

pub fn vis_vram_usage_info(&self) -> Result<u64, i32>

Source

pub fn gtt_usage_info(&self) -> Result<u64, i32>

Source

pub fn gds_info(&self) -> Result<drm_amdgpu_info_gds, i32>

Source

pub fn vce_clock_info(&self) -> Result<drm_amdgpu_info_vce_clock_table, i32>

Source

pub fn num_vram_cpu_page_faults(&self) -> Result<u64, i32>

Number of VRAM page faults on CPU access

Source

pub fn num_bytes_moved(&self) -> Result<u64, i32>

Number of bytes moved for TTM migration

Source

pub fn num_evictions(&self) -> Result<u64, i32>

Number of TTM buffer evictions

Source

pub fn vram_lost_counter(&self) -> Result<u32, i32>

Source

pub fn get_pci_bus_info(&self) -> Result<BUS_INFO, i32>

Source

pub fn get_min_max_memory_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
where P: Into<PathBuf>,

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)

Source

pub fn get_min_max_gpu_clock_from_dpm<P>(&self, path: P) -> Option<[u32; 2]>
where P: Into<PathBuf>,

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)

Source

pub fn get_min_max_memory_clock_from_sysfs<P>( &self, path: P, ) -> Option<(u32, u32)>
where P: Into<PathBuf>,

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)

Source

pub fn get_min_max_memory_clock(&self) -> Option<(u32, u32)>

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_mclk)

Source

pub fn get_min_max_gpu_clock_from_sysfs<P>(&self, path: P) -> Option<(u32, u32)>
where P: Into<PathBuf>,

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)

Source

pub fn get_min_max_gpu_clock(&self) -> Option<(u32, u32)>

Get the min/max gpu core clock (MHz) from sysfs (pp_dpm_sclk)

Source

pub fn get_sysfs_path(&self) -> Result<PathBuf, i32>

Source

pub fn get_hwmon_path(&self) -> Option<PathBuf>

Source

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

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source

pub fn get_vbios_info(&self) -> Result<VbiosInfo, i32>

Source

pub fn vbios_info(&self) -> Result<drm_amdgpu_info_vbios, i32>

Source

pub fn vbios_size(&self) -> Result<u32, i32>

Source

pub fn get_vbios_image(&self) -> Result<Vec<u8>, i32>

Source§

impl DeviceHandle

Source

pub fn get_video_caps_info( &self, cap_type: CAP_TYPE, ) -> Result<VideoCapsInfo, i32>

Source§

impl DeviceHandle

Source§

impl DeviceHandle

Source

pub fn get_hw_ip_info(&self, ip_type: HW_IP_TYPE) -> Result<HwIpInfo, i32>

Source

pub fn query_hw_ip_count(&self, type_: HW_IP_TYPE) -> Result<u32, i32>

Source

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)

Source§

impl DeviceHandle

Source

pub fn query_firmware_version( &self, fw_type: FW_TYPE, ip_instance: u32, index: u32, ) -> Result<FwVer, i32>

Note: ip_instance must be 0.

Source§

impl DeviceHandle

Source

pub fn sensor_info(&self, sensor_type: SENSOR_TYPE) -> Result<u32, i32>

Source§

impl DeviceHandle

Trait Implementations§

Source§

impl Drop for DeviceHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for DeviceHandle

Source§

impl Sync for DeviceHandle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.