Skip to content

Commit ce6f2d6

Browse files
Ming Qiangregkh
authored andcommitted
media: amphion: Add a frame flush mode for decoder
[ Upstream commit 9ea16ba ] By default the amphion decoder will pre-parse 3 frames before starting to decode the first frame. Alternatively, a block of flush padding data can be appended to the frame, which will ensure that the decoder can start decoding immediately after parsing the flush padding data, thus potentially reducing decoding latency. This mode was previously only enabled, when the display delay was set to 0. Allow the user to manually toggle the use of that mode via a module parameter called low_latency, which enables the mode without changing the display order. Signed-off-by: Ming Qian <ming.qian@oss.nxp.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Stable-dep-of: 634c2cd ("media: amphion: Remove vpu_vb_is_codecconfig") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b92c196 commit ce6f2d6

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

drivers/media/platform/amphion/vpu_malone.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
#include "vpu_imx8q.h"
2626
#include "vpu_malone.h"
2727

28+
static bool low_latency;
29+
module_param(low_latency, bool, 0644);
30+
MODULE_PARM_DESC(low_latency, "Set low latency frame flush mode: 0 (disable) or 1 (enable)");
31+
2832
#define CMD_SIZE 25600
2933
#define MSG_SIZE 25600
3034
#define CODEC_SIZE 0x1000
@@ -1562,7 +1566,15 @@ static int vpu_malone_input_frame_data(struct vpu_malone_str_buffer __iomem *str
15621566

15631567
vpu_malone_update_wptr(str_buf, wptr);
15641568

1565-
if (disp_imm && !vpu_vb_is_codecconfig(vbuf)) {
1569+
/*
1570+
* Enable the low latency flush mode if display delay is set to 0
1571+
* or the low latency frame flush mode if it is set to 1.
1572+
* The low latency flush mode requires some padding data to be appended to each frame,
1573+
* but there must not be any padding data between the sequence header and the frame.
1574+
* This module is currently only supported for the H264 and HEVC formats,
1575+
* for other formats, vpu_malone_add_scode() will return 0.
1576+
*/
1577+
if ((disp_imm || low_latency) && !vpu_vb_is_codecconfig(vbuf)) {
15661578
ret = vpu_malone_add_scode(inst->core->iface,
15671579
inst->id,
15681580
&inst->stream_buffer,

0 commit comments

Comments
 (0)