Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTDC DisplayController::draw_rectangle is racy #201

Open
fhars opened this issue Sep 19, 2023 · 1 comment
Open

LTDC DisplayController::draw_rectangle is racy #201

fhars opened this issue Sep 19, 2023 · 1 comment

Comments

@fhars
Copy link

fhars commented Sep 19, 2023

The first (few?) draw requests after a large rectangle will be garbled. Until the "safer DMA transfers" have landed, it may be better to block the call if a transfer is already in flight:

@@ -369,6 +369,9 @@ impl<T: 'static + SupportedWord> DisplayController<T> {
         bottom_right: (usize, usize),
         color: u32,
     ) {
+       // Block until the previous transfer is finished
+       while self._dma2d.cr.read().start().bit_is_set() {}
+
         // Output color format
         self._dma2d.opfccr.write(|w| {
             w.cm().bits(match &self.pixel_format {
@eldruin
Copy link
Member

eldruin commented Sep 20, 2023

Thanks for finding this! Could you submit it as a PR?

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

No branches or pull requests

2 participants