Skip to content

Commit

Permalink
Improve display flush cost
Browse files Browse the repository at this point in the history
  • Loading branch information
mzyy94 committed Jan 28, 2024
1 parent deb91be commit eae2486
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/lv_port_disp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,12 @@ void lv_port_disp_init(void)
lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_display_set_flush_cb(disp, disp_flush);

/* Example 1
* One buffer for partial rendering*/
static lv_color_t buf_1_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/
lv_display_set_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISPLAY_RENDER_MODE_PARTIAL);

// /* Example 2
// * Two buffers for partial rendering
// * In flush_cb DMA or similar hardware should be used to update the display in the background.*/
// static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10];
// static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10];
// lv_display_set_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISPLAY_RENDER_MODE_PARTIAL);

// /* Example 3
// * Two buffers screen sized buffer for double buffering.
// * Both LV_DISPLAY_RENDER_MODE_DIRECT and LV_DISPLAY_RENDER_MODE_FULL works, see their comments*/
// static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES];
// static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES];
// lv_display_set_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1), LV_DISPLAY_RENDER_MODE_DIRECT);

/**
* Two buffers for partial rendering
* In flush_cb DMA or similar hardware should be used to update the display in the background.*/
static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10];
static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10];
lv_display_set_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISPLAY_RENDER_MODE_PARTIAL);
}

/**********************
Expand Down Expand Up @@ -110,5 +97,6 @@ static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, uint8_t

/*IMPORTANT!!!
*Inform the graphics library that you are ready with the flushing*/
M5.Display.waitDisplay();
lv_display_flush_ready(disp_drv);
}

0 comments on commit eae2486

Please sign in to comment.