Skip to content

Remove fixed display limit - #11963

Draft
tannewt wants to merge 2 commits into
adafruit:mainfrom
tannewt:infinite_displays
Draft

tannewt wants to merge 2 commits into
adafruit:mainfrom
tannewt:infinite_displays

Conversation

@tannewt

@tannewt tannewt commented Nov 25, 2026

Copy link
Copy Markdown
Member

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 #1760. Related to #8675, #10791, #6395 and #7472.

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

displayio: Impossible to have more than one display on the same bus

1 participant