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

Call spi_write_blocking directly for RP2040 #360

Merged
merged 3 commits into from
Sep 17, 2021

Conversation

Daft-Freak
Copy link
Contributor

Skips some layers and improves performance a lot. Likely overlaps with #343 a bit.

graphicstest improvements (62.5MHz):

Benchmark Time (microseconds) New time (microseconds) Change (x)
Screen fill 5120547 387943 13.2
Text 259667 42504 6.1
Lines 2463232 415519 5.9
Horiz/Vert Lines 418902 33019 12.7
Rectangles (outline) 266909 21791 12.2
Rectangles (filled) 10627497 805409 13.2
Circles (filled) 1216044 129574 9.4
Circles (outline) 1076740 180856 6
Triangles (outline) 560046 91170 6.1
Triangles (filled) 3466318 293083 11.8
Rounded rects (outline) 510195 69136 7.4
Rounded rects (filled) 10571062 812290 13
Total 36557159 3282294 11.1

This is around a 6-13x speed up in graphicstest (at 62.5Mhz)
Copy link
Contributor

@PaintYourDragon PaintYourDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive! Would be happy to approve as-is…but…as long as you’re in there, would you consider adding same to writePixels() as well? Would improve BMP drawing, things like that.
(As in…if you’re busy, no worries…I can merge as-is and then bungle my way through adding it there, if necessary.)

Switch SPI to 16-bit for little-endian, write bytes as-is for big-endian
@Daft-Freak
Copy link
Contributor Author

Haven't tried BMP drawing, but with the original change a 320x240 writePixels went from around 1062512us to around 127271us.

8x faster was pretty good, but taking advantage of hardware 16-bit writes and doing one write gets it down to around 27388us/38x faster!

Hmm, 16-bit writes might also help for fills... think I've done enough for now though 😄

Copy link
Contributor

@PaintYourDragon PaintYourDragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesomesauce. Thank you!

Appease clang-format
@PaintYourDragon PaintYourDragon merged commit c1e5056 into adafruit:master Sep 17, 2021
@Daft-Freak Daft-Freak deleted the patch-1 branch September 17, 2021 22:01
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

Successfully merging this pull request may close these issues.

2 participants