Repository navigation
Conversation
tannewt
force-pushed
the
infinite_displays
branch
2 times, most recently
from
November 25, 2026 22:41
627c41d to
9e80f03
Compare
Displays and display buses are now allocated in two parts. First, the core state struct is allocated outside the VM heap so that it works when the VM is not running. Second, a proxy allocation is done within the VM to tie the display's lifetime to the VM. The proxy also holds a second _vm_t state struct that holds VM pointers so they get collected. Some signal lines like DC and backlight used to be provided as native pins. Now they also take in DigitalInOut and PWMOut where appropriate so that they can be shared across multiple displays and buses. deinit()ing the display or bus will not deinit the shared objects. It is assumed that garbage collection will do it when appropriate. One display can be designated as the primary via `supervisor.runtime.display`. This applies a primary designation to the display bus it uses as well. These are then preserved when the VM stops using `stop_vm`. During `stop_vm`, some objects like PWMOut for backlight will be moved internal to the display so they keep working. When the VM runs again, `start_vm` is called. This allows the preserved display and bus to move the internal objects like PWMOut back to the VM heap so it is shareable with other displays. Board initiated displays are also not deinit() when the VM stops. They do not move objects because they are constructed fully outside of the VM. `release_displays()` still exists but is deprecated. It will deinit all board displays and the primary display. It will not deinit user created displays that are not the primary. Code should be changed to explicitly deinit the display it wants to. For example, `board.DISPLAY.deinit()` will allow one to re-init the board's display. Fixes micropython#1760. Related to micropython#8675, micropython#10791, micropython#6395 and micropython#7472.
This reverts the epaper sequence changes and adds const display ops tables. It also reverts the nlr guards that were overly cautious.
tannewt
force-pushed
the
infinite_displays
branch
from
December 1, 2026 21:46
f98f4b4 to
b6185ad
Compare
Member
Author
|
Ok @dhalbert. I think this is ready for review. The CI passes. I'm sure there are bugs but this gets us pretty far and bug fixes will be easier to review as separate PRs. I tested on T keyboard display with only one board.DISPLAY set and other three init at runtime. One of them is then set as primary. |
tannewt
marked this pull request as ready for review
December 1, 2026 23:57
If a primary display can't live without the VM it will be deinit when the vm is stopped. This allows primary displays when doing "simple" lifetime while the VM is active.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Displays and display buses are now allocated in two parts. First, the core state struct is allocated outside the VM heap so that it works when the VM is not running. Second, a proxy allocation is done within the VM to tie the display's lifetime to the VM. The proxy also holds a second _vm_t state struct that holds VM pointers so they get collected.
Some signal lines like DC and backlight used to be provided as native pins. Now they also take in DigitalInOut and PWMOut where appropriate so that they can be shared across multiple displays and buses. deinit()ing the display or bus will not deinit the shared objects. It is assumed that garbage collection will do it when appropriate.
One display can be designated as the primary via
supervisor.runtime.display. This applies a primary designation to the display bus it uses as well. These are then (usually) preserved when the VM stops usingstop_vm. Duringstop_vm, some objects like PWMOut for backlight will be moved internal to the display so they keep working. When the VM runs again,start_vmis called. This allows the preserved display and bus to move the internal objects like PWMOut back to the VM heap so it is shareable with other displays.Small builds have a "simple" lifetime where user constructed displays are not kept outside the VM and the proxy mechanics are not compiled in. This saves space but still allows for multiple displays while the VM is running. board displays are still outlive the VM and can be used as the primary.
Board initiated displays are also not deinit() when the VM stops. They do not move objects because they are constructed fully outside of the VM.
release_displays()still exists but is deprecated. It will deinit all board displays and the primary display. It will not deinit user created displays that are not the primary. Code should be changed to explicitly deinit the display it wants to. For example,board.DISPLAY.deinit()will allow one to re-init the board's display.Fixes #1760. Related to #8675, #10791, #6395 and #7472.