Closed ValouBambou closed 8 months ago
One thing that can help a lot is to try to increase the frequency of the SPI bus. You can play with it and increase it until the device can't keep up anymore.
Looking at your numbers I think that you are indeed limited by the spi speed, because as you say you get a good speedup for the first frame, but then not so much anymore, suggesting that the bottleneck at the steady state is not the cpu.
I will add specific feedback about the PR over there.
Thanks for taking the time to experiment, report here and do a PR!
I tried to increase the frequency, but now the clear
method is taking 85 ms and the first frame 171 ms. While when I undo my changes the clear screen takes the same amount of time, but the first frame took 242 ms, so there is still is a big 30% difference even when the frequency is high.
Also, when I talk about the first frame it is just to simplify, the time for the next frames is also reducing.
Hi, I was doing a GPS like application on a Raspberry Pi Pico using embassy and embedded_graphics, and I encounter some performances issues.
First measurement
Indeed, clearing the screen took 263 ms on average and rendering the first frame of my app (rendering 20 lines) took around 340ms. These time are a bit too high for reaching the goal of 60 fps. So I planned to use DMA, but before I was wondering if there are some tweaks to improve the driver.
Considered improvements
My first idea when looking at the code was to avoid some slice to iterator conversions, e.g. in
command
, so based on that I try some tweaks:command
useDataFormat::U8
Instead of the `DataFormat::U8Iter.write_slice
specialized version ofwrite_iter
but withDataFormat::U16
instead ofDataFormat::U16BEIter
(I hope the endianness is not an issue).draw_raw_slice
.draw_raw_slice
instead ofdraw_raw_iter
inDrawTarget::draw_iter
.With this idea, I got a speedup around 20% on the rendering of my first frame (268 ms instead of 338 ms) and just a consistent save of 1ms for clearing the screen.