ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ez_scene.h
Go to the documentation of this file.
1
45
46#pragma once
47
48#include <stdint.h>
49
50#include "ra8_err.h"
51#include "ra8_tile_cache.h"
52#include "ra8_ui.h"
53#include "zoom.h"
54#include "zoom_tiles.h"
55
73typedef enum : uint32_t {
74 k_ez_page_w = 4096U,
75 k_ez_page_h = 3072U,
78} ez_page_t;
79
94typedef enum : uint16_t {
102
123
148
177
195typedef enum : uint32_t {
197 k_ez_strip_bytes = 1024U * 16U,
198 k_ez_packed_bytes = (1024U * 16U) / 2U,
200
235
252typedef struct {
253 void* fb;
254 uint32_t fb_bytes;
255 int32_t fb_w;
256 int32_t fb_h;
257 uint8_t* cell_mem;
261 int32_t* buckets;
262 uint8_t* row;
263 uint8_t* strip;
264 uint8_t* packed;
266
283typedef struct {
285 bool quality;
286 bool present;
288
305typedef struct {
306 uint32_t crc_1x;
307 uint32_t crc_pan;
308 uint32_t crc_2x;
309 uint32_t crc_lens;
310 uint32_t hits;
311 uint32_t misses;
312 uint32_t evictions;
313 uint16_t warmed;
315
342[[nodiscard]] uint8_t ez_page_sample(uint32_t x, uint32_t y);
343
374[[nodiscard]] ra8_err_t ez_tile_decode(void* ctx,
375 const ra8_tile_key_t* key,
376 uint8_t* cell,
377 uint32_t cell_bytes,
378 uint16_t* out_w,
379 uint16_t* out_h);
380
399[[nodiscard]] ra8_ui_rect_t ez_content_rect(int32_t fb_w, int32_t fb_h);
400
422[[nodiscard]] ra8_err_t ez_scene_init(ez_scene_t* s, const ez_scene_cfg_t* cfg);
423
444[[nodiscard]] ez_zone_t ez_zone_hit(const ez_scene_t* s, int32_t x, int32_t y);
445
467[[nodiscard]] bool ez_scene_tap(ez_scene_t* s, int32_t x, int32_t y, uint32_t now_ms);
468
488[[nodiscard]] ra8_err_t ez_scene_render(ez_scene_t* s);
489
515[[nodiscard]] ra8_err_t ez_scene_present(ez_scene_t* s, ez_present_t* out);
516
536bool ez_scene_tick(ez_scene_t* s, uint32_t now_ms);
537
559[[nodiscard]] ra8_err_t ez_scene_prefetch(ez_scene_t* s, zoom_pan_t dir, uint16_t* out_warmed);
560
589
609[[nodiscard]] uint32_t ez_fnv1a(const void* buf, uint32_t len);
ra8_ui_rect_t ez_content_rect(int32_t fb_w, int32_t fb_h)
The content rectangle: the panel less the status bar.
Definition ez_scene.c:232
ez_zone_t ez_zone_hit(const ez_scene_t *s, int32_t x, int32_t y)
Classify a tap by the zone it lands in.
Definition ez_scene.c:451
ez_scale_t
The magnification ladders the page view and the loupe walk.
Definition ez_scene.h:118
@ k_ez_page_scale_max
Page-view ladder ceiling.
Definition ez_scene.h:119
@ k_ez_lens_scale_max
Loupe ladder ceiling.
Definition ez_scene.h:121
@ k_ez_lens_scale_min
Loupe ladder floor.
Definition ez_scene.h:120
bool ez_scene_tick(ez_scene_t *s, uint32_t now_ms)
Advance both views' settle timers; report whether a repaint is due.
Definition ez_scene.c:689
ra8_err_t ez_scene_prefetch(ez_scene_t *s, zoom_pan_t dir, uint16_t *out_warmed)
Warm the tiles one pan step ahead of the page viewport.
Definition ez_scene.c:705
uint8_t ez_page_sample(uint32_t x, uint32_t y)
Sample the procedural full-resolution page at one pixel.
Definition ez_scene.c:158
ra8_err_t ez_tile_decode(void *ctx, const ra8_tile_key_t *key, uint8_t *cell, uint32_t cell_bytes, uint16_t *out_w, uint16_t *out_h)
ra8_tile_decode_fn that materialises one page tile from the sampler.
Definition ez_scene.c:204
ez_page_t
The procedural source page and its tiling.
Definition ez_scene.h:73
@ k_ez_page_w
Source page width, pixels.
Definition ez_scene.h:74
@ k_ez_image_id
Tile-cache key image id for the page.
Definition ez_scene.h:77
@ k_ez_tile_edge
Tile edge, pixels (gray8 => 64 KiB/tile).
Definition ez_scene.h:76
@ k_ez_page_h
Source page height, pixels.
Definition ez_scene.h:75
ra8_err_t ez_scene_selftest(ez_scene_t *s, ez_selftest_t *out)
Drive the scene through the scripted boot self-check.
Definition ez_scene.c:861
ra8_err_t ez_scene_present(ez_scene_t *s, ez_present_t *out)
Take the pending flush plan for whichever view changed.
Definition ez_scene.c:677
uint32_t ez_fnv1a(const void *buf, uint32_t len)
FNV-1a-32 over a byte range (the framebuffer hash).
Definition ez_scene.c:712
ra8_err_t ez_scene_render(ez_scene_t *s)
Repaint the content area, the loupe (when open) and the status bar.
Definition ez_scene.c:624
ez_scratch_t
The zoom engine's entire memory footprint, in bytes.
Definition ez_scene.h:195
@ k_ez_row_bytes
One source row at the widest viewport.
Definition ez_scene.h:196
@ k_ez_strip_bytes
gray8 destination strip (16 rows).
Definition ez_scene.h:197
@ k_ez_packed_bytes
The strip packed to 4 bpp.
Definition ez_scene.h:198
ez_layout_t
Panel layout: status bar, content viewport and the loupe box.
Definition ez_scene.h:94
@ k_ez_lens_edge
Loupe box edge, pixels.
Definition ez_scene.h:96
@ k_ez_status_h
Status bar height, pixels.
Definition ez_scene.h:95
@ k_ez_ind_gap
Gap between indicator blocks, pixels.
Definition ez_scene.h:100
@ k_ez_lens_border
Loupe chrome thickness, pixels.
Definition ez_scene.h:97
@ k_ez_ind_block
Zoom-indicator block edge, pixels.
Definition ez_scene.h:99
@ k_ez_edge_band
Pan tap-band depth at each edge.
Definition ez_scene.h:98
ez_zone_t
Tap zones of the demo's discrete touch scheme.
Definition ez_scene.h:138
@ k_ez_zone_none
Nothing under the tap.
Definition ez_scene.h:139
@ k_ez_zone_lens
Inside the loupe: cycle its magnification.
Definition ez_scene.h:145
@ k_ez_zone_pan_up
Top band: page travels up.
Definition ez_scene.h:142
@ k_ez_zone_pan_left
Left band: page travels left.
Definition ez_scene.h:140
@ k_ez_zone_toggle
Status bar: open / close the loupe.
Definition ez_scene.h:146
@ k_ez_zone_zoom
Centre: cycle the page magnification.
Definition ez_scene.h:144
@ k_ez_zone_pan_right
Right band: page travels right.
Definition ez_scene.h:141
@ k_ez_zone_pan_down
Bottom band: page travels down.
Definition ez_scene.h:143
ez_cache_t
Tile-cache budget, DERIVED from the viewport and tile geometry (#338).
Definition ez_scene.h:166
@ k_ez_buckets
Cache hash buckets (>= cells).
Definition ez_scene.h:173
@ k_ez_view_cols
1:1 tile columns a frame straddles, plus one.
Definition ez_scene.h:169
@ k_ez_cell_budget_bytes
SDRAM the cache may claim.
Definition ez_scene.h:174
@ k_ez_prefetch_max
Lead-edge tiles per pan.
Definition ez_scene.h:175
@ k_ez_view_rows
1:1 tile rows a frame straddles, plus one.
Definition ez_scene.h:170
@ k_ez_cell_bytes
One gray8 tile, bytes.
Definition ez_scene.h:168
@ k_ez_cells
Cells.
Definition ez_scene.h:172
ra8_err_t ez_scene_init(ez_scene_t *s, const ez_scene_cfg_t *cfg)
Wire the tile cache, the tiled source and both viewports.
Definition ez_scene.c:430
bool ez_scene_tap(ez_scene_t *s, int32_t x, int32_t y, uint32_t now_ms)
Apply a tap to the scene.
Definition ez_scene.c:531
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Fixed-RAM-budget image-tile cache with LRU eviction (Layer 3b, #147).
Bounded UI interaction core: hit-testing, screen stack, paging.
What the scene asks the panel to flush, and how well.
Definition ez_scene.h:283
ra8_ui_rect_t rect
Panel rectangle to flush.
Definition ez_scene.h:284
bool quality
True: full 16-level GC16.
Definition ez_scene.h:285
bool present
False: nothing changed; do not flush.
Definition ez_scene.h:286
Everything ez_scene_init needs: storage and framebuffer geometry.
Definition ez_scene.h:252
ra8_tile_key_t * keys
k_ez_cells key entries.
Definition ez_scene.h:259
int32_t fb_h
Framebuffer height, pixels.
Definition ez_scene.h:256
uint8_t * packed
k_ez_packed_bytes packed strip.
Definition ez_scene.h:264
int32_t * buckets
k_ez_buckets hash-bucket heads.
Definition ez_scene.h:261
int32_t fb_w
Framebuffer width, pixels.
Definition ez_scene.h:255
uint8_t * cell_mem
k_ez_cells * k_ez_cell_bytes bytes.
Definition ez_scene.h:257
uint32_t fb_bytes
Framebuffer size, bytes.
Definition ez_scene.h:254
uint8_t * row
k_ez_row_bytes composite row.
Definition ez_scene.h:262
ra8_tile_dims_t * dims
k_ez_cells dimension entries.
Definition ez_scene.h:260
ra8_keycache_cell_t * meta
k_ez_cells link-metadata entries.
Definition ez_scene.h:258
void * fb
Framebuffer base (hashed by the golden).
Definition ez_scene.h:253
uint8_t * strip
k_ez_strip_bytes composite strip.
Definition ez_scene.h:263
The whole demo: one tiled page, one zoom viewport, one loupe.
Definition ez_scene.h:222
ra8_ui_rect_t content
The content rectangle (page.dst).
Definition ez_scene.h:228
zoom_view_t lens
Loupe over the same page, magnified more.
Definition ez_scene.h:227
ra8_tile_cache_t cache
Page cache (decode-on-miss = the sampler).
Definition ez_scene.h:223
zoom_tile_src_t tiles
Tiled-source binding over that cache.
Definition ez_scene.h:224
bool lens_on
The loupe is open.
Definition ez_scene.h:233
zoom_source_t src
The page as a zoom source.
Definition ez_scene.h:225
int32_t fb_h
Framebuffer height, pixels.
Definition ez_scene.h:232
zoom_view_t page
Full-content zoom viewport.
Definition ez_scene.h:226
const void * fb
Framebuffer base, for the golden hash.
Definition ez_scene.h:229
int32_t fb_w
Framebuffer width, pixels.
Definition ez_scene.h:231
uint32_t fb_bytes
Framebuffer size, bytes.
Definition ez_scene.h:230
Deterministic boot self-check results (the app's golden numbers).
Definition ez_scene.h:305
uint32_t misses
Tile-cache misses (decodes).
Definition ez_scene.h:311
uint32_t crc_1x
Hash after the opening 1:1 render.
Definition ez_scene.h:306
uint32_t crc_pan
Hash after one right-pan step at 1:1.
Definition ez_scene.h:307
uint32_t evictions
Tile-cache evictions.
Definition ez_scene.h:312
uint32_t crc_2x
Hash after zooming to 2x at a fixed point.
Definition ez_scene.h:308
uint32_t crc_lens
Hash after opening the 4x loupe.
Definition ez_scene.h:309
uint16_t warmed
Tiles warmed by the pan read-ahead.
Definition ez_scene.h:313
uint32_t hits
Tile-cache hits over the whole sequence.
Definition ez_scene.h:310
Per-cell link metadata (one caller-owned array entry per cell).
Tile-cache state (caller-owned; treat as private).
Per-cell user descriptor: the decoded tile dimensions.
Identifies one decoded image tile.
Axis-aligned rectangle in framebuffer pixel coordinates.
Definition ra8_ui.h:72
A magnifiable full-resolution image behind the gray8 sub-rect seam.
Definition zoom.h:296
A tiled gray8 image, its grid, and the cache that pages it.
Definition zoom_tiles.h:72
Live viewport: where it is looking, how magnified, and what it owes the panel.
Definition zoom.h:472
Tap-to-zoom image viewer: viewport state machine + tiled magnifying render (#478).
zoom_pan_t
Discrete pan direction for tap-band navigation.
Definition zoom.h:222
Bind a tiled gray8 atlas behind an ra8_tile_cache as a zoom source (#478).