summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Qin <som.qin@starfivetech.com>2023-08-01 14:09:12 +0800
committerSeung-Woo Kim <sw0312.kim@samsung.com>2023-10-05 18:25:46 +0900
commit24389f54f174fe64da4f681393d41e0f95a697d4 (patch)
tree2cac10b237a281e0213315ce404b104524061a40
parentba32ea8fc4196f4ef618ca37f1dcdd3d9dbaa3a2 (diff)
downloadlinux-starfive-24389f54f174fe64da4f681393d41e0f95a697d4.tar.gz
linux-starfive-24389f54f174fe64da4f681393d41e0f95a697d4.tar.bz2
linux-starfive-24389f54f174fe64da4f681393d41e0f95a697d4.zip
Media:wave5: Fix stride mismatching of decoding frame buffers
When bitstream format bitdepth > 8, stride of compressed frame map buffers shoule be recalculated. Signed-off-by: Som Qin <som.qin@starfivetech.com> [sw0312.kim: cherry-pick the commit a9830d5d01e9 from https://github.com/starfive-tech/linux/tree/JH7110_VisionFive2_6.1.y_devel] Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Change-Id: I58b550e525c8dde7175d09c2934f4f81e08df3fc
-rw-r--r--drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
index 275db3e04c57..f3e81243d866 100644
--- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
+++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c
@@ -958,7 +958,14 @@ static int wave5_vpu_dec_queue_setup(struct vb2_queue *q, unsigned int *num_buff
struct frame_buffer *frame = &inst->frame_buf[i];
struct vpu_buf *vframe = &inst->frame_vbuf[i];
- fb_stride = inst->dst_fmt.width;
+ if (inst->codec_info->dec_info.initial_info.luma_bitdepth > 8 ||
+ inst->codec_info->dec_info.initial_info.chroma_bitdepth > 8) {
+ fb_stride = ALIGN(ALIGN(inst->dst_fmt.width, 16) * 5, 32) / 4;
+ fb_stride = ALIGN(fb_stride, 32);
+ } else {
+ fb_stride = inst->dst_fmt.width;
+ }
+
fb_height = ALIGN(inst->dst_fmt.height, 32);
luma_size = fb_stride * fb_height;
chroma_size = ALIGN(fb_stride / 2, 16) * fb_height;