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

fixup! rust: drm/kms: Add bindings for drm_encoder

parent 7aa23260
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
//! drm_encoder abstractions for rust
use crate::{
alloc::KBox,
drm::{
device::Device,
drv::Driver,
......@@ -204,7 +205,7 @@ impl<T: DriverEncoder> Encoder<T> {
name: Option<&CStr>,
args: T::Args,
) -> Result<&'b Self> {
let this: Pin<Box<Self>> = Box::try_pin_init(
let this: Pin<KBox<Self>> = KBox::try_pin_init(
try_pin_init!(Self {
encoder: Opaque::new(bindings::drm_encoder {
helper_private: &T::OPS.helper_funcs,
......@@ -231,7 +232,7 @@ impl<T: DriverEncoder> Encoder<T> {
// Convert the box into a raw pointer, we'll re-assemble it in encoder_destroy_callback()
// SAFETY: We don't move anything
Ok(unsafe { &*Box::into_raw(Pin::into_inner_unchecked(this)) })
Ok(unsafe { &*KBox::into_raw(Pin::into_inner_unchecked(this)) })
}
}
......@@ -299,5 +300,5 @@ unsafe extern "C" fn encoder_destroy_callback<T: DriverEncoder>(
// SAFETY:
// - DRM guarantees we are now the only one with access to this [`drm_encoder`].
// - This cast is safe via `DriverEncoder`s type invariants.
unsafe { drop(Box::from_raw(encoder as *mut Encoder<T>)) };
unsafe { drop(KBox::from_raw(encoder as *mut Encoder<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