Repository navigation
audiopump: a port with no threads can render from an interrupt - #403
Merged
Merged
Conversation
A driver that renders from an interrupt sets the new render_kick hook. audiopump.service() on the interpreter then asks it to render instead of running the pump itself, and the interpreter's changes to the pump in service mode (spawn, stop, park, teardown, and a service call from C) take the pump lock, which such a driver implements by holding its interrupt off. With render_kick NULL, as on every port today, nothing changes.
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.
A driver that renders from an interrupt sets the new
render_kickhook in its port ops.audiopump.service()on the interpreter then asks the driver to render instead of running the pump itself, and the interpreter's changes to the pump in service mode (spawn, stop, park, teardown, and a service call from C) take the pump lock, which such a driver implements by holding its interrupt off.AUDIODSP_PORT_IRQ_HOOKStells a driver the header has the hook.This is what lets the Arduino GIGA R1 render from its DAC interrupt, so a long garbage collection, a flash write or Python Bluetooth callbacks no longer leave the DAC with nothing to play. With the GIGA driver from micropython-pydevices#392, ten minutes of Synth Station with a collection every 3 s and a 32 KB flash write every 30 s starved 0 of 28.7M frames, against 1,000,908 on the build before.
With
render_kickNULL, as on every other port, the only change is the lock taken around the service-mode tail drop and launch, on ports that already render from the interpreter. unix renders are byte-identical (same sha256) before and after, and the audioif probes pass. ESP32 and Windows weren't run; they render on a thread and don't take the service-mode paths.