Skip to content
Snippets Groups Projects
Commit 45290373 authored by Lyude Paul's avatar Lyude Paul
Browse files

WIP: rust: drm/kms: Add drm_crtc bindings


This introduces basic bindings for DRM CRTCs which follow the same general
pattern as connectors and planes (e.g. AsRawCrtc, AsRawCrtcState, etc.).
There is one big difference though - drm_crtc_state appears to be the one
atomic state that actually has data which can be mutated from outside of
the atomic commit phase - which means we can't keep rust referencs to it,
and instead need to use the Opaque type and implement things through
pointers instead.

This should be the last mode object we're introducing for the time being
with its own atomic state. Note that we've not added bindings for private
modesetting objects yet, but I don't think those will be needed for rvkms -
and the same general patterns we're using here should work for adding
private modesetting objects.

Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>

---

TODO:
* Add commit data in the future

V3:
* Add safety comments for ModeObject implementation
* Make AsRawCrtc unsafe, as we need a guarantee that `as_raw()` will always
  return a pointer to a valid `drm_crtc`.
* Update safety comments in atomic_duplicate_state_callback
* Rename generics in Crtc::new to PrimaryData and CursorData
* Add missing safety comment in Crtc::new()
* Improve safety comments in AsRawCrtc
* Break up the conversion from Pin<Box<Crtc>> to &Crtc a bit
* Document why there's an UnsafeCell in CrtcState, because even I forgot
  the reason for this :).
* Introduce UnregisteredCrtc type
* Don't have AsRawCrtc be a supertrait of StaticModeObject. We don't want
  Unregistered mode object variants to be able to return a pointer to the
  DRM device since that would break the UnregisteredKmsDevice pattern.
parent 0400fb37
No related merge requests found
......@@ -3,6 +3,7 @@
//! KMS driver abstractions for rust.
pub mod connector;
pub mod crtc;
pub mod plane;
use crate::{
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment