media: cedrus: h264: Fix 4K decoding on H6
authorJernej Skrabec <jernej.skrabec@siol.net>
Sun, 15 Mar 2020 09:54:46 +0000 (10:54 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 24 Mar 2020 16:05:29 +0000 (17:05 +0100)
Due to unknown reason, H6 needs larger intraprediction buffer for 4K
videos than other SoCs. This was discovered by playing 4096x2304 video,
which is maximum what H6 VPU is supposed to support.

Fixes: 03e612e701a6 ("media: cedrus: Fix H264 4k support")
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/sunxi/cedrus/cedrus_h264.c

index bfb4a4820a6741f3ecb8456979cc6f9036b0535f..54ee2aa423e22c2f726fe826a9fdf9c16468fcce 100644 (file)
@@ -610,8 +610,12 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
                        goto err_mv_col_buf;
                }
 
+               /*
+                * NOTE: Multiplying by two deviates from CedarX logic, but it
+                * is for some unknown reason needed for H264 4K decoding on H6.
+                */
                ctx->codec.h264.intra_pred_buf_size =
-                       ALIGN(ctx->src_fmt.width, 64) * 5;
+                       ALIGN(ctx->src_fmt.width, 64) * 5 * 2;
                ctx->codec.h264.intra_pred_buf =
                        dma_alloc_coherent(dev->dev,
                                           ctx->codec.h264.intra_pred_buf_size,