Merge branch 'fix/fix_spi_lcd_psram_mode_v6.0' into 'release/v6.0'

fix(spi_lcd): add a flag to decide whether dma accsess psram (v6.0)

See merge request espressif/esp-idf!47795
This commit is contained in:
morris
2026-04-28 16:42:33 +08:00
2 changed files with 4 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ typedef struct {
unsigned int octal_mode: 1; /*!< transmit data and parameters with 8 lines */
unsigned int quad_mode: 1; /*!< transmit data and parameters with 4 lines */
unsigned int sio_mode: 1; /*!< Read and write through a single data line (MOSI) */
unsigned int psram_dma_direct: 1;/*!< If color buffer is in PSRAM, use PSRAM for DMA buffer directly, has speed limit, but no temp buffer and save memory */
unsigned int lsb_first: 1; /*!< Transmit LSB bit first */
unsigned int cs_high_active: 1; /*!< CS line is high active */
} flags; /*!< Extra flags to fine-tune the SPI device */

View File

@@ -64,6 +64,7 @@ typedef struct {
unsigned int dc_param_level: 1; // Indicates the level of DC line when transferring parameters
unsigned int octal_mode: 1; // Indicates whether the transmitting is enabled with octal mode (8 data lines)
unsigned int quad_mode: 1; // Indicates whether the transmitting is enabled with quad mode (4 data lines)
unsigned int psram_dma_direct: 1;// Indicates whether to use PSRAM for DMA buffer directly when color buffer is in PSRAM
} flags;
lcd_spi_trans_descriptor_t trans_pool[]; // Transaction pool
} esp_lcd_panel_io_spi_t;
@@ -107,6 +108,7 @@ esp_err_t esp_lcd_new_panel_io_spi(esp_lcd_spi_bus_handle_t bus, const esp_lcd_p
spi_panel_io->flags.dc_param_level = !io_config->flags.dc_low_on_param;
spi_panel_io->flags.octal_mode = io_config->flags.octal_mode;
spi_panel_io->flags.quad_mode = io_config->flags.quad_mode;
spi_panel_io->flags.psram_dma_direct = io_config->flags.psram_dma_direct;
spi_panel_io->on_color_trans_done = io_config->on_color_trans_done;
spi_panel_io->user_ctx = io_config->user_ctx;
spi_panel_io->lcd_cmd_bits = io_config->lcd_cmd_bits;
@@ -371,7 +373,7 @@ static esp_err_t panel_io_spi_tx_color(esp_lcd_panel_io_t *io, int lcd_cmd, cons
spi_panel_io->num_trans_inflight--;
}
memset(lcd_trans, 0, sizeof(lcd_spi_trans_descriptor_t));
if (color_in_psram) {
if (color_in_psram && spi_panel_io->flags.psram_dma_direct) {
// When the color buffer resides in PSRAM, set the DMA PSRAM flag
lcd_trans->base.flags |= SPI_TRANS_DMA_USE_PSRAM;
}