-
Notifications
You must be signed in to change notification settings - Fork 64
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
Improve performance with frame buffer and DMA #23
Comments
Thank you for comment. This example uses a lot of memory to display JPEG and PNG. To use the framebuffer, I need to consume less memory for JPEG and PNG display. |
Yes, looking at it in more detail, it is true true that a full screen framebuffer takes too much DRAM. However, it would also be possible to use small DMA buffers, for example of 32x32 pixels (4k DRAM) to speed up font drawing and other graphic operations. These small buffers could also be used as "sprites" or "tiles". Smaller fonts could then also be loaded as such DMA-accessible sprites. Perhaps there are other non-DMA techniques to improve performance as well? |
Yes. I know that register operations run about 5 times faster than gpio_set_level. In the case of ESP32, it is divided into registers from GPIO00 to GPIO31 and registers from GPIO32 to GPIO39. However, it may not have much impact on overall performance. Try this.
|
Ok, I will try it out and if I see a performance improvement, I'll try to apply it to this esp-idf-st7789 project |
Hi, was just wondering if using register operations resulted in a noticeable performance improvement? This library is awesome, but the only thing holding me back from using it for a project is the refresh rate. I'm trying to get text to refresh without a wasted frame where a black rectangle is drawn over it. |
I don't know what kind of drawing you want. |
Thanks for the reply. When I use lcdDrawString() with dev->_font_fill enabled, the rectangle drawing method makes it a partial refresh https://github.com/nopnop2002/esp-idf-st7789/blob/master/main/st7789.c#L763, which is cool; however, I can see the frame where the rectangle is drawn over the string. Is there any method that goes straight from one string to another string? Also, I noticed if I uncomment and use https://github.com/nopnop2002/esp-idf-st7789/blob/master/main/st7789.c#L784 instead of the rectangle drawing method, the rectangle disappears but the refresh becomes noticeably sequential (string characters update from left to right) Edit: Perhaps I should have posted here instead: #20. Basically want to see if there's a faster approach than using lcdDrawPixel() and lcdDrawFillRect() for partial refreshes. |
|
I made a framebuffer version (for esp32s3 I had enough memory to do this) that uses large SPI transfers to redraw the screen in one go (docu indicates it should use dma todo this, atm I still did it blocking). With this I tested up to 15fps redraws and do not notices 'glitches' (there will be some, but rare) on esp. If there is interest I can upload this code, its very hacking for now. |
Can you change your repository to public? |
its not on github so no repository to set 'public'. I could share the (in very rough state) code if there is interest. |
I quickly cloned your repo and started adding my code:
Things I need to port back:
|
thank you. I've cloned your code. I'll take a closer look this weekend.
Probably ESP32S2/C2 causes memory overflow when displaying JPEG and PNG |
When not using framebuffer, it should be fine. |
Another todo:
|
ESP32C3 ESP32C2 ESP32S2 |
Never used the C2, and the S2 is NRND. |
No. |
owh good to know, because I really liked it (and keep some in stock). Mouser indicated that espressif marked it NRND, I see now it comes in another form factor. |
For smaller memory usage, we can probably make a smaller framebuffer where we first draw part of what we want to show in the buffer, and then push that in one go to the screen. This should help with text, if we for example push one line of text in one go. |
JPEG and PNG display did not become faster even after changing to FrameBuffer. This is because image analysis takes time. Without Frame Buffer(rgb565) I (2734) FillTest: elapsed time[ms]:1150 With Frame buffer(rgb565) I (2735) FillTest: elapsed time[ms]:1150 |
That is to be expected (the big bunny video was another jpeg decoder on non-esp hardware where the drawing was the bottleneck). |
If you main purpose is to display text, it's well worth using FrameBuffer. If your main purpose is to display images, there is no value in using FrameBuffer. I'll publish it after some more testing. Thank you. |
Thanks again for your library, its been very useful. |
I enjoy using this library but the performance of drawing could be improved. In stead of drawing directly to the display, I suggest drawing to a memory frame buffer and then sending the frame buffer to the display using DMA. Here is an example of how this could work:
https://esp32.com/viewtopic.php?t=20108
The text was updated successfully, but these errors were encountered: