-
-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
[Core] Suggestion: add double buffer to LED drivers #22119
Conversation
Can confirm this works. sn32 led matrix does something similar. 8k of RAM is apparently enough for this. Is there a more poverty spec chip we should worry about? |
No, in the sn32 case that |
You mean AVR and low end ARM controllers. Like this really hurts the 2.5kB of SRAM that atmega32u4 has. Would it be worth having this as an option, eg |
Yes I was thinking something to have his option as an opt-in would definitely be a good way for compatibility. |
The rgb_matrix code is ugly enough as it is. At some point we're going to have to stop catering for such constrained hardware. |
RGB animations support on less powerful chips will always be a problem unless we are willing to write really optimized code. No one here is looking to make assembly drivers with memory dynamic allocation support. I wouldn't say we should stop catering to constrained firmware, I'd say that QMK has gone past these platforms with its capabilities. Furthermore, there already are cases of features that were simply not considered for such chips. RGB animations are just a gray-area because the less powerful guys support it and can do it kind-of ok given certain aspects (most importantly having a small enough number of LEDs and trying not to do crazy animations). However there are tacit examples where support for these lesse powerful chips are not discussed for obvious reasons -- who is going to complain no colored OLED support for 32U4? EDIT: because it's really hot and my gray matter has turned into gray mush, I'll TLDR: I think we shouldn't not consider a feature just because certain units won't support it. This has been done in the past, albeit tacitly, and implementing things like complex RGBs in constrained hardware is a task I don't see anyone wanting to tackle. |
@zvecr Do you think this double buffer should be implemented in the subsystem(s) that use these drivers? Rather than here in the driver to keep it simple/uncoupled? |
It might be simpler to do so, long term, as that would be less maintenance needed for each driver (or future driver). |
Closing in favour of this PR |
Description
This is to generate discussion of this change. NOT a proper PR.
The Problem:
When an indicator is on/updated, the driver update flag is set dirty. Then on the next cycle, the animation will render and see the colour is different and set the dirty flag. Which then if the indicator LED is still on, it will set to the correct colour and set the dirty flag again. Thus even between cycles when an indicator is on, it will always be set dirty and flushed.
This is the reason for such a large performance hit when an indicator is on compared to when it is just the animation
The Fix:
Create a second buffer that holds the values of the last render/pwm buffer update and compare against that since we only use a single buffer.
Testing:
Tested on Pachi RGB Rev2 STM32L4 + IS31FL3741
Advantages:
Disadvantages:
Types of Changes
Issues Fixed or Closed by This PR
Checklist