AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 19 Bitcoin

ui: speed up BB02 text rendering

Public commit record

What the developer wrote

Authored by benma's agent

68/100 · Adequate
ui: 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.
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This 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.

Recommended action

Review the optimized glyph drawing path for off-by-one errors, clipping correctness, and behavior with unusual glyph metrics. Run the new unit tests and verify on-device text rendering still matches expectations, especially for password/mask fonts and tabs. No immediate security response is indicated.

Security signals we found

01

Low-level rendering code changed, which always warrants careful review for memory safety and correctness

02

Tab rendering behavior changed from blank double-width to visible single-width space

03

New unit tests added to verify glyph rendering edge cases and cmap validation

Risk score

Why this scored 19/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.