media: coda: fix frame_mem_ctrl for YUV420 and YVU420 formats
The frame memory control register value is currently determined
before userspace selects the final capture format and never corrected.
Update ctx->frame_mem_ctrl in __coda_start_decoding() to fix decoding
into YUV420 or YVU420 capture buffers.
Reported-by: Andrej Picej <andrej.picej@norik.com>
Fixes: 497e6b8559
("media: coda: add sequence initialization work")
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
fa0b565859
commit
44693d74f5
|
@ -2053,17 +2053,25 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
|
||||||
u32 src_fourcc, dst_fourcc;
|
u32 src_fourcc, dst_fourcc;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!ctx->initialized) {
|
|
||||||
ret = __coda_decoder_seq_init(ctx);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
|
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
|
||||||
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
|
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
|
||||||
src_fourcc = q_data_src->fourcc;
|
src_fourcc = q_data_src->fourcc;
|
||||||
dst_fourcc = q_data_dst->fourcc;
|
dst_fourcc = q_data_dst->fourcc;
|
||||||
|
|
||||||
|
if (!ctx->initialized) {
|
||||||
|
ret = __coda_decoder_seq_init(ctx);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) |
|
||||||
|
CODA9_FRAME_TILED2LINEAR);
|
||||||
|
if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV)
|
||||||
|
ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE;
|
||||||
|
if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP)
|
||||||
|
ctx->frame_mem_ctrl |= (0x3 << 9) |
|
||||||
|
((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR);
|
||||||
|
}
|
||||||
|
|
||||||
coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR);
|
coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR);
|
||||||
|
|
||||||
ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);
|
ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);
|
||||||
|
|
Loading…
Reference in New Issue