Commit message · benma's agentui: speed up BB02 text rendering
The LVGL font renderer repeatedly validates every character map,
resolves each glyph separately for width and drawing, and clears pixels
before painting their foreground. This extra work slows BitBox02
counters and animations whose progress depends on the frame rate.
Validate only the selected character map and reuse the glyph descriptor
when drawing. Render glyphs inside their character cell in one pass,
reading packed bitmap bytes sequentially and clearing the surrounding
margins. Keep the general renderer for glyphs that extend beyond their
cell. Use the selected font's line height for fallback positioning and
background clearing.
Treat tabs as one space in the font adapter and pass only the resolved
glyph and selected line height to the drawing function. Tabs now use the
space glyph and advance, including the visible mask glyph in password
fonts. Previously, tabs were blank with twice the space advance.
For the same centered text, "Confirm address", both the SH1107 and
SSD1312 screen drivers give identical instruction counts in this build
(emulated Cortex-M4 instructions, ARM GCC 15.2.1, -Os, LTO):
| Font | Before LVGL | Current LVGL | With optimizations |
| --- | ---: | ---: | ---: |
| regular_9 | 39,677 | 76,687 | 39,096 |
| regular_11 (default) | 49,033 | 87,809 | 47,757 |
| regular_12 | 66,522 | 104,584 | 62,895 |
| password_9 | 41,540 | 81,345 | 43,036 |
| password_12 | 69,005 | 110,131 | 67,464 |
| monogram_16 | 47,410 | 62,037 | 47,594 |
This brings instruction counts back to roughly the pre-LVGL level for
this sample (-5.5% to +3.6%). These are emulated instruction counts, not
hardware timings or frame rates; display transfers and other work in a
frame are excluded.
68/100 · AdequateMessage clarity
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
Why it was queueddefensive validationsecond-pass: broader security terminology
AI analysis · Informational 19/100This commit is a performance optimization for drawing text on the BitBox02 hardware wallet screen. It makes text rendering faster by reducing repeated work and changing how tabs are displayed (now a single space width instead of double). The changes are accompanied by new unit tests. There is no clear security vulnerability here, but any change to low-level screen drawing code carries a small risk of visual glitches or unexpected behavior.