@@ -185,7 +185,8 @@ esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_conf
185185 color_space_pixel_format_t out_pixel_format = {
186186 .color_type_id = config -> out .blend_cm ,
187187 };
188- uint32_t out_pic_len = config -> out .pic_w * config -> out .pic_h * color_hal_pixel_format_get_bit_depth (out_pixel_format ) / 8 ;
188+ uint32_t out_pixel_depth = color_hal_pixel_format_get_bit_depth (out_pixel_format ); // bits
189+ uint32_t out_pic_len = config -> out .pic_w * config -> out .pic_h * out_pixel_depth / 8 ;
189190 ESP_RETURN_ON_FALSE (out_pic_len <= config -> out .buffer_size , ESP_ERR_INVALID_ARG , TAG , "out.pic_w/h mismatch with out.buffer_size" );
190191 ESP_RETURN_ON_FALSE (config -> in_bg .block_w == config -> in_fg .block_w && config -> in_bg .block_h == config -> in_fg .block_h ,
191192 ESP_ERR_INVALID_ARG , TAG , "in_bg.block_w/h must be equal to in_fg.block_w/h" );
@@ -243,8 +244,10 @@ esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_conf
243244 uint32_t in_fg_ext_window = (uint32_t )config -> in_fg .buffer + config -> in_fg .block_offset_y * config -> in_fg .pic_w * in_fg_pixel_depth / 8 ;
244245 uint32_t in_fg_ext_window_len = config -> in_fg .pic_w * config -> in_fg .block_h * in_fg_pixel_depth / 8 ;
245246 esp_cache_msync ((void * )in_fg_ext_window , in_fg_ext_window_len , ESP_CACHE_MSYNC_FLAG_DIR_C2M | ESP_CACHE_MSYNC_FLAG_UNALIGNED );
246- // Invalidate out_buffer entire picture (alignment strict on M2C direction)
247- esp_cache_msync ((void * )config -> out .buffer , config -> out .buffer_size , ESP_CACHE_MSYNC_FLAG_DIR_M2C );
247+ // Invalidate out_buffer extended window (alignment strict on M2C direction)
248+ uint32_t out_ext_window = (uint32_t )config -> out .buffer + config -> out .block_offset_y * config -> out .pic_w * out_pixel_depth / 8 ;
249+ uint32_t out_ext_window_len = config -> out .pic_w * config -> in_bg .block_h * out_pixel_depth / 8 ;
250+ esp_cache_msync ((void * )PPA_ALIGN_DOWN (out_ext_window , buf_alignment_size ), PPA_ALIGN_UP (out_ext_window_len , buf_alignment_size ), ESP_CACHE_MSYNC_FLAG_DIR_M2C );
248251
249252 esp_err_t ret = ESP_OK ;
250253 ppa_trans_t * trans_elm = NULL ;
0 commit comments