Skip to main content

Module surface

Module surface 

Source
Expand description

Kernel adapter for the fbsurface crate.

fbsurface owns the geometry, the format rules and the clipping. This module supplies the two pieces that are kernel-specific:

  • KernelOps, which forwards the 32-bit primitives to the existing SSE2/AVX2/scalar backend in FramebufferOps and returns an FpuGuard so every drawing call preserves the caller’s SSE state;
  • Presenter, which owns the write-combining framebuffer surface and the refresh policy (PRESENT_MIN_TICKS), and copies damaged rectangles from a back surface.

The intended split is: buffers and damage are fbsurface types, the refresh policy is Presenter, and the raw pixels stay behind FramebufferOps.

Β§Example

β“˜
let surface: Canvas<'_, KernelOps> = unsafe {
    Canvas::direct(
        base,
        Dims::new(1920, 1080),
        1920 * 4,
        Format::XRGB8888,
        /* write_combining = */ true,
        KernelOps::new(ops()),
    )
}
.unwrap();

Re-exportsΒ§

use core::ptr::NonNull; πŸ”’
use fbsurface::Canvas; πŸ”’
use fbsurface::Dims; πŸ”’
use fbsurface::Format; πŸ”’
use fbsurface::OwnedSurface; πŸ”’
use fbsurface::PixelGuard; πŸ”’
use fbsurface::PixelOps; πŸ”’
use fbsurface::Rect; πŸ”’
use fbsurface::RectSet; πŸ”’
use fbsurface::Source; πŸ”’
use crate::framebuffer::FpuGuard; πŸ”’
use crate::framebuffer::FramebufferOps; πŸ”’
use crate::framebuffer::MAX_DIRTY_RECTS; πŸ”’
use crate::framebuffer::PRESENT_MIN_TICKS; πŸ”’

StructsΒ§

KernelOps
Pixel backend backed by the kernel’s FramebufferOps function table.
Presenter
Frame presentation: owns the scanout surface and rate-limits the flush.

FunctionsΒ§

surface_from_fb⚠
Create a kernel surface over an HHDM-mapped physical framebuffer.

Type AliasesΒ§

Surface
A kernel surface: the crate’s canvas with the kernel pixel backend.