-
-
Notifications
You must be signed in to change notification settings - Fork 3.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
fix(draw): fix the default draw thread stack is too large #5951
Conversation
b87a061
to
6ca97b2
Compare
Signed-off-by: pengyiqiang <[email protected]>
6ca97b2
to
e5008ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding freetype stack limitations 😁
It looks good to me. Maybe we can add check for other components too. |
Do you have any info about the stack usage of ThorVG? |
I haven't tested ThorVG on embedded devices yet. Have you tested it before? How many stacks were used? |
I've used it for Lottie animations. I'll check the stack usage today. |
I've tested with rendering the vector demo in 100x100 and 200x200 resolution. The extra stack usage was the same in both cases: 20kB. So let's say minimum 24kB is needed, but 32kB is recommended. In On side note, in case of multi core rendering, we could dedicate a core to FreeType and/or ThorVG, so that we don't need to allocate that large stack multiple times. |
dece725
to
32a6ace
Compare
Done,The ThorVG check has been added. |
Signed-off-by: FASTSHIFT <[email protected]>
32a6ace
to
6316603
Compare
Signed-off-by: FASTSHIFT <[email protected]>
d935558
to
fb6a630
Compare
config LV_DRAW_THREAD_STACK_SIZE | ||
int "Stack size of draw thread in bytes" | ||
default 8192 | ||
depends on LV_USE_OS > 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also depends on LV_USE_DRAW_SW
as its the stack size of the SW render task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LV_DRAW_THREAD_STACK_SIZE
should work as a general configuration, not just for software rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessarily true that all renderes need 8k RAM by default. A simpler one optimized of for size with less features might use only 2kB, but a heavier one might need much more.
E.g. PXP has a hard coded 2kB stack size. So LV_DRAW_THREAD_STACK_SIZE
is not really a general configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's come to a conclusion on this before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be done the other way around. Most draw units should use LV_DRAW_THREAD_STACK_SIZE
as stack size configuration instead of hard-coding. If the draw unit does not need to draw freetype fonts, it can be hard-coded in its own code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So there are 2 cases:
- The GPU is limited and doesn't really depend on
lv_conf.h
➡️ the stack size can be hardcoded (e.g. PXP) - The GPU is more powerful and can use FreeType or ThorVG if enabled ➡️ it should use
LV_DRAW_THREAD_STACK_SIZE
.
If we approach it like this, I agree with current version. 👍
Description of the feature or fix
Fix the memory waste caused by the default draw thread stack being too large, and add a stack size check when some components that consume stack space are opened.
cc @GorgonMeducer
Notes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py
(astyle version v3.4.10 needs to be installed) and follow the Code Conventions.