Performance improvements (#203)

- Use DMA buffers for drawing
- Fix for draw buffer sizes
- Reduced rendering refresh interval
- Removed custom icons from wifi app to fix scroll performance issue
This commit is contained in:
Ken Van Hoeylandt
2025-02-02 23:02:50 +01:00
committed by GitHub
parent c0f4738abe
commit 5ec96f60f1
19 changed files with 47 additions and 56 deletions
@@ -15,7 +15,7 @@
#define TWODOTFOUR_LCD_VERTICAL_RESOLUTION 320
#define TWODOTFOUR_LCD_BITS_PER_PIXEL 16
#define TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT (TWODOTFOUR_LCD_VERTICAL_RESOLUTION / 10)
#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT * (TWODOTFOUR_LCD_BITS_PER_PIXEL / 8))
#define TWODOTFOUR_LCD_DRAW_BUFFER_SIZE (TWODOTFOUR_LCD_HORIZONTAL_RESOLUTION * TWODOTFOUR_LCD_DRAW_BUFFER_HEIGHT)
#define TWODOTFOUR_LCD_PIN_CS GPIO_NUM_15
#define TWODOTFOUR_LCD_PIN_DC GPIO_NUM_2
@@ -138,8 +138,8 @@ bool TdeckDisplay::start() {
.io_handle = ioHandle,
.panel_handle = panelHandle,
.control_handle = nullptr,
.buffer_size = TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_DRAW_BUFFER_HEIGHT * (TDECK_LCD_BITS_PER_PIXEL / 8),
.double_buffer = true, // Disable to free up SPIRAM
.buffer_size = TDECK_LCD_HORIZONTAL_RESOLUTION * TDECK_LCD_DRAW_BUFFER_HEIGHT,
.double_buffer = false, // Disable to free up memory
.trans_size = 0,
.hres = TDECK_LCD_HORIZONTAL_RESOLUTION,
.vres = TDECK_LCD_VERTICAL_RESOLUTION,
@@ -151,8 +151,8 @@ bool TdeckDisplay::start() {
},
.color_format = LV_COLOR_FORMAT_RGB565,
.flags = {
.buff_dma = false,
.buff_spiram = true,
.buff_dma = true,
.buff_spiram = false,
.sw_rotate = false,
.swap_bytes = false,
.full_refresh = false,
@@ -73,7 +73,7 @@ bool Core2Display::start() {
.panel_handle = panelHandle,
.control_handle = nullptr,
.buffer_size = CORE2_LCD_DRAW_BUFFER_SIZE,
.double_buffer = true,
.double_buffer = false,
.trans_size = 0,
.hres = CORE2_LCD_HORIZONTAL_RESOLUTION,
.vres = CORE2_LCD_VERTICAL_RESOLUTION,
@@ -85,8 +85,8 @@ bool Core2Display::start() {
},
.color_format = LV_COLOR_FORMAT_RGB565,
.flags = {
.buff_dma = false,
.buff_spiram = true,
.buff_dma = true,
.buff_spiram = false,
.sw_rotate = false,
.swap_bytes = true,
.full_refresh = false,
@@ -8,4 +8,4 @@
#define CORE2_LCD_VERTICAL_RESOLUTION 240
#define CORE2_LCD_BITS_PER_PIXEL 16
#define CORE2_LCD_DRAW_BUFFER_HEIGHT (CORE2_LCD_VERTICAL_RESOLUTION / 10)
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT * (CORE2_LCD_BITS_PER_PIXEL / 8))
#define CORE2_LCD_DRAW_BUFFER_SIZE (CORE2_LCD_HORIZONTAL_RESOLUTION * CORE2_LCD_DRAW_BUFFER_HEIGHT)
@@ -93,7 +93,7 @@ bool CoreS3Display::start() {
.panel_handle = panelHandle,
.control_handle = nullptr,
.buffer_size = CORES3_LCD_DRAW_BUFFER_SIZE,
.double_buffer = true,
.double_buffer = false,
.trans_size = 0,
.hres = CORES3_LCD_HORIZONTAL_RESOLUTION,
.vres = CORES3_LCD_VERTICAL_RESOLUTION,
@@ -105,8 +105,8 @@ bool CoreS3Display::start() {
},
.color_format = LV_COLOR_FORMAT_RGB565,
.flags = {
.buff_dma = false,
.buff_spiram = true,
.buff_dma = true,
.buff_spiram = false,
.sw_rotate = false,
.swap_bytes = true,
.full_refresh = false,
@@ -8,4 +8,4 @@
#define CORES3_LCD_VERTICAL_RESOLUTION 240
#define CORES3_LCD_BITS_PER_PIXEL 16
#define CORES3_LCD_DRAW_BUFFER_HEIGHT (CORES3_LCD_VERTICAL_RESOLUTION / 10)
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT * (CORES3_LCD_BITS_PER_PIXEL / 8))
#define CORES3_LCD_DRAW_BUFFER_SIZE (CORES3_LCD_HORIZONTAL_RESOLUTION * CORES3_LCD_DRAW_BUFFER_HEIGHT)
+6 -12
View File
@@ -3,8 +3,6 @@
#include "UnPhoneTouch.h"
#include <Tactility/Log.h>
#include <Tactility/TactilityCore.h>
#include "UnPhoneFeatures.h"
#include "esp_err.h"
#include "hx8357/disp_spi.h"
@@ -30,15 +28,13 @@ bool UnPhoneDisplay::start() {
lv_display_set_color_format(displayHandle, LV_COLOR_FORMAT_NATIVE);
// TODO malloc to use SPIRAM
buffer1 = (uint8_t*)heap_caps_malloc(BUFFER_SIZE, MALLOC_CAP_SPIRAM);
buffer2 = (uint8_t*)heap_caps_malloc(BUFFER_SIZE, MALLOC_CAP_SPIRAM);
assert(buffer1 != nullptr);
assert(buffer2 != nullptr);
buffer = (uint8_t*)heap_caps_malloc(BUFFER_SIZE, MALLOC_CAP_DMA);
assert(buffer != nullptr);
lv_display_set_buffers(
displayHandle,
buffer1,
buffer2,
buffer,
nullptr,
BUFFER_SIZE,
LV_DISPLAY_RENDER_MODE_PARTIAL
);
@@ -61,10 +57,8 @@ bool UnPhoneDisplay::stop() {
lv_display_delete(displayHandle);
displayHandle = nullptr;
heap_caps_free(buffer1);
heap_caps_free(buffer2);
buffer1 = nullptr;
buffer2 = nullptr;
heap_caps_free(buffer);
buffer = nullptr;
return true;
}
+1 -2
View File
@@ -11,8 +11,7 @@ class UnPhoneDisplay : public tt::hal::Display {
private:
lv_display_t* displayHandle = nullptr;
uint8_t* buffer1 = nullptr;
uint8_t* buffer2 = nullptr;
uint8_t* buffer = nullptr;
public: