[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190726180716.GA3909@xo-6d-61-c0.localdomain>
Date: Fri, 26 Jul 2019 20:07:16 +0200
From: Pavel Machek <pavel@....cz>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org,
Philipp Zabel <p.zabel@...gutronix.de>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
linux-media@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 4.19 097/158] media: coda: fix mpeg2 sequence
number handling
Hi!
> From: Philipp Zabel <p.zabel@...gutronix.de>
>
> [ Upstream commit 56d159a4ec6d8da7313aac6fcbb95d8fffe689ba ]
>
> Sequence number handling assumed that the BIT processor frame number
> starts counting at 1, but this is not true for the MPEG-2 decoder,
> which starts at 0. Fix the sequence counter offset detection to handle
> this.
> +++ b/drivers/media/platform/coda/coda-bit.c
> @@ -1728,6 +1728,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
> v4l2_err(&dev->v4l2_dev, "CODA_COMMAND_SEQ_INIT timeout\n");
> return ret;
> }
> + ctx->sequence_offset = ~0U;
> ctx->initialized = 1;
>
> /* Update kfifo out pointer from coda bitstream read pointer */
> @@ -2147,7 +2148,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
> v4l2_err(&dev->v4l2_dev,
> "decoded frame index out of range: %d\n", decoded_idx);
> } else {
> - val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
> + val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM);
> + if (ctx->sequence_offset == -1)
> + ctx->sequence_offset = val;
For consistency, would it be better to use == ~0U here, too? Variable is unsigned...
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Powered by blists - more mailing lists