mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
modules/py_tv: Improve cache display update cache efficency.
This commit is contained in:
parent
ddc1de8fb9
commit
87e8cbba0e
@ -729,7 +729,7 @@ static void spi_tv_display(image_t *src_img, int dst_x_start, int dst_y_start, f
|
||||
|
||||
#ifdef __DCACHE_PRESENT
|
||||
// Flush data for DMA
|
||||
SCB_CleanDCache();
|
||||
SCB_CleanDCache_by_Addr((uint32_t *) dst_img.data, image_size(&dst_img));
|
||||
#endif
|
||||
|
||||
// Update head which means a new image is ready.
|
||||
|
||||
@ -718,7 +718,20 @@ void jpeg_decompress(image_t *dst, image_t *src) {
|
||||
case PIXFORMAT_RGB565: {
|
||||
uint16_t *rp = IMAGE_COMPUTE_RGB565_PIXEL_ROW_PTR(dst, y_offset);
|
||||
HAL_DMA2D_Start(&DMA2D_Handle, (uint32_t) this_mcu_row_buffer_ptr, (uint32_t) rp, dst->w, dy);
|
||||
|
||||
// Invalidate any cached reads for the previous line that was just written.
|
||||
if ((y_offset - mcu_h) >= 0) {
|
||||
uint16_t *previous_rp = IMAGE_COMPUTE_RGB565_PIXEL_ROW_PTR(dst, (y_offset - mcu_h));
|
||||
SCB_InvalidateDCache_by_Addr((uint32_t *) previous_rp, dst->w * mcu_h * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
HAL_DMA2D_PollForTransfer(&DMA2D_Handle, JPEG_CODEC_TIMEOUT);
|
||||
|
||||
// For the last row invalidate any cached reads for the line that was just written.
|
||||
if ((y_offset + mcu_h) >= src->h) {
|
||||
SCB_InvalidateDCache_by_Addr((uint32_t *) rp, dst->w * mcu_h * sizeof(uint16_t));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -751,9 +764,6 @@ exit_cleanup:
|
||||
|
||||
if ((JPEG_state.jpeg_descr.Conf.ColorSpace == JPEG_YCBCR_COLORSPACE) && dst->is_color) {
|
||||
HAL_DMA2D_DeInit(&DMA2D_Handle);
|
||||
|
||||
// Ensure any cached reads are dropped.
|
||||
SCB_InvalidateDCache_by_Addr((uint32_t *) dst->data, image_size(dst));
|
||||
}
|
||||
|
||||
if (((uint32_t) src->data) % __SCB_DCACHE_LINE_SIZE) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user