tree: 1ebb0a77378fb37cc1bca6c8edfdd4279c4f08d3 [search]
  1. meta/
  2. rust/
  3. BUILD.bazel
  4. BUILD.gn
  5. combined_token.fidl
  6. README.md
src/sysmem/server/README.md

Sysmem Server

Sysmem runs as the /bootstrap/sysmem Rust component (//src/sysmem/server:sysmem_cmp, implemented under src/sysmem/server/rust/).

Architecture

  • Component & Entrypoint (rust/src/main.rs, meta/sysmem.cml): Single-threaded fuchsia_async::LocalExecutor component serving fuchsia.sysmem.Allocator (v1), fuchsia.sysmem2.Allocator (v2), and fuchsia.hardware.sysmem.Sysmem (heap/secure-memory registration from board drivers).
  • Fault Isolation: Sysmem serves multiple independent clients in a single process. Client protocol errors or unsatisfiable buffer constraints must only fail the affected node, subtree, or LogicalBufferCollection - never the server process itself.
  • Core Modules (rust/src/):
    • sysmem.rs: Top-level server state, structured config & format-cost table loading, BTI acquisition, memory allocator registry, SecureMem lifecycle, Inspect, and Cobalt metrics.
    • logical_buffer_collection.rs: Multi-participant buffer collection coordination, VMO allocation/zeroing, strong/weak VMO lifetime tracking, and AttachToken / must_match_vmo handling.
    • node/ & node_properties.rs & arena.rs: Generational-arena node tree and FIDL request handlers for BufferCollectionToken (V1/V2 multiplexed via combined_token.fidl), BufferCollection, BufferCollectionTokenGroup, and OrphanedNode.
    • sanitized_constraints.rs, pad_for_block_size.rs, usage_pixel_format_cost.rs: Constraint sanitization, DO_NOT_CARE fanout, aggregation, padding, and platform format-cost selection.
    • memory_allocator.rs, contiguous_pooled_memory_allocator.rs, external_memory_allocator.rs, protected_ranges.rs, region_bookkeeper.rs: System RAM, contiguous pooled RAM, external driver heaps, hardware-protected memory range management, unused-page guard checking, and page loaning.
  • C++ Test Harness FFI (rust/ffi/): Exposes an opaque C ABI (sysmem_rust_server_*) used by in-process C++ display unit tests (FakeSysmemDeviceHierarchy).

Protocol Documentation

See the FIDL definitions in //sdk/fidl/fuchsia.sysmem2/ (and legacy //sdk/fidl/fuchsia.sysmem/).