fix(dma2d): fix race with dma2d_force_end and ISR

free_up_channels can only be called once for a started transaction.
Double free will undesirely stop the next picked 2D-DMA transaction on the same channel.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Song Ruo Jing
2026-07-08 23:17:33 +08:00
co-authored by Cursor
parent 58f69bdf99
commit 139b71afd6
3 changed files with 98 additions and 25 deletions
@@ -190,7 +190,7 @@ esp_err_t dma2d_dequeue(dma2d_pool_handle_t dma2d_pool, dma2d_trans_t *trans);
* @param[in] trans Pointer to the 2D-DMA transaction context
* @param[out] need_yield Pointer to a status flag to record whether a task switch is needed if this API is being called in an ISR
* @return
* - ESP_OK: Force end an in-flight transaction successfully
* - ESP_OK: The transaction has been ended (either force-ended by this call, or it had already completed)
* - ESP_ERR_INVALID_ARG: Force end failed because of invalid argument
* - ESP_ERR_INVALID_STATE: Force end failed because the transaction is not yet in-flight
*/