-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Display refresh performance worse during first minute after device boots up #10176
Comments
Some of your memory allocations may be spilling into PSRAM for the slow case. Perhaps try building CP with PSRAM disabled? Commenting out this line in #define CIRCUITPY_PSRAM_CHIP_SELECT (&pin_GPIO47) PSRAM accesses that miss in the XIP cache will be 10x slower than SRAM. See #10125 for background on what's going on with memory management. |
I tried this out, unfortunately the animation code runs out of RAM when I use a build with PSRAM disabled. There is one version that loads the spritesheets into RAM and it runs out during the load of those sheets:
And another version that uses OnDiskBitmap instead which makes the animations run a little less smooth, but not as bad as depicted in the videos here. The OnDiskBitmap version makes it further, but does still run out of RAM while allocating alternate palettes to change the colors of the sprites.
So I think both versions must end up using at least some PSRAM. It does sound like a good theory that in the slow case something more "important" to displayio or the animated TileGrids is ending up in the slower PSRAM than in the fast case. |
The latest version of the animation is pushed to https://github.com/FoamyGuy/Adafruit_CircuitPython_FruitJam_Animation This version uses new sprites with a reduced color palette which has lowered the overall RAM usage. This does seem to have had a positive impact, but hasn't resolved it entirely. With this version the behavior I see now is: With the animation saved as code.py, the device boots up and runs the animation with the slow / choppy graphics for about 1 minute, and then the next loop of the animation has smooth graphics which seem to continue smoothly indefinitely. Once the smooth graphics have started if I do ctrl-C / ctrl-D the code will restart and the graphics are smooth from the beginning of that run. If I press the reset button the board reboots and the ~1 minute of slower graphics run before getting back to smooth playback. This 90 second recording starts just after the board boots up and runs through the minute of slower graphics and 2 loops of the smoother graphics at the end starting right around the 60 second mark. slow_then_fast_silent.mp4 |
I am now able to test with the recomended
I do still see the slower rendering for the first minute or so after a boot up with this build so I think perhaps this rules out the issue being related to storing assets in PSRAM. |
Agree, it's not PSRAM. |
If I add |
I tested this with the EYESPI connector and a ili9341 instead of HDMI and I see the same behavior, 1 minute of slower choppy rendering, then smooth from that point onward until press reset button. |
This is possibly not a core issue at all, or is something related to time keeping if so I believe. It seems in the first few test runs at least that using:
instead of
In the animation code makes this issue go away. The rest of the code was written using seconds units so it was dividing the ticks_ms() value from adafruit_ticks to get to seconds. Maybe the division slows it down for the first minute for some reason? Or maybe there is something else going on with adafruit_ticks in the first minute. Theoretically the code could be re-worked to use ms instead of seconds and then it could be tested with I'm going to test it out some more, and go back to the HDMI display to ensure that it's good there as well on boot up. If it is, then I pretty much consider this issue case closed. If anyone believes this behavior does actually point to a deeper issue within the core or adafruit_ticks, we can open a new issue or at least re-title this one. |
What do you use ticks for ? Ticks should only be compared to each other with ticks_diff/ticks_less etc. |
It was used to compare to each other, but not with ticks_diff and ticks_less. For example: get timestamp: use it to get elapsed time and progress: which then go on to control where stuff moves to, or when it other things will occur. |
I tested several more times on HDMI with 9.2.6, main, and 9.2.x UF2s from the S3 page, and all have run well and rendered smoothly. It sounds like I was just misusing ticks_ms(). It wrapping around at the 65th second meant that my mis-use was more problematic during that window of time than after it wrapped. |
CircuitPython version and board name
Code/REPL
Behavior
As I'm working on the Fruit Jam animation (https://github.com/FoamyGuy/Adafruit_CircuitPython_FruitJam_Animation) I'm noticing that when the Fruit Jam boots up with with animation in code.py the rendering performance is noticeably worse than if I put the "blank screen" script above in code.py, wait for it to launch press ctrl-C to break to REPL, change the contents of code.py to the animation code, save it, then press ctrl-D to run it.
Description
No response
Additional information
This is when the rendering performs worse:
slow0_silent.mp4
And this is when it performs better:
fast0_silent.mp4
The text was updated successfully, but these errors were encountered: