summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/hantro/hantro_drv.c
diff options
context:
space:
mode:
authorChen-Yu Tsai <wenst@chromium.org>2022-01-07 10:34:54 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-01-28 13:27:12 +0100
commitdc8bfe1e482de4395cf39f2c7cb3b885793ec7b8 (patch)
tree299e0ef031f240d46cd38e9e63459d1dad889482 /drivers/staging/media/hantro/hantro_drv.c
parent7464f055e9c348b86ca09abf7f2c2df017cdedbf (diff)
downloadlinux-dc8bfe1e482de4395cf39f2c7cb3b885793ec7b8.tar.bz2
media: hantro: output encoded JPEG content directly to capture buffers
Now that the JPEG header length is aligned with bus access boundaries, the JPEG encoder can output to the capture buffers directly without going through a bounce buffer. Do just that, and get rid of all the bounce buffer related code. Signed-off-by: Chen-Yu Tsai <wenst@chromium.org> Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/staging/media/hantro/hantro_drv.c')
-rw-r--r--drivers/staging/media/hantro/hantro_drv.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c
index b376b9d94b01..bc9bcb4eaf46 100644
--- a/drivers/staging/media/hantro/hantro_drv.c
+++ b/drivers/staging/media/hantro/hantro_drv.c
@@ -219,21 +219,15 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
if (ret)
return ret;
+ dst_vq->bidirectional = true;
+ dst_vq->mem_ops = &vb2_dma_contig_memops;
+ dst_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES;
/*
- * When encoding, the CAPTURE queue doesn't need dma memory,
- * as the CPU needs to create the JPEG frames, from the
- * hardware-produced JPEG payload.
- *
- * For the DMA destination buffer, we use a bounce buffer.
+ * The Kernel needs access to the JPEG destination buffer for the
+ * JPEG encoder to fill in the JPEG headers.
*/
- if (ctx->is_encoder) {
- dst_vq->mem_ops = &vb2_vmalloc_memops;
- } else {
- dst_vq->bidirectional = true;
- dst_vq->mem_ops = &vb2_dma_contig_memops;
- dst_vq->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES |
- DMA_ATTR_NO_KERNEL_MAPPING;
- }
+ if (!ctx->is_encoder)
+ dst_vq->dma_attrs |= DMA_ATTR_NO_KERNEL_MAPPING;
dst_vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
dst_vq->io_modes = VB2_MMAP | VB2_DMABUF;