Skip to content

Stop the display's frame callback seeing half-updated data - #24

Merged
tannewt merged 1 commit into
tannewt:lvgl_displayiofrom
mikeysklar:lvgl-dsi-callback-lock
Nov 16, 2026
Merged

tannewt merged 1 commit into
tannewt:lvgl_displayiofrom
mikeysklar:lvgl-dsi-callback-lock

Conversation

@mikeysklar

Copy link
Copy Markdown

What

Set and read the frame callback and its data under one spinlock.

Why

The vsync interrupt could see a new callback with old or NULL data.

Found by reading the code; I have not seen it fail.

The callback still runs outside the lock, since it notifies a task.

Tested
Board Metro ESP32-P4, Raspberry Pi Touch Display 2
Result homeview robot test, 8 rounds with the other three PRs, no underruns; Ctrl-C 8 of 8 clean

AI assistance

Claude Code wrote this change and ran the tests above. I reviewed the diff and tested homeview by hand on the board.

🤖 Generated with Claude Code

The vsync interrupt could run between the two stores and call the new
callback with the old data. Setting the first callback gave it NULL
data, which the framebufferio callback dereferences. Read and write
the pair under a spinlock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tannewt
tannewt merged commit e1af15f into tannewt:lvgl_displayio Nov 16, 2026
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.

2 participants