Skip to content

Commit

Permalink
media: cedrus: Fix SUNXI tile size calculation
Browse files Browse the repository at this point in the history
Tiled formats requires full rows being allocated (even for Chroma
planes). When the number of Luma tiles is odd, we need to round up
to twice the tile width in order to roundup the number of Chroma
tiles.

This was notice with a crash running BA1_FT_C compliance test using
sunxi tiles using GStreamer. Cedrus driver would allocate 9 rows for
Luma, but only 4.5 rows for Chroma, causing userspace to crash.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Fixes: 50e7615 ("media: platform: Add Cedrus VPU decoder driver")
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
  • Loading branch information
ndufresne authored and mchehab committed Sep 6, 2021
1 parent 31692ab commit 132c886
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/media/sunxi/cedrus/cedrus_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
sizeimage = bytesperline * height;

/* Chroma plane size. */
sizeimage += bytesperline * height / 2;
sizeimage += bytesperline * ALIGN(height, 64) / 2;

break;

Expand Down

0 comments on commit 132c886

Please sign in to comment.