diretto

Crates.iodiretto
lib.rsdiretto
version
sourcesrc
created_at2024-06-21 15:22:59.739489
updated_at2024-12-19 19:36:03.012294
descriptionSimple library to interact with the drm interface
homepage
repositoryhttps://github.com/verdiwm/diretto
max_upload_size
id1279621
Cargo.toml error:TOML parse error at line 23, column 1 | 23 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Federico Maria Morrone (morr0ne)

documentation

https://docs.rs/diretto

README

Diretto

Diretto is a lightweight yet powerful Rust library designed to facilitate interaction with the Linux kernel's Direct Rendering Manager (DRM) interface.

Overview

Diretto offers robust abstractions over both the legacy DRM API and the modern atomic modesetting API. It is purpose-built for Linux environments, bypassing the need for the standard C library (libc) and directly interfacing with the kernel through the Rust-based rustix crate.

One of the unique features of Diretto is its approach to device management. Unlike other libraries, Diretto assumes full ownership of the DRM device,. This design not only simplifies the API but also enhances safety by providing a reliable mechanism to verify that the device being opened supports the necessary DRM ioctls.

Usage

The core of the Diretto library is the Device struct, which serves as the primary entry point for interacting with DRM devices. Although helper APIs are still under development, you can already use Diretto with a more manual approach. The example below demonstrates how to open a file descriptor using rustix and create a new Device instance:

use rustix::fs::{self, OFlags, Mode};
use diretto::Device;

let fd = fs::open(
     "/dev/dri/card0",
     OFlags::RDWR | OFlags::NONBLOCK,
     Mode::empty(),
 )?;
let device = unsafe { Device::new_unchecked(fd) };

For a more advanced usage example, including rendering to the screen with wgpu, refer to the example code.

License

This project is licensed under the Apache-2.0 License. For more information, please see the LICENSE file.

Commit count: 39

cargo fmt