-
Notifications
You must be signed in to change notification settings - Fork 145
feat(lvgl_port): Used PPA for rotation on ESP32-P4 #352
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
Conversation
5186eb6
to
645f085
Compare
@espzav Would it be possible to merge PPA based software rotation to main branch and release it ? We have added manually the code to our project and it worked like a charm. CPU usage dropped from 80-90% to 10-20% and render/flush times from fewhundreds ms to 10-20 ms!! We added 'lcd_ppa.c', 'lcd_ppa.h' and changes to 'esp_lvgl_port_disp.c' under LVGL_PORT_PPA defines with one adjustment (changed |
Also we had to change buffer alignment to 128 as we are using external memory and then buffer has to be aligned to L2 size |
The last adjustment that we had to make was to change the way how rotation area is calculated when there is full screen rotation. For unknown reason, in our case, the
and then inside
This part worked for our case but I am not sure if it is most elegant solution... On the occasion position related variables (like x,y,h,w etc ) were set to uint32_t type to standardize it with PPA. |
Hi @mpolitowicz, thank you for you rresults and changes. We didn't merge it because there wasn't performance change between SW rotation and PPA rotation. Mainly, when there was small draw buffer, the SW rotation was faster. |
@espzav it seems there is no difference on smaller buffers as standard SW rotate seems to have similar speed. The huge difference (like 10 fold) can be observed with bigger buffers and we have 800x1280 to rotate... Here is comparison of a scenario from our application: load screen no3 (full rotate 800x1280), load screen no1 (full rotate 800x1280), zoom part of screen (partial rotate 680x680) four times, load screen no4 (full rotate 800x1280), zoom part of screen (partial rotate 680x680) four times, load screen no1 (full rotate 800x1280) As you see there is almost no difference when 680x680 is rotated, but there is huge boost on flush time when we rotate whole screen. |
Oh, and regards buffer alignment change from 64 to 128, that I mentioned before, I think it would be best to take this value from CONFIG_CACHE_L2_CACHE_LINE_SIZE from sdkconfig.h |
@espzav Any chance to move forward with this one ? |
@mpolitowicz I am working on it on local now. There are some changes in |
645f085
to
5bd7404
Compare
Test Results 19 files 19 suites 6m 17s ⏱️ Results for commit 6c97b21. ♻️ This comment has been updated with latest results. |
b2fce4d
to
e0c1d00
Compare
e0c1d00
to
63ca516
Compare
Hi @mpolitowicz and @tore-espressif, I made some LVGL benchmarks of screen rotation with PPA and without PPA. I still see no difference there. |
Hi, I did some tests and I got confused myself. The logs above are from two consecutive runs of our application with only difference in code which was commented out line I thought that the reason is I included in the code other change related to PPA (blending described in #409 ) but when I removed that part (in fact I did reset managed_components to be sure), the speed of UI was more less the same. My weak guess is that enabling PPA might have helped in reducing memory consumption so that drawer task started to work faster. But I am not sure here... Any ways in mean time we optimized size of displayed items and played with LV_DRAW_THREAD_STACK_SIZE (setting it at 128k) and this did the job. Also we reduced LVGL buffer size to 680x680 (from 1280x800) and resigned from double buffer. So anyways maybe the best is to include PPA rotation under option in Kconfig (and consider adding PPA blend/fill in the same way ) ? But I guess it is up to you as it seems we found setting that works for us without PPA support. |
@mpolitowicz Thank you for your help and great clarification. I am thinking about two posibilities. We can keep as it is and release it or add runtime API for select PPA. I don't like KConfig options in |
A Kconfig option to disable PPA could be meaningful in this case, since that would allow reducing the code size. A run-time switch is more flexible, but it doesn't help us remove unused PPA-related code if the application doesn't need PPA. You can try to add both — a runtime switch and a Kconfig option to get the flexibility while making it possible to trim the code size. |
63ca516
to
74035dc
Compare
Thank you for your suggestion. When I had to add Kconfig, I didn't add to runtime option. I think, it is enough as a Kconfig. |
@tore-espressif PTAL |
5820ab4
to
d80e8c8
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.
Only Nitpicks, LGTM!
d80e8c8
to
42ac13f
Compare
42ac13f
to
6c97b21
Compare
@espzav (and all) thank you! We tested it once again and it seems it does visibly speed up our solution. Especially when larger chunks of screen or whole screen is redrawn. Maybe the case is that we have 1280x800 screen that is large enough to benefit from PPA. One observation that we have (at least in our case), is that in order to have LVGL_PORT_ENABLE_PPA work without issues, it is necessary to have ESP_MM_CACHE_MSYNC_C2M_CHUNKED_OPS enabled. Otherwise the screen blinks in blue from time to time when larger parts are refreshed fast (this is not very obvious and we discovered it on scrolling lv_table that is like half screen size). I am not sure what is the mechanism behind it but I suspect that since PPA uses esp_cache_msync it can lock flush cb on larger buffers. |
ESP-BSP Pull Request checklist
Change description
Closes #540