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 get_drm_version(&self) -> Result<(i32, i32, i32), ()>

👎Deprecated since 0.1.3: superseded by get_drm_version_struct

(major, minor, patchlevel)

source

pub fn get_drm_version_struct(&self) -> Result<drmVersion, 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 get_marketing_name(&self) -> Result<String, Utf8Error>

👎Deprecated since 0.1.3: superseded by get_marketing_name_or_default

From 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

source

pub fn get_marketing_name_or_default(&self) -> String

Returns the default marketing name (“AMD Radeon Graphics”) when the device name is not available.

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

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

source

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

source

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

source

pub unsafe fn vbios_image(&self, vbios_size: u32) -> Result<Vec<u8>, i32>

source§

impl DeviceHandle

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>

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>,

§

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>,

§

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.