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

sys no-std libdrm_amdgpu_sys

libdrm_amdgpu bindings for Rust, and some methods ported from Mesa3D

17 releases (6 breaking)

0.7.2 May 6, 2024
0.7.0 Mar 29, 2024
0.4.0 Dec 13, 2023
0.3.0 Nov 30, 2023
0.1.0 May 28, 2022

#121 in Graphics APIs

Download history 1137/week @ 2024-01-22 465/week @ 2024-01-29 456/week @ 2024-02-05 328/week @ 2024-02-12 597/week @ 2024-02-19 1403/week @ 2024-02-26 1391/week @ 2024-03-04 925/week @ 2024-03-11 617/week @ 2024-03-18 516/week @ 2024-03-25 566/week @ 2024-04-01 491/week @ 2024-04-08 478/week @ 2024-04-15 2591/week @ 2024-04-22 817/week @ 2024-04-29 956/week @ 2024-05-06

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