From 0624c4b4dbdd045a304a6e8d3aa43f383ada7549 Mon Sep 17 00:00:00 2001 From: YoungsunLi Date: Tue, 1 Sep 2026 19:33:03 +0800 Subject: [PATCH] fix(esp_lcd): yield from SPI ISR when color trans done callback wakes a task The return value of on_color_trans_done ("whether a high priority task has been waken up by this function", see esp_lcd_types.h) was discarded by the SPI backend. A task unblocked from inside the callback (e.g. via xSemaphoreGiveFromISR) therefore did not get scheduled until the next FreeRTOS tick, adding up to 10 ms of latency per color transfer with the default CONFIG_FREERTOS_HZ=100. The i80 backend already honors the contract (need_yield -> portYIELD_FROM_ISR); do the same here. --- components/esp_lcd/spi/esp_lcd_panel_io_spi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/esp_lcd/spi/esp_lcd_panel_io_spi.c b/components/esp_lcd/spi/esp_lcd_panel_io_spi.c index 9fd20292e7b..2acf34a3534 100644 --- a/components/esp_lcd/spi/esp_lcd_panel_io_spi.c +++ b/components/esp_lcd/spi/esp_lcd_panel_io_spi.c @@ -430,7 +430,9 @@ static void lcd_spi_post_trans_color_cb(spi_transaction_t *trans) if (lcd_trans->flags.en_trans_done_cb) { if (spi_panel_io->on_color_trans_done) { - spi_panel_io->on_color_trans_done(&spi_panel_io->base, NULL, spi_panel_io->user_ctx); + if (spi_panel_io->on_color_trans_done(&spi_panel_io->base, NULL, spi_panel_io->user_ctx)) { + portYIELD_FROM_ISR(); + } } } }