33static const char*
const s_tag =
"ra8_glyph_atlas";
83 (void)
memset(atlas, 0,
sizeof(*atlas));
114 *out_glyph = (
ra8_glyph_t){.bitmap = v.
data, .width = dims->
w, .height = dims->
h};
127 uint32_t* out_misses,
128 uint32_t* out_evictions)
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
ra8_err_t ra8_glyph_atlas_put(ra8_glyph_atlas_t *atlas, const uint8_t *bitmap)
Release one pin on a glyph previously returned by ra8_glyph_atlas_get.
ra8_err_t ra8_glyph_atlas_stats(const ra8_glyph_atlas_t *atlas, uint32_t *out_hits, uint32_t *out_misses, uint32_t *out_evictions)
Report the atlas hit / miss / eviction counters.
static ra8_err_t internal_glyph_render(void *ctx, const void *key, uint8_t *cell, uint32_t cell_bytes, void *user)
Render trampoline: adapt ra8_glyph_render_fn to the keycache seam.
ra8_err_t ra8_glyph_atlas_get(ra8_glyph_atlas_t *atlas, const ra8_glyph_key_t *key, ra8_glyph_t *out_glyph)
Get (and pin) the rendered glyph for key.
ra8_err_t ra8_glyph_atlas_init(ra8_glyph_atlas_t *atlas, const ra8_glyph_atlas_cfg_t *cfg)
Initialise a glyph atlas over caller-supplied storage.
Fixed-RAM-budget glyph cache with LRU eviction (Layer 3, #147).
The one reusable hash + pin + evict cache engine (#147, #345).
ra8_err_t ra8_keycache_get(ra8_keycache_t *kc, const void *key, ra8_keycache_view_t *out_view)
Get (and pin) the cell for key, rendering it on a miss.
ra8_err_t ra8_keycache_stats(const ra8_keycache_t *kc, uint32_t *out_hits, uint32_t *out_misses, uint32_t *out_evictions)
Report the cache hit / miss / eviction counters.
ra8_err_t ra8_keycache_init(ra8_keycache_t *kc, const ra8_keycache_cfg_t *cfg)
Initialise a cache engine over caller-supplied storage.
ra8_err_t ra8_keycache_put(ra8_keycache_t *kc, const uint8_t *data)
Release one pin on a cell previously returned by ra8_keycache_get.
Caller-supplied storage + renderer for ra8_glyph_atlas_init.
ra8_glyph_key_t * keys
cell_count key-storage entries.
uint32_t bucket_count
Number of hash buckets (>= 1).
ra8_glyph_render_fn render
Render-on-miss callback.
ra8_glyph_dims_t * dims
cell_count dimension descriptors.
uint32_t cell_count
Number of cells.
int32_t * buckets
bucket_count hash-bucket heads.
uint32_t cell_bytes
Bytes per cell (max glyph bitmap).
void * render_ctx
Opaque context passed to render.
uint8_t * cell_mem
cell_count * cell_bytes of bitmap storage.
ra8_keycache_cell_t * meta
cell_count link-metadata entries.
Glyph-cache state (caller-owned; treat as private).
ra8_glyph_render_fn render
Caller's glyph renderer.
void * render_ctx
Caller's renderer context.
ra8_keycache_t kc
Underlying keyed-LRU cache.
Per-cell user descriptor: the rendered glyph dimensions.
uint16_t w
Rendered glyph width in pixels.
uint16_t h
Rendered glyph height in pixels.
Identifies one rendered glyph.
A pinned view of a cached glyph bitmap returned by ra8_glyph_atlas_get.
Caller-supplied storage + policy + renderer for ra8_keycache_init.
uint32_t bucket_count
Number of hash buckets (>= 1).
uint32_t user_bytes
Bytes per user descriptor (may be 0).
uint8_t * cell_mem
cell_count * cell_bytes of cell storage.
uint32_t cell_bytes
Bytes per cell (the rendered payload).
uint8_t * key_mem
cell_count * key_bytes of key storage.
int32_t * buckets
bucket_count hash-bucket heads.
uint32_t key_bytes
Bytes per key (>= 1).
ra8_keycache_cell_t * meta
cell_count link-metadata entries.
uint32_t cell_count
Number of cells.
void * render_ctx
Opaque context passed to render.
ra8_keycache_render_fn render
Render-on-miss callback.
uint8_t * user_mem
cell_count * user_bytes, or NULL if none.
ra8_keycache_cfg_t cfg
Configuration (copied at init).
A pinned view of a cached cell returned by ra8_keycache_get.
uint8_t * data
Cell payload (cell_bytes wide).
void * user
Per-cell user descriptor, or NULL.