| 1 |
.. _esp_dma2d: |
| 2 |
|
| 3 |
======================================= |
| 4 |
2D Direct Memory Access (DMA2D) Support |
| 5 |
======================================= |
| 6 |
|
| 7 |
Overview |
| 8 |
******** |
| 9 |
|
| 10 |
Some chips from Espressif such as the ESP32-P4 family features a peripheral |
| 11 |
that enhances the copy of 2-D data from a place to another, including output |
| 12 |
this 2-D data to other peripherals. |
| 13 |
|
| 14 |
This peripheral is the 2-D direct memory access, or DMA2D, the Espressif |
| 15 |
SDK, the IDF, offers a full featured driver for the DMA2D that is automatically |
| 16 |
enabled on the supported chips. |
| 17 |
|
| 18 |
One of its primary role is to serve as support for the Pixel Processor Accelerator |
| 19 |
the PPA, being used to copy the source image data to the desired PPA client splitting |
| 20 |
these data into fixed size blocks, called bursts. Also the DMA2D is used to pick the |
| 21 |
output chunks from the PPA client and copy over to the destination buffer, or the display |
| 22 |
frame-buffer. |
| 23 |
|
| 24 |
More information about PPA can be found in: :ref:`PPA (Pixel Processing Accelerator) Support <esp_ppa>`. |
| 25 |
|
| 26 |
Interacting to the DMA2D |
| 27 |
------------------------ |
| 28 |
|
| 29 |
The LVGL does not interact directly to the DMA2D, instead, the Espressif LVGL port component |
| 30 |
display driver uses the DMA2D to copy the target drawn buffer to the display buffer without CPU |
| 31 |
intervention. Even though this option is available the user is responsible to explicitly enable |
| 32 |
it on the display driver of the LVGL port component. |
| 33 |
|
| 34 |
To enabling it the user should set on its `sdkconfig.defaults` the `CONFIG_BSP_DISPLAY_LVGL_AVOID_TEAR`, |
| 35 |
which will tell the driver to use the DMA2D to optimize transfer. Please notice that enabling |
| 36 |
this option will be only available when using the PSRAM memory and double buffer mode, otherwise |
| 37 |
a compiler error will be raised. |
| 38 |
|
| 39 |
If the user is configuring the display manually, it is possible to enable the DMA2D in runtime by |
| 40 |
setting the DMA2D flag to true: |
| 41 |
|
| 42 |
.. code-block:: c |
| 43 |
|
| 44 |
/* Gets the default configuration for the MIPI display controller */ |
| 45 |
esp_lcd_dpi_panel_config_t dpi_config = EK79007_1024_600_PANEL_60HZ_CONFIG(LCD_COLOR_PIXEL_FORMAT_RGB888); |
| 46 |
|
| 47 |
/* Explictly set the DMA2D to assist the buffer transfer */ |
| 48 |
dpi_config.flags.use_dma2d = true; |
| 49 |
|
| 50 |
ek79007_vendor_config_t vendor_config = { |
| 51 |
.mipi_config = { |
| 52 |
.dsi_bus = mipi_dsi_bus, |
| 53 |
.dpi_config = &dpi_config, |
| 54 |
}, |
| 55 |
}; |
| 56 |
|
| 57 |
esp_lcd_panel_dev_config_t lcd_dev_config = { |
| 58 |
.reset_gpio_num = UI_FIRMWARE_PIN_NUM_LCD_RST, |
| 59 |
.rgb_ele_order = LCD_RGB_ELEMENT_ORDER_RGB, |
| 60 |
.bits_per_pixel = 24, |
| 61 |
.vendor_config = &vendor_config, |
| 62 |
}; |
| 63 |
|
| 64 |
/* Configures and enable the display */ |
| 65 |
ESP_ERROR_CHECK(esp_lcd_new_panel_ek79007(mipi_dbi_io, &lcd_dev_config, &mipi_dpi_panel)); |
| 66 |
|