forked from unom/punktfunk
#![deny(clippy::undocumented_unsafe_blocks)] never inspected the body of an unsafe fn — operations there are not "unsafe blocks" — so roughly 20 functions' worth of raw GL/CUDA/Vulkan driver calls sat outside the invariant the crate advertises. Concretely, that blind spot is why the constructor-leak and teardown-ordering shapes fixed earlier in this series could ship without ever prompting a reviewer. #![deny(unsafe_op_in_unsafe_fn)] now closes the gap: every unsafe fn body is an explicit unsafe block carrying a SAFETY comment that names the caller contract it relies on (the dlopen'd CUDA wrapper table gets a uniform forward-to-live-table proof). Mechanical; no behavior change. (V2 from design/pf-zerocopy-sweep-handoff.md.) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
27 lines
1.4 KiB
Rust
27 lines
1.4 KiB
Rust
//! Linux GPU zero-copy plumbing (plan §9), extracted from the host's `linux/zerocopy/` module
|
|
//! tree (plan §W6): the shared CUDA context + device buffers, the EGL/Vulkan dmabuf importers,
|
|
//! the isolated import-worker subprocess (client/proto/worker), the zero-copy policy latches, and
|
|
//! the dmabuf implicit-fence wait. Everything is Linux-only; on other targets this crate compiles
|
|
//! to an empty lib so dependents can carry a plain (non-target-gated) dependency.
|
|
//!
|
|
//! The `PixelFormat → DRM FourCC` mapping (`drm_fourcc`) deliberately does NOT live here — it
|
|
//! consumes the shared frame vocabulary, which sits ABOVE this crate (this crate provides the
|
|
//! `DeviceBuffer` that vocabulary's `FramePayload::Cuda` owns).
|
|
|
|
// Unsafe-proof program: every `unsafe {}` / `unsafe impl` must carry a `// SAFETY:` proof. Each
|
|
// file keeps its own `#![deny(...)]` too; this crate-root deny is the catch-all gate.
|
|
// `unsafe_op_in_unsafe_fn` closes the gap the clippy lint leaves: operations inside an
|
|
// `unsafe fn` body are not "unsafe blocks", so without it ~45 functions' worth of raw driver
|
|
// calls sat OUTSIDE the invariant this crate advertises.
|
|
#![deny(clippy::undocumented_unsafe_blocks)]
|
|
#![deny(unsafe_op_in_unsafe_fn)]
|
|
|
|
/// Wait for a dmabuf's implicit read-ready fence (`DMA_BUF_IOCTL_EXPORT_SYNC_FILE` + poll).
|
|
#[cfg(target_os = "linux")]
|
|
pub mod dmabuf_fence;
|
|
|
|
#[cfg(target_os = "linux")]
|
|
mod imp;
|
|
#[cfg(target_os = "linux")]
|
|
pub use imp::*;
|