All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>,
	Kamil Debski <k.debski@samsung.com>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	kernel@pengutronix.de, Philipp Zabel <p.zabel@pengutronix.de>
Subject: [PATCH v2 22/29] [media] coda: add sequence counter offset
Date: Tue, 24 Jun 2014 16:56:04 +0200	[thread overview]
Message-ID: <1403621771-11636-23-git-send-email-p.zabel@pengutronix.de> (raw)
In-Reply-To: <1403621771-11636-1-git-send-email-p.zabel@pengutronix.de>

The coda h.264 decoder also counts PIC_RUNs where no frame was decoded but
a frame was rotated out / marked as ready to be displayed. This causes an
offset between the incoming encoded frame's sequence number and the decode
sequence number returned by the coda. This patch introduces a sequence
counter offset variable to keep track of the difference.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/coda.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 6e65ab9..4548c84 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -222,6 +222,7 @@ struct coda_ctx {
 	u32				isequence;
 	u32				qsequence;
 	u32				osequence;
+	u32				sequence_offset;
 	struct coda_q_data		q_data[2];
 	enum coda_inst_type		inst_type;
 	struct coda_codec		*codec;
@@ -2620,6 +2621,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
 		ctx->streamon_cap = 0;
 
 		ctx->osequence = 0;
+		ctx->sequence_offset = 0;
 	}
 
 	if (!ctx->streamon_out && !ctx->streamon_cap) {
@@ -3125,7 +3127,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 
 	if (decoded_idx == -1) {
 		/* no frame was decoded, but we might have a display frame */
-		if (display_idx < 0 && ctx->display_idx < 0)
+		if (display_idx >= 0 && display_idx < ctx->num_internal_frames)
+			ctx->sequence_offset++;
+		else if (ctx->display_idx < 0)
 			ctx->prescan_failed = true;
 	} else if (decoded_idx == -2) {
 		/* no frame was decoded, we still return the remaining buffers */
@@ -3137,10 +3141,11 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 				      struct coda_timestamp, list);
 		list_del(&ts->list);
 		val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
+		val -= ctx->sequence_offset;
 		if (val != ts->sequence) {
 			v4l2_err(&dev->v4l2_dev,
-				 "sequence number mismatch (%d != %d)\n",
-				 val, ts->sequence);
+				 "sequence number mismatch (%d(%d) != %d)\n",
+				 val, ctx->sequence_offset, ts->sequence);
 		}
 		ctx->frame_timestamps[decoded_idx] = *ts;
 		kfree(ts);
-- 
2.0.0


  parent reply	other threads:[~2014-06-24 14:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 14:55 [PATCH v2 00/29] Initial CODA960 (i.MX6 VPU) support Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 01/29] [media] coda: fix decoder I/P/B frame detection Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 02/29] [media] coda: fix readback of CODA_RET_DEC_SEQ_FRAME_NEED Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 03/29] [media] coda: fix h.264 quantization parameter range Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 04/29] [media] coda: fix internal framebuffer allocation size Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 05/29] [media] coda: simplify IRAM setup Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960 Philipp Zabel
2014-06-24 16:16   ` Nicolas Dufresne
2014-07-01 17:53     ` Philipp Zabel
2014-07-02 13:37       ` Kamil Debski
2014-07-02 19:16         ` Robert Schwebel
2014-07-11 12:33           ` Robert Schwebel
2014-07-11 12:53             ` Fabio Estevam
2014-07-21  7:07             ` Robert Schwebel
2014-07-25 12:27               ` Fabio Estevam
2014-08-14  7:15               ` Robert Schwebel
2014-06-24 14:55 ` [PATCH v2 07/29] [media] coda: remove BUG() in get_q_data Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 08/29] [media] coda: add selection API support for h.264 decoder Philipp Zabel
2014-06-27  8:58   ` Hans Verkuil
2014-06-24 14:55 ` [PATCH v2 09/29] [media] coda: add workqueue to serialize hardware commands Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 10/29] [media] coda: Use mem-to-mem ioctl helpers Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 11/29] [media] coda: use ctx->fh.m2m_ctx instead of ctx->m2m_ctx Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 12/29] [media] coda: Add runtime pm support Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 13/29] [media] coda: split firmware version check out of coda_hw_init Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 14/29] [media] coda: select GENERIC_ALLOCATOR Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 15/29] [media] coda: add h.264 min/max qp controls Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 16/29] [media] coda: add h.264 deblocking filter controls Philipp Zabel
2014-06-24 14:55 ` [PATCH v2 17/29] [media] coda: add cyclic intra refresh control Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 18/29] [media] v4l2-mem2mem: export v4l2_m2m_try_schedule Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 19/29] [media] coda: try to schedule a decode run after a stop command Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 20/29] [media] coda: add decoder timestamp queue Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 21/29] [media] coda: alert userspace about macroblock errors Philipp Zabel
2014-06-24 14:56 ` Philipp Zabel [this message]
2014-06-24 14:56 ` [PATCH v2 23/29] [media] coda: use prescan_failed variable to stop stream after a timeout Philipp Zabel
2014-07-02 12:58   ` Kamil Debski
2014-07-02 13:43     ` Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 24/29] [media] coda: add reset control support Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 25/29] [media] coda: add bytesperline to queue data Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 26/29] [media] coda: allow odd width, but still round up bytesperline Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 27/29] [media] coda: round up internal frames to multiples of macroblock size for h.264 Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 28/29] [media] coda: increase frame stride to 16 " Philipp Zabel
2014-06-24 14:56 ` [PATCH v2 29/29] [media] coda: export auxiliary buffers via debugfs Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403621771-11636-23-git-send-email-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=fabio.estevam@freescale.com \
    --cc=k.debski@samsung.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.