fix(dma2d): add a dequeue mechanism for dma2d driver

JPEG driver should be able to either dequeue a pending transaction from
a 2D-DMA pool or force end a processing transaction.
This commit is contained in:
Song Ruo Jing
2026-07-08 20:11:08 +08:00
parent 9369102192
commit 4fbbc16ac6
4 changed files with 73 additions and 9 deletions
+8 -1
View File
@@ -334,7 +334,14 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
return ESP_OK;
err1:
dma2d_force_end(encoder_engine->trans_desc, &need_yield);
// The transaction may still be pending in the pool queue (never picked up), so try to dequeue it first.
// Dequeuing is atomic against the pick that turns a pending transaction into an in-flight one, so if the
// transaction is no longer in the queue, it is already in-flight and we force end it instead.
if (dma2d_dequeue(encoder_engine->dma2d_group_handle, encoder_engine->trans_desc) != ESP_OK) {
if (dma2d_force_end(encoder_engine->trans_desc, &need_yield) != ESP_OK) {
ESP_LOGE(TAG, "failed to end the transaction, it is neither pending nor in-flight");
}
}
err2:
xSemaphoreGive(encoder_engine->codec_base->codec_mutex);
#if CONFIG_PM_ENABLE