diff options
author | Jernej Skrabec <jernej.skrabec@gmail.com> | 2022-07-06 21:28:59 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-07-17 13:00:58 +0300 |
commit | 62d1c353b60a205130050e8b5d562708d6f7f8d3 (patch) | |
tree | 1ebf0211de3043d0ed9b25ccd6936b45de22fe95 | |
parent | 4dc1fc7197a3a65c59f37f7c0a842e1ce522cb6c (diff) | |
download | linux-62d1c353b60a205130050e8b5d562708d6f7f8d3.tar.xz |
media: hantro: postproc: Properly calculate chroma offset
Currently chroma offset calculation assumes only 1 byte per luma, with
no consideration for stride.
Take necessary information from destination pixel format which makes
calculation completely universal.
Reviewed-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Tested-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r-- | drivers/staging/media/hantro/hantro_postproc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/staging/media/hantro/hantro_postproc.c index 8933b4af73ed..a0928c508434 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -113,12 +113,14 @@ static void hantro_postproc_g2_enable(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *dst_buf; - size_t chroma_offset = ctx->dst_fmt.width * ctx->dst_fmt.height; int down_scale = down_scale_factor(ctx); + size_t chroma_offset; dma_addr_t dst_dma; dst_buf = hantro_get_dst_buf(ctx); dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0); + chroma_offset = ctx->dst_fmt.plane_fmt[0].bytesperline * + ctx->dst_fmt.height; if (down_scale) { hantro_reg_write(vpu, &g2_down_scale_e, 1); |