media: coda: increment sequence offset for the last returned frame [Linux 4.9.187]

This Linux kernel change "media: coda: increment sequence offset for the last returned frame" is included in the Linux 4.9.187 release. This change is authored by Philipp Zabel <p.zabel [at] pengutronix.de> on Tue Jun 18 12:45:22 2019 -0400. The commit for this change in Linux stable tree is 98f458f (patch) which is from upstream commit b3b7d96. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream b3b7d96.

media: coda: increment sequence offset for the last returned frame

[ Upstream commit b3b7d96817cdb8b6fc353867705275dce8f41ccc ]

If no more frames are decoded in bitstream end mode, and a previously
decoded frame has been returned, the firmware still increments the frame
number. To avoid a sequence number mismatch after decoder restart,
increment the sequence_offset correction parameter.

Signed-off-by: Philipp Zabel <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/media/platform/coda/coda-bit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 1b8024f..df46439 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1967,6 +1967,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
        else if (ctx->display_idx < 0)
            ctx->hold = true;
    } else if (decoded_idx == -2) {
+       if (ctx->display_idx >= 0 &&
+           ctx->display_idx < ctx->num_internal_frames)
+           ctx->sequence_offset++;
        /* no frame was decoded, we still return remaining buffers */
    } else if (decoded_idx < 0 || decoded_idx >= ctx->num_internal_frames) {
        v4l2_err(&dev->v4l2_dev,

Leave a Reply

Your email address will not be published. Required fields are marked *