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

blit buffer problems with 4-wire-spi and DMA #26

Open
simeonfelis opened this issue Oct 4, 2022 · 8 comments
Open

blit buffer problems with 4-wire-spi and DMA #26

simeonfelis opened this issue Oct 4, 2022 · 8 comments

Comments

@simeonfelis
Copy link

ATSAMD51G19A
GFX 3.11.1

ST7789S display (320x240), SPI with 55MHz, using DMA

Display is not correctly transferred to the screen. Behavior is optimization dependent. This is with 2 scratch buffers each 32k, -O0:

This is with 2 scratch buffers each 32k, -O1:

This is with 2 scratch buffers each 32k, -O2:

This is with 2 scratch buffers each 32k, -O3:

Using 1 scratch buffer with 32k or 64k works fine in any optimization level:

Example project:

https://github.com/simeonfelis/gfx/raw/master/grotest.zip

@MHGC
Copy link
Contributor

MHGC commented Oct 5, 2022

Hi, it seems the problem occurs when using two scratch buffers, correct?

@simeonfelis
Copy link
Author

simeonfelis commented Oct 5, 2022 via email

@MHGC
Copy link
Contributor

MHGC commented Oct 5, 2022

Ok, we will investigate this. Thank you for the report.

@MHGC
Copy link
Contributor

MHGC commented Oct 12, 2022

Following up on this. Is multiple scratch buffer necessary for your design?

Harmony have not released any 'high-performance' demos using multi-scratch buffers.

The tradeoff with multi-scratch buffer is the likelihood of more tearing, especially if it takes the MCU longer time to render than to blit and if it's updating a large area of the frame.

@simeonfelis
Copy link
Author

simeonfelis commented Oct 13, 2022 via email

@simeonfelis
Copy link
Author

Just a follow-up:

Following up on this. Is multiple scratch buffer necessary for your design?

Yes. If it does not work why not remove it?

The tradeoff with multi-scratch buffer is the likelihood of more tearing, especially if it takes the MCU longer time to render than to blit and if it's updating a large area of the frame.

I understood training material for legato like this: multiple scratch buffers improve tearing, no matter how fast blitting is.

@MHGC
Copy link
Contributor

MHGC commented Oct 17, 2022

Yes. If it does not work why not remove it?

It is not so easily to remove. The scratch buffer setting is in the Graphics Composer, which is device-agnostic. Legato is supporting 30+ device families, each family with upwards of 50 device configurations, with an assortment of graphics driver + display type.

Ultimately, scratch buffer management may need to be moved out of Graphics Composer into display driver settings. But that is a major change and will impact all existing demos and drivers.

I understood training material for legato like this: multiple scratch buffers improve tearing, no matter how fast blitting is.

This statement assumes each scratch buffer encompasses the area of change in entirety. Assuming the change is only one part of the screen, the scratch buffer sizes would have to be calibrated manually for this. Otherwise, the library split the area of change between scratch buffers and that is where the tearing would occur.

If the area of change is substantial, such as sliding of a panel covering much of the screen, the multi-scratch buffers just become a double frame buffer scheme.

We will investigate this.

@mhtmhn
Copy link

mhtmhn commented Nov 3, 2022

I tested multiple scratch buffers on the MZ EF connected to a MaxTouch Curiosity display (ILI9488 over 4-Wire SPI) and didn't see any issues pop up.

Can you try blitting a frame with a test pattern or solid color without using legato (comment it out from SYS_Initialize, SYS_Tasks)?

Make sure you test cases where you offset the blit origin from (0,0) to say (100, 100) and see if it reliably paints to the specified location on the screen. Do this multiple times with different offsets, during the same run, to ensure the previous operation doesn't influence the next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants