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.
Hi!
I forked your repo to add support for TD/2D mode to the actual DMA system. Here are some details about what and why. I am open to any discussion.
Thank you in advance for reading this pull request and for accepting it maybe!
Have a nice day,
Gautier
Background
I was working on a Raspberry Pi application with two windows in the same framebuffer, horizontally aligned as you can see on the following picture.
I wanted to update only one window, and to be as efficient as possible, I wanted to do it using the DMA. I could have built a chained list of DMA control blocks, but as I wanted the operation to be optimized, I thought that it would be better if the ARM CPU did not waste too much time building the control blocks. Fortunately bcm2835 documentation provides one way to do it with one single control block, by using the TD mode. I tried it and it worked fine on real hardware. However qemu would raise an assert and crash. That's why I decided to look at qemu's source code.
Modifications
All the modifications are located in hw/dma/bcm2835_dma.c. I transformed the assert into a simple if statement so that branching can occur between "normal" mode and TD mode. Since the portion of code that performs one step (i.e., that does one "word" copy) would be the same, I put it in a seperate function called bcm2835_dma_step so that there won't be any copy/paste.