Skip to content

Commit 27e424e

Browse files
committed
fix(lcd): use new mipi dma2d api
1 parent fc8bd32 commit 27e424e

File tree

12 files changed

+89
-13
lines changed

12 files changed

+89
-13
lines changed

bsp/esp32_p4_function_ev_board/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ menu "Board Support Package (ESP32-P4)"
121121
bool "RGB888"
122122
endchoice
123123

124+
config BSP_LCD_USE_DMA2D
125+
bool "Select whether to use DMA2D"
126+
default "y"
127+
help
128+
Select whether to use DMA2D to draw the bitmap.
129+
124130
choice BSP_LCD_TYPE
125131
prompt "Select LCD type"
126132
default BSP_LCD_TYPE_1024_600

bsp/esp32_p4_function_ev_board/esp32_p4_function_ev_board.c

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,10 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
606606
#endif
607607
dpi_config.num_fbs = CONFIG_BSP_LCD_DPI_BUFFER_NUMS;
608608

609+
#if CONFIG_BSP_LCD_USE_DMA2D && (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0))
610+
dpi_config.flags.use_dma2d = true;
611+
#endif
612+
609613
ek79007_vendor_config_t vendor_config = {
610614
.mipi_config = {
611615
.dsi_bus = mipi_dsi_bus,
@@ -619,6 +623,11 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
619623
.vendor_config = &vendor_config,
620624
};
621625
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_ek79007(io, &lcd_dev_config, &disp_panel), err, TAG, "New LCD panel EK79007 failed");
626+
627+
#if CONFIG_BSP_LCD_USE_DMA2D && ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
628+
ESP_GOTO_ON_ERROR(esp_lcd_dpi_panel_enable_dma2d(disp_panel), err, TAG, "LCD panel enable DMA2D failed");
629+
#endif
630+
622631
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
623632
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
624633
#elif CONFIG_BSP_LCD_TYPE_1280_800
@@ -631,6 +640,10 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
631640
#endif
632641
dpi_config.num_fbs = CONFIG_BSP_LCD_DPI_BUFFER_NUMS;
633642

643+
#if CONFIG_BSP_LCD_USE_DMA2D && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
644+
dpi_config.flags.use_dma2d = true;
645+
#endif
646+
634647
ili9881c_vendor_config_t vendor_config = {
635648
.mipi_config = {
636649
.dsi_bus = mipi_dsi_bus,
@@ -645,6 +658,11 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
645658
.vendor_config = &vendor_config,
646659
};
647660
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_ili9881c(io, &lcd_dev_config, &disp_panel), err, TAG, "New LCD panel ILI9881C failed");
661+
662+
#if CONFIG_BSP_LCD_USE_DMA2D && ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
663+
ESP_GOTO_ON_ERROR(esp_lcd_dpi_panel_enable_dma2d(disp_panel), err, TAG, "LCD panel enable DMA2D failed");
664+
#endif
665+
648666
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
649667
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
650668
ESP_GOTO_ON_ERROR(esp_lcd_panel_disp_on_off(disp_panel, true), err, TAG, "LCD panel ON failed");
@@ -679,6 +697,12 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
679697
LT8912B_1920x1080_PANEL_30HZ_DPI_CONFIG_WITH_FBS(CONFIG_BSP_LCD_DPI_BUFFER_NUMS)
680698
};
681699

700+
#if CONFIG_BSP_LCD_USE_DMA2D && ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
701+
for (int i = 0; i < sizeof(dpi_configs) / sizeof(dpi_configs[0]); i++) {
702+
dpi_configs[i].flags.use_dma2d = true;
703+
}
704+
#endif
705+
682706
const esp_lcd_panel_lt8912b_video_timing_t video_timings[] = {
683707
ESP_LCD_LT8912B_VIDEO_TIMING_800x600_60Hz(),
684708
ESP_LCD_LT8912B_VIDEO_TIMING_1024x768_60Hz(),
@@ -736,6 +760,11 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
736760
.avi = io_avi,
737761
};
738762
ESP_ERROR_CHECK(esp_lcd_new_panel_lt8912b(&io_all, &panel_config, &disp_panel));
763+
764+
#if CONFIG_BSP_LCD_USE_DMA2D && ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0)
765+
ESP_GOTO_ON_ERROR(esp_lcd_dpi_panel_enable_dma2d(disp_panel), err, TAG, "LCD panel enable DMA2D failed");
766+
#endif
767+
739768
ESP_GOTO_ON_ERROR(esp_lcd_panel_reset(disp_panel), err, TAG, "LCD panel reset failed");
740769
ESP_GOTO_ON_ERROR(esp_lcd_panel_init(disp_panel), err, TAG, "LCD panel init failed");
741770

@@ -977,7 +1006,7 @@ lv_display_t *bsp_display_start(void)
9771006
.hdmi_resolution = BSP_HDMI_RES_NONE,
9781007
#endif
9791008
.dsi_bus = {
980-
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT,
1009+
.phy_clk_src = 0, // let the driver to choose the default clock source
9811010
.lane_bit_rate_mbps = BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS,
9821011
}
9831012
},

bsp/esp32_p4_function_ev_board/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "5.1.2"
1+
version: "5.2.0"
22
description: Board Support Package (BSP) for ESP32-P4 Function EV Board (preview)
33
url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_p4_function_ev_board
44

bsp/m5stack_tab5/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ menu "Board Support Package(m5stack_tab5)"
106106
bool "Full refresh"
107107
config BSP_DISPLAY_LVGL_DIRECT_MODE
108108
bool "Direct mode"
109+
110+
config BSP_LCD_USE_DMA2D
111+
bool "Select whether to use DMA2D"
112+
default "y"
113+
help
114+
Select whether to use DMA2D to draw the bitmap.
115+
109116
endchoice
110117
endmenu
111118
config BSP_I2S_NUM

bsp/m5stack_tab5/src/m5stack_tab5.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,9 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
617617
.vsync_pulse_width = 4,
618618
.vsync_front_porch = 20,
619619
},
620+
#if CONFIG_BSP_LCD_USE_DMA2D && (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0))
620621
.flags.use_dma2d = true,
622+
#endif
621623
};
622624
dpi_config.num_fbs = CONFIG_BSP_LCD_DPI_BUFFER_NUMS;
623625

@@ -639,6 +641,9 @@ esp_err_t bsp_display_new_with_handles(const bsp_display_config_t *config, bsp_l
639641
.vendor_config = &vendor_config,
640642
};
641643
ESP_GOTO_ON_ERROR(esp_lcd_new_panel_ili9881c(ret_handles->io, (const esp_lcd_panel_dev_config_t *)&panel_config, &ret_handles->panel), err, TAG, "New panel failed");
644+
#if CONFIG_BSP_LCD_USE_DMA2D && (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(6, 0, 0))
645+
ESP_GOTO_ON_ERROR(esp_lcd_dpi_panel_enable_dma2d(ret_handles->panel), err, TAG, "LCD panel enable DMA2D failed");
646+
#endif
642647
disp_handles.panel = ret_handles->panel;
643648

644649
esp_lcd_panel_reset(ret_handles->panel);
@@ -685,7 +690,7 @@ static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg)
685690
esp_lcd_panel_io_handle_t io_handle = NULL;
686691
const bsp_display_config_t bsp_disp_cfg = {
687692
.dsi_bus = {
688-
.phy_clk_src = MIPI_DSI_PHY_CLK_SRC_DEFAULT,
693+
.phy_clk_src = 0, // let the driver to choose the default clock source
689694
.lane_bit_rate_mbps = BSP_LCD_MIPI_DSI_LANE_BITRATE_MBPS,
690695
}
691696
};

components/lcd/esp_lcd_ili9881c/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.0.3"
1+
version: "1.1.0"
22
targets:
33
- esp32p4
44
description: ESP LCD ILI9881C (MIPI DSI)

components/lcd/esp_lcd_ili9881c/include/esp_lcd_ili9881c.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <stdint.h>
1414
#include "soc/soc_caps.h"
15+
#include "esp_idf_version.h"
1516

1617
#if SOC_MIPI_DSI_SUPPORTED
1718
#include "esp_lcd_panel_vendor.h"
@@ -90,6 +91,7 @@ esp_err_t esp_lcd_new_panel_ili9881c(const esp_lcd_panel_io_handle_t io, const e
9091
.lcd_param_bits = 8, \
9192
}
9293

94+
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(6, 0, 0)
9395
/**
9496
* @brief MIPI DPI configuration structure
9597
*
@@ -118,6 +120,7 @@ esp_err_t esp_lcd_new_panel_ili9881c(const esp_lcd_panel_io_handle_t io, const e
118120
}, \
119121
.flags.use_dma2d = true, \
120122
}
123+
#endif
121124

122125
/**
123126
* @brief MIPI DPI configuration structure
@@ -145,7 +148,6 @@ esp_err_t esp_lcd_new_panel_ili9881c(const esp_lcd_panel_io_handle_t io, const e
145148
.vsync_pulse_width = 4, \
146149
.vsync_front_porch = 16, \
147150
}, \
148-
.flags.use_dma2d = true, \
149151
}
150152
#endif
151153

components/lcd/esp_lcd_lt8912b/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.1.3"
1+
version: "0.2.0"
22
description: ESP LCD LT8912B (MIPI DSI - HDMI)
33
url: https://github.com/espressif/esp-bsp/tree/master/components/lcd/esp_lcd_lt8912b
44
repository: "https://github.com/espressif/esp-bsp.git"

components/lcd/esp_lcd_lt8912b/include/esp_lcd_lt8912b.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
170170
.vsync_pulse_width = 4, \
171171
.vsync_front_porch = 1, \
172172
}, \
173-
.flags.use_dma2d = true, \
174173
.flags.disable_lp = true, \
175174
}
176175

@@ -215,7 +214,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
215214
.vsync_pulse_width = 4, \
216215
.vsync_front_porch = 3, \
217216
}, \
218-
.flags.use_dma2d = true, \
219217
.flags.disable_lp = true, \
220218
}
221219

@@ -260,7 +258,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
260258
.vsync_pulse_width = 5, \
261259
.vsync_front_porch = 3, \
262260
}, \
263-
.flags.use_dma2d = true, \
264261
.flags.disable_lp = true, \
265262
}
266263

@@ -305,7 +302,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
305302
.vsync_pulse_width = 6, \
306303
.vsync_front_porch = 3, \
307304
}, \
308-
.flags.use_dma2d = true, \
309305
.flags.disable_lp = true, \
310306
}
311307

@@ -350,7 +346,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
350346
.vsync_pulse_width = 5, \
351347
.vsync_front_porch = 3, \
352348
}, \
353-
.flags.use_dma2d = true, \
354349
.flags.disable_lp = true, \
355350
}
356351

@@ -398,7 +393,6 @@ bool esp_lcd_panel_lt8912b_is_ready(esp_lcd_panel_t *panel);
398393
.vsync_pulse_width = 5, \
399394
.vsync_front_porch = 3, \
400395
}, \
401-
.flags.use_dma2d = true, \
402396
.flags.disable_lp = true, \
403397
}
404398

components/lcd/esp_lcd_st7796/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "1.3.6"
1+
version: "1.4.0"
22
targets:
33
- esp32
44
- esp32s2

0 commit comments

Comments
 (0)