Re: [RFC v3 07/33] rust: drm/kms: Add drm_encoder bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 05, 2025 at 05:59:23PM -0500, Lyude Paul wrote:
> +unsafe extern "C" fn encoder_destroy_callback<T: DriverEncoder>(
> +    encoder: *mut bindings::drm_encoder,
> +) {
> +    // SAFETY: DRM guarantees that `encoder` points to a valid initialized `drm_encoder`.
> +    unsafe { bindings::drm_encoder_cleanup(encoder) };
> +
> +    // 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(KBox::from_raw(encoder as *mut Encoder<T>)) };
> +}

I'm not sure we should expose drm_encoder_cleanup() there, if only
because it's not really up to the driver to deal with it anymore. We're
switching to drmm_encoder_alloc/init where having a destroy hook is
explicitly rejected.

Maxime

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux