Bus_Parallel8/16 (ESP32-S3): never queue a zero-length DMA chunk - #332
Merged
Merged
Conversation
The copy path splits a transfer into chunks whose first four bytes go out as LCD command cycles and the rest by DMA. For some lengths (for example 257 to 260 bytes) a chunk was only four bytes long, so the DMA descriptor had no payload; Bus_Parallel16 then waited forever for its TX FIFO to fill. These lengths reach the copy path more often now that DMA-inaccessible sources are copied. Bus_Parallel16 now fills each chunk up to the buffer size (one byte less when a byte is pending from an odd length) and sends a five-byte remainder as four command bytes plus the pending byte. Bus_Parallel8 enlarges a four-byte chunk so that it carries a payload.
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.
Brings the ESP32-S3 parallel bus fix of 0.2.32 (#330) to develop.
The copy path of
Bus_Parallel8/Bus_Parallel16on the ESP32-S3 splits a transfer into chunks whose first four bytes go out as LCD command cycles and the rest by DMA. For some lengths (for example 257 to 260 bytes, or 5 bytes with no pending byte) a chunk was only four bytes long, so the DMA descriptor had no payload;Bus_Parallel16then waited forever for its TX FIFO to fill. DMA-inaccessible sources (#324) take this path, so the lengths are reached more often.Bus_Parallel16fills each chunk up to the buffer size (one byte less when a byte is pending from an odd length) and sends a five-byte remainder as four command bytes plus the pending byte.Bus_Parallel8enlarges a four-byte chunk so that it carries a payload.Checked on the host by running the chunking code over every length from 1 to 2000 (and both pending-byte states for
Bus_Parallel16) under ASan / UBSan: every DMA payload is non-empty and stays within the buffer.