#amd-gpu #linux-kernel #libdrm #drm #bindings #driver #ported

sys no-std libdrm_amdgpu_sys

libdrm_amdgpu bindings for Rust, and some methods ported from Mesa3D

21 releases

new 0.7.6 Nov 28, 2024
0.7.4 Jul 17, 2024
0.7.0 Mar 29, 2024
0.4.0 Dec 13, 2023
0.1.0 May 28, 2022

#131 in Graphics APIs

Download history 1206/week @ 2024-08-12 878/week @ 2024-08-19 847/week @ 2024-08-26 970/week @ 2024-09-02 837/week @ 2024-09-09 1449/week @ 2024-09-16 2735/week @ 2024-09-23 1134/week @ 2024-09-30 936/week @ 2024-10-07 1088/week @ 2024-10-14 976/week @ 2024-10-21 943/week @ 2024-10-28 1493/week @ 2024-11-04 3085/week @ 2024-11-11 1643/week @ 2024-11-18 1198/week @ 2024-11-25

7,557 downloads per month
Used in 5 crates (via libamdgpu_top)

MIT license

4.5MB
82K SLoC

libdrm-amdgpu-sys-rs

libdrm_amdgpu bindings for Rust, and some methods ported from Mesa3D (mainly ac_gpu_info.c).

Reference

License

  • MIT License

Documentation

Dependent dynamic libraries

  • libdrm
  • libdrm_amdgpu

Distribution specific instructions

Debian/Ubuntu

sudo apt install libdrm-dev

Examples

let (amdgpu_dev, drm_major, drm_minor) = {
    use std::fs::OpenOptions;
    use std::os::fd::IntoRawFd;

    let fd = OpenOptions::new().read(true).write(true).open("/dev/dri/renderD128").unwrap();

    AMDGPU::DeviceHandle::init(fd.into_raw_fd()).unwrap()
};
let mark_name = amdgpu_dev.get_marketing_name().unwrap();
let device_info = amdgpu_dev.device_info().unwrap();

amdgpu_info

cargo run --example amdgpu_info

vbios_dump

cargo run --example vbios_dump

gpu_metrics

cargo run --example gpu_metrics

Build

To generate a new bindings/drm.rs .

cargo build --features=buildtime_bindgen

Dependencies