]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: venus: vdec: fix decoded data size
authorVikash Garodia <vgarodia@codeaurora.org>
Mon, 8 Oct 2018 11:09:04 +0000 (07:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 24 Nov 2019 07:20:49 +0000 (08:20 +0100)
[ Upstream commit ce32c0a530bd955206fe45c2eff77e581202d699 ]

Existing code returns the max of the decoded size and buffer size.
It turns out that buffer size is always greater due to hardware
alignment requirement. As a result, payload size given to client
is incorrect. This change ensures that the bytesused is assigned
to actual payload size, when available.

Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/qcom/venus/vdec.c

index dfbbbf0f746f93e41d9bf39c69ddc066b8f7a4a1..e40fdf97b0f03c5ec339a609868344b3f2634f76 100644 (file)
@@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
                unsigned int opb_sz = venus_helper_get_opb_size(inst);
 
                vb = &vbuf->vb2_buf;
-               vb->planes[0].bytesused =
-                       max_t(unsigned int, opb_sz, bytesused);
+               vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
                vb->planes[0].data_offset = data_offset;
                vb->timestamp = timestamp_us * NSEC_PER_USEC;
                vbuf->sequence = inst->sequence_cap++;