aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2015-07-09 06:10:12 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-07-17 09:50:55 -0400
commitf964c409f7cc626335cf2370f55690660a273dad (patch)
tree252b08a921fc79a72b4631ec10050e0a5edcf17b /drivers/media/platform/coda
parentadb8963f27e00273c912a53f28f7af5d14cfd32e (diff)
[media] coda: clamp frame sequence counters to 16 bit
This is already done for one side of the comparison with the expectation that the HW counter rolls over at the 16 bit boundary. This is true when decoding a h.264 stream, but doesn't hold for at least MJPEG. As we don't know the exact wrap-around point for this format just clamp the HW counter to the same 16 bits. This should be enough to detect most of the errors and saves us from doing different comparisons based on the decoded format. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/coda')
-rw-r--r--drivers/media/platform/coda/coda-bit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index 109797bb8fbb..9fbff248d7fa 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1902,7 +1902,14 @@ static void coda_finish_decode(struct coda_ctx *ctx)
1902 meta = list_first_entry(&ctx->buffer_meta_list, 1902 meta = list_first_entry(&ctx->buffer_meta_list,
1903 struct coda_buffer_meta, list); 1903 struct coda_buffer_meta, list);
1904 list_del(&meta->list); 1904 list_del(&meta->list);
1905 if (val != (meta->sequence & 0xffff)) { 1905 /*
1906 * Clamp counters to 16 bits for comparison, as the HW
1907 * counter rolls over at this point for h.264. This
1908 * may be different for other formats, but using 16 bits
1909 * should be enough to detect most errors and saves us
1910 * from doing different things based on the format.
1911 */
1912 if ((val & 0xffff) != (meta->sequence & 0xffff)) {
1906 v4l2_err(&dev->v4l2_dev, 1913 v4l2_err(&dev->v4l2_dev,
1907 "sequence number mismatch (%d(%d) != %d)\n", 1914 "sequence number mismatch (%d(%d) != %d)\n",
1908 val, ctx->sequence_offset, 1915 val, ctx->sequence_offset,