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

WIP: rust/kms/drm: Add RawPlaneState::atomic_helper_check()


Add a binding for DRM's plane state atomic check helper.

TODO:
* Finish up documentation (we need to document parameters too! I think?)

Signed-off-by: Lyude Paul's avatarLyude Paul <lyude@redhat.com>
parent 22c1e4e1
No related branches found
No related tags found
No related merge requests found
......@@ -396,6 +396,31 @@ pub trait RawPlaneState: AsRawPlaneState {
// SAFETY: We're guaranteed `crtc` is of type `OpaqueCrtc` by type invariance
NonNull::new(self.as_raw().crtc).map(|c| unsafe { OpaqueCrtc::from_raw(c.as_ptr()) })
}
/// Run the atomic check helper for this plane and the given CRTC state
fn atomic_helper_check<S>(
&mut self,
crtc_state: &BorrowedCrtcState<'_, S>,
can_position: bool,
can_update_disabled: bool
) -> Result
where
S: FromRawCrtcState,
S::Crtc: AsRawCrtc<Driver = <Self::Plane as ModeObject>::Driver>
{
// SAFETY: We're passing the mutable reference from `self.as_raw_mut()` directly to DRM,
// which is safe.
to_result(unsafe {
bindings::drm_atomic_helper_check_plane_state(
self.as_raw_mut(),
crtc_state.as_raw(),
bindings::DRM_PLANE_NO_SCALING as _, // TODO: add parameters for scaling
bindings::DRM_PLANE_NO_SCALING as _,
can_position,
can_update_disabled
)
})
}
}
impl<T: AsRawPlaneState + ?Sized> RawPlaneState for T {}
......
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