mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(mspi): split dma and mspi alignment
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include "esp_private/periph_ctrl.h"
|
||||
#include "jpeg_private.h"
|
||||
#include "hal/jpeg_hal.h"
|
||||
#include "esp_memory_utils.h"
|
||||
#include "driver/jpeg_types.h"
|
||||
#include "sys/lock.h"
|
||||
#include "sys/queue.h"
|
||||
@@ -23,7 +22,6 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "hal/jpeg_periph.h"
|
||||
#include "esp_psram.h"
|
||||
#if JPEG_USE_RETENTION_LINK
|
||||
#include "esp_private/sleep_retention.h"
|
||||
#endif
|
||||
@@ -292,17 +290,3 @@ esp_err_t jpeg_check_intr_priority(jpeg_codec_handle_t jpeg_codec, int intr_prio
|
||||
ESP_RETURN_ON_FALSE(!intr_priority_conflict, ESP_ERR_INVALID_STATE, TAG, "intr_priority conflict, already is %d but attempt to %d", jpeg_codec->intr_priority, intr_priority);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool jpeg_check_dma2d_buffer(const void *buffer)
|
||||
{
|
||||
#if CONFIG_SECURE_FLASH_ENC_ENABLED
|
||||
// jpeg cannot handle encrypted data.
|
||||
if (esp_ptr_external_ram(buffer) && !esp_psram_ptr_is_no_enc(buffer)) {
|
||||
return false;
|
||||
}
|
||||
if (esp_ptr_in_drom(buffer)) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -289,8 +289,10 @@ esp_err_t jpeg_decoder_process(jpeg_decoder_handle_t decoder_engine, const jpeg_
|
||||
"jpeg decode decode_outbuf or out_buffer size is not aligned, please use jpeg_alloc_decoder_mem to malloc your buffer");
|
||||
|
||||
// both the bitstream and output buffer are accessed by the 2D-DMA
|
||||
ESP_RETURN_ON_FALSE(jpeg_check_dma2d_buffer(bit_stream) && jpeg_check_dma2d_buffer(decode_outbuf), ESP_ERR_INVALID_ARG, TAG,
|
||||
"jpeg decode buffer is not 16-byte aligned or not in unencrypted PSRAM, please use jpeg_alloc_decoder_mem to malloc your buffer");
|
||||
size_t bit_stream_alignment = dma2d_get_buffer_alignment_constraint(bit_stream);
|
||||
size_t decode_outbuf_alignment = dma2d_get_buffer_alignment_constraint(decode_outbuf);
|
||||
ESP_RETURN_ON_FALSE(bit_stream_alignment <= 1 && decode_outbuf_alignment <= 1, ESP_ERR_INVALID_ARG, TAG,
|
||||
"jpeg decode buffer doesn't satisfy DMA2D alignment constraints, please use jpeg_alloc_decoder_mem to malloc your buffer");
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
|
||||
@@ -177,7 +177,10 @@ esp_err_t jpeg_encoder_process(jpeg_encoder_handle_t encoder_engine, const jpeg_
|
||||
ESP_RETURN_ON_FALSE(out_size, ESP_ERR_INVALID_ARG, TAG, "jpeg encode picture out_size is null");
|
||||
ESP_RETURN_ON_FALSE(((uintptr_t)bit_stream % cache_hal_get_cache_line_size(CACHE_LL_LEVEL_EXT_MEM, CACHE_TYPE_DATA)) == 0, ESP_ERR_INVALID_ARG, TAG, "jpeg encode bit stream is not aligned, please use jpeg_alloc_encoder_mem to malloc your buffer");
|
||||
// both the input picture and output bitstream are accessed by the 2D-DMA
|
||||
ESP_RETURN_ON_FALSE(jpeg_check_dma2d_buffer(encode_inbuf) && jpeg_check_dma2d_buffer(bit_stream), ESP_ERR_INVALID_ARG, TAG, "jpeg encode buffer is not 16-byte aligned or not in unencrypted PSRAM, please use jpeg_alloc_encoder_mem to malloc your buffer");
|
||||
size_t encode_inbuf_alignment = dma2d_get_buffer_alignment_constraint(encode_inbuf);
|
||||
size_t bit_stream_alignment = dma2d_get_buffer_alignment_constraint(bit_stream);
|
||||
ESP_RETURN_ON_FALSE(encode_inbuf_alignment <= 1 && bit_stream_alignment <= 1, ESP_ERR_INVALID_ARG, TAG,
|
||||
"jpeg encode buffer doesn't satisfy DMA2D alignment constraints, please use jpeg_alloc_encoder_mem to malloc your buffer");
|
||||
|
||||
esp_err_t ret = ESP_OK;
|
||||
|
||||
|
||||
@@ -276,18 +276,6 @@ esp_err_t jpeg_isr_deregister(jpeg_codec_handle_t jpeg_codec, jpeg_isr_handler_t
|
||||
*/
|
||||
esp_err_t jpeg_check_intr_priority(jpeg_codec_handle_t jpeg_codec, int intr_priority);
|
||||
|
||||
/**
|
||||
* @brief Validate a user buffer that will be accessed by the 2D-DMA
|
||||
*
|
||||
* The buffer must be 16-byte aligned. When CONFIG_SPIRAM_ENC_EXEMPT is enabled,
|
||||
* a PSRAM buffer must reside in the unencrypted carve-out, since the 2D-DMA
|
||||
* cannot access encrypted PSRAM. Internal RAM buffers are always accepted.
|
||||
*
|
||||
* @param buffer Buffer pointer provided by the user
|
||||
* @return true if the buffer can be used by the 2D-DMA, false otherwise
|
||||
*/
|
||||
bool jpeg_check_dma2d_buffer(const void *buffer);
|
||||
|
||||
/**
|
||||
* @brief Create sleep retention link
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user