From 28426402be90445115d536e3f5af1ad2e28f4fed Mon Sep 17 00:00:00 2001 From: Cho KyongHo Date: Wed, 22 Jul 2015 17:04:12 +0900 Subject: [PATCH] [COMMON] media: smfc: clean the dirty region by CPU in .buf_cleaup Even though userspace gives V4L2_BUF_FLAG_NO_CACHE_CLEAN flag in the v4l2_buffer on qbuf, it just guarantees that the buffer after the specific offset is not cache dirty by CPU. If the offset become smaller than the previous, H/W may starts to write the compressed stream on the area that may have dirty cache lines. To prevent the problem, the driver should clean the dirty cache lines if the offset becomes no longer valied. Change-Id: I54baba493dd4c179eda740bedba3378d4abe8435 Signed-off-by: Cho KyongHo --- drivers/media/platform/exynos/smfc/smfc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/media/platform/exynos/smfc/smfc.c b/drivers/media/platform/exynos/smfc/smfc.c index 84ac57901908..2722162fb7e3 100644 --- a/drivers/media/platform/exynos/smfc/smfc.c +++ b/drivers/media/platform/exynos/smfc/smfc.c @@ -443,6 +443,19 @@ static void smfc_vb2_buf_finish(struct vb2_buffer *vb) { } +static void smfc_vb2_buf_cleanup(struct vb2_buffer *vb) +{ + struct smfc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); + if (!V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type) && + !!(ctx->flags & SMFC_CTX_COMPRESS)) { + /* + * TODO: clean the APP segments written by CPU in front + * of the start of the JPEG stream to be written by H/W + * for the later use of this buffer. + */ + } +} + static void smfc_vb2_buf_queue(struct vb2_buffer *vb) { struct smfc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); @@ -470,6 +483,7 @@ static struct vb2_ops smfc_vb2_ops = { .queue_setup = smfc_vb2_queue_setup, .buf_prepare = smfc_vb2_buf_prepare, .buf_finish = smfc_vb2_buf_finish, + .buf_cleanup = smfc_vb2_buf_cleanup, .buf_queue = smfc_vb2_buf_queue, .wait_finish = vb2_ops_wait_finish, .wait_prepare = vb2_ops_wait_prepare, -- 2.20.1