-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
Optimize graphical display with selective rendering #5288
Optimize graphical display with selective rendering #5288
Conversation
b13ab85
to
0de53b4
Compare
9f05af9
to
6700374
Compare
This one is better than #5279: It saves 2ms (82.5 to 80.5ms) on my printer. |
2ms is significant! That's 32,000 cycles. @olikraus suggests we can do even better with u8g2. But it is still a work-in-progress… Please read olikraus/u8glib#447 (comment) |
Also @yhfudev take note! U8g2 apparently has some helpful features that may make your work easier. Specifically:
Proper UTF-8 support means we don't have to do so much remapping.
Only the Info screen needs graphics. Other screens can take advantage of this optimization. |
Very good! Todays tests: Todays test of the GLCD enhacements RCBugFix Status screen Selective rendering Selective + unroll Selective + unroll + decrease delay Selective + decrease delay Detailed timings in the commits comments. (AnHardt#67) Conclusion: |
I also tested.
|
@thinkyhead |
@esenapaj |
@AnHardt |
@AnHardt Selective + 5μs delay + "frame" Selective + 4μs delay + "frame" Selective + 3μs delay + "frame"
|
Tomorrow i'll make some experiments with 'hollow' extruder and sd-card symbols. |
These are really encouraging results! A savings of 19ms frees up 304,000 CPU cycles. Wow. Can you also test with the options Also, try the display with and without I've added an option Drawing the frame instead of a solid box is also very smart. As another alternative I was also thinking of trying pre-clipping the solid box. That is, instead of drawing the whole box, starting at 30 with a height of Or… place that part of the display at the very top of the screen instead of in the middle, so it's only ever drawn once (including the XYZ strings). |
I got a compilation error. error message
|
a503e49
to
23c4949
Compare
Still got a compilation error error message
|
Last time I checked they were still missing PROGMEM support. |
23c4949
to
c2b827f
Compare
Oops, forgot to push. Should be better now. |
@esenapaj Helpful results. So, the rotated screen needs to be accounted for. Apparently there's a way to access the page bounds that will work with any rotation… u8g.getU8g()->current_page.y0
u8g.getU8g()->current_page.y1 …so I'll try adapting the code to use these. I can also try to fix the positioning of the smaller font. Are the glyphs for X Y Z broken with the small font? |
Oliver is being very responsive! He has already submitted this for us:
The AVR-specific optimizations that make u8g faster than u8g2 are still extant, however. |
03a316a
to
c4532c1
Compare
Maybe this? #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
#undef USE_BIG_EDIT_FONT
#undef USE_SMALL_INFOFONT
#endif That would correspond with: #if DISABLED(SIMULATE_ROMFONT) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_1) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_5) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_KANA) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_GREEK) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_CN) \
&& DISABLED(DISPLAY_CHARSET_ISO10646_TR)
#define DISPLAY_CHARSET_ISO10646_1 // use the better font on full graphic displays.
#endif …and… // Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese. |
Maybe so. At least, I've confirmed that About "g", I test now. |
Looks good. I count 13 pixels tall for the big font. I'll see about getting it better-centered based on that info, and perhaps we can get one less render on 8-stripe displays too. |
831c3d7
to
2296827
Compare
It looks like that #if DISABLED(DISPLAY_CHARSET_ISO10646_1)
#undef USE_BIG_EDIT_FONT
#undef USE_SMALL_INFOFONT
#endif is forgotten. |
I'm suggesting that you try using those lines in place of these: #if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
#undef USE_BIG_EDIT_FONT
#endif |
Well... I used it already at test in #5288 (comment) Perhaps I may be misunderstanding the interaction with you cause by my bad English. |
@@ -52,12 +52,13 @@
#if ENABLED(SHOW_BOOTSCREEN) && ENABLED(SHOW_CUSTOM_BOOTSCREEN)
#include "_Bootscreen.h"
#endif
-#if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
+#if DISABLED(DISPLAY_CHARSET_ISO10646_1)
#undef USE_BIG_EDIT_FONT
+ #undef USE_SMALL_INFOFONT
#endif
#if ENABLED(USE_SMALL_INFOFONT)
#include "dogm_font_data_6x9_marlin.h"
#define FONT_STATUSMENU_NAME u8g_font_6x9 is enough to bring back |
Also, I confirmed no problem with kana and kana_utf8. |
From your statement "It looks like that (code) is forgotten" I thought you meant something else. The words "is forgotten" are quite poetic in this context. I'm glad to hear that fixes it. I will add that to the PR and merge this thing. We can continue to patch this up in the coming days, but I think it's showing great promise. |
I'll make a separate PR to fix 'USE_BIG_EDIT_FONT' only. |
2296827
to
c35b500
Compare
Oh sorry... |
c35b500
to
aee71c5
Compare
Works. |
About u8g2:
the solution for this is looking like:
Fonts are already in PROGMEM. Something else missing? - besides of speed? Last night's patch for u8g2 is a big step forward - but not enough. :-( |
It looks like he just posted another performance update for SW SPI. |
u8g vs u8g2 - now maybe a bit too fast - somewhere
A nop in both of the 0-loops seems to be enough to have no pixel errors on my display. |
The draw loop wastes a lot of cycles because it re-calculates the whole display 2 or more times per screen render. This PR employs two strategies to reduce rendering time:
Added up, these optimizations save at least ~19ms (380,000 cycles) on screens with 2 stripes.
Additionally:
uint8_t
for u8g coordinates. (u8g also supplies au8g_uint_t
type)const
for function arguments and locals, where appropriate.I look forward to your test results!