Repository navigation
Conversation
tannewt
force-pushed
the
infinite_displays
branch
from
November 25, 2026 20:29
35aa09c to
627c41d
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.
tannewt
force-pushed
the
infinite_displays
branch
from
November 25, 2026 22:41
627c41d to
9e80f03
Compare
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 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.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.