Skip to content

Backdrop: the pattern tile repeated to Metrics::pattern_px (64 px on the Tab5) - #1

Merged
finger563 merged 1 commit into
mainfrom
perf/pattern-tile-size
Nov 21, 2026
Merged

finger563 merged 1 commit into
mainfrom
perf/pattern-tile-size

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Summary

The launcher's and the pause menu's backdrop draws its pattern as an LV_IMAGE_ALIGN_TILE image. LVGL draws a tiled image one tile at a time, running the whole image pipeline for each tile. With one pattern period per tile (6x6 dot matrix, 8x4 scanlines, up to 22x22 dots), a 1280x720 backdrop cost about 25,600 draws per full redraw and about 7,000 per list scroll. Each draw copied rows of only 12 to 44 bytes. On the Tab5 that was the largest single cost of a launcher redraw.

  • make_tile() now repeats the period to at least Metrics::pattern_px on each side. The tile is always a multiple of the period on both axes, so the pattern looks the same.
  • Metrics::pattern_px is a new field:
    • large_1280x720() uses 64, giving a few hundred draws per full redraw. Each console style shown costs about 9 KB, and tiles are kept as before.
    • compact_320x240() uses 0 (one period), so the box is unchanged.
  • API: Backdrop::create(parent, pattern_px) and pattern_tile(style, min_px) both take the size; it defaults to 0.

Measurements (Tab5)

I scrolled the launcher for 20 s and timed each LVGL refresh, from REFR_START to REFR_READY:

Tile Average redraw Slowest Redraws < 40 ms
One period (before) 57.1 ms 164 ms 43 of 127
64 px 37.2 ms 96 ms 135 of 173
128 px 38.2 ms 97 ms 127 of 167

The 128 px tiles are no faster and take four times the memory, so the default is 64.

Testing

🤖 Generated with Claude Code

https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY

LVGL draws an LV_IMAGE_ALIGN_TILE image one tile at a time, through the
whole image pipeline per tile. With one period per tile (6x6 dot matrix,
8x4 scanlines, ...) a 1280x720 backdrop took ~25,600 draws per full
redraw and ~7,000 per list scroll, each copying rows of 12-16 bytes.

make_tile() now repeats the period to at least Metrics::pattern_px a
side (a multiple of the period on both axes, so the pattern is
unchanged). large_1280x720() asks for 64 px: a few hundred draws per
full redraw, ~9 KB per console style shown (tiles are kept, as before).
compact_320x240() keeps one period (0), as on the box today.

Measured on the Tab5 (20 s of scrolling, LVGL REFR_START..REFR_READY):
average redraw 57.1 -> 37.2 ms, the slowest 164 -> 96 ms; 128 px tiles
measured the same (38.2 ms) at four times the memory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant