From 56353bf1182b28b22077fbb4b12acb7252a88d07 Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Tue, 29 Nov 2022 21:49:41 +0800 Subject: [PATCH] video: rockchip: mpp: fix jpege dma coherence issue Allocate multiple jpeg enc cores to encode the same frame at the same time, and than there is a dma cache coherence issue when the user space copies bitstream data to another buffer. So, need to invalid cache after every core encoding done. Signed-off-by: Yandong Lin Change-Id: I0868398f09787cdbd2be6f6a2cd3c1adbe61e4b5 --- drivers/video/rockchip/mpp/mpp_vepu2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/video/rockchip/mpp/mpp_vepu2.c b/drivers/video/rockchip/mpp/mpp_vepu2.c index f767c533515d..f57d4dff6d08 100644 --- a/drivers/video/rockchip/mpp/mpp_vepu2.c +++ b/drivers/video/rockchip/mpp/mpp_vepu2.c @@ -202,12 +202,13 @@ static int vepu_process_reg_fd(struct mpp_session *session, if (fmt == VEPU2_FMT_JPEGE) { task->offset_bs = mpp_query_reg_offset_info(&task->off_inf, VEPU2_REG_OUT_INDEX); - if (task->offset_bs > 0) - task->dmabuf_bs = dma_buf_get(fd_bs); + task->dmabuf_bs = dma_buf_get(fd_bs); - if (IS_ERR_OR_NULL(task->dmabuf_bs)) + if (IS_ERR_OR_NULL(task->dmabuf_bs)) { task->dmabuf_bs = NULL; - else + return 0; + } + if (task->offset_bs > 0) dma_buf_end_cpu_access_partial(task->dmabuf_bs, DMA_TO_DEVICE, 0, task->offset_bs); }