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

sys no-std libdrm_amdgpu_sys

libdrm_amdgpu bindings for Rust, and some methods ported from Mesa3D

20 releases (6 breaking)

0.7.5 Aug 14, 2024
0.7.4 Jul 17, 2024
0.7.3 May 29, 2024
0.7.0 Mar 29, 2024
0.1.0 May 28, 2022

#146 in Graphics APIs

Download history 1914/week @ 2024-07-25 1236/week @ 2024-08-01 922/week @ 2024-08-08 1191/week @ 2024-08-15 786/week @ 2024-08-22 851/week @ 2024-08-29 916/week @ 2024-09-05 926/week @ 2024-09-12 2674/week @ 2024-09-19 1666/week @ 2024-09-26 1030/week @ 2024-10-03 935/week @ 2024-10-10 1045/week @ 2024-10-17 919/week @ 2024-10-24 940/week @ 2024-10-31 1524/week @ 2024-11-07

4,629 downloads per month
Used in 5 crates (via libamdgpu_top)

MIT license

7MB
218K 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