OSDN Git Service

media: staging/imx: fill vb2_v4l2_buffer sequence entry
authorPeter Seiderer <ps.report@gmx.net>
Thu, 15 Mar 2018 19:13:23 +0000 (15:13 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 4 Jul 2018 13:25:37 +0000 (09:25 -0400)
- enables gstreamer v4l2src lost frame detection, e.g:

  0:00:08.685185668  348  0x54f520 WARN  v4l2src gstv4l2src.c:970:gst_v4l2src_create:<v4l2src0> lost frames detected: count = 141 - ts: 0:00:08.330177332

- fixes v4l2-compliance test failure:

  Streaming ioctls:
          test read/write: OK (Not Supported)
              Video Capture:
                  Buffer: 0 Sequence: 0 Field: None Timestamp: 92.991450s
                  Buffer: 1 Sequence: 0 Field: None Timestamp: 93.008135s
                  fail: v4l2-test-buffers.cpp(294): (int)g_sequence() < seq.last_seq + 1
                  fail: v4l2-test-buffers.cpp(707): buf.check(q, last_seq)

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-csi.c

index ffeb017..28f41ca 100644 (file)
@@ -103,6 +103,7 @@ struct prp_priv {
        int nfb4eof_irq;
 
        int stream_count;
+       u32 frame_sequence; /* frame sequence counter */
        bool last_eof;  /* waiting for last EOF at stream off */
        bool nfb4eof;    /* NFB4EOF encountered during streaming */
        struct completion last_eof_comp;
@@ -211,12 +212,14 @@ static void prp_vb2_buf_done(struct prp_priv *priv, struct ipuv3_channel *ch)
        done = priv->active_vb2_buf[priv->ipu_buf_num];
        if (done) {
                done->vbuf.field = vdev->fmt.fmt.pix.field;
+               done->vbuf.sequence = priv->frame_sequence;
                vb = &done->vbuf.vb2_buf;
                vb->timestamp = ktime_get_ns();
                vb2_buffer_done(vb, priv->nfb4eof ?
                                VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
        }
 
+       priv->frame_sequence++;
        priv->nfb4eof = false;
 
        /* get next queued buffer */
@@ -638,6 +641,7 @@ static int prp_start(struct prp_priv *priv)
 
        /* init EOF completion waitq */
        init_completion(&priv->last_eof_comp);
+       priv->frame_sequence = 0;
        priv->last_eof = false;
        priv->nfb4eof = false;
 
index caf9029..6a89283 100644 (file)
@@ -111,6 +111,7 @@ struct csi_priv {
        struct v4l2_ctrl_handler ctrl_hdlr;
 
        int stream_count; /* streaming counter */
+       u32 frame_sequence; /* frame sequence counter */
        bool last_eof;   /* waiting for last EOF at stream off */
        bool nfb4eof;    /* NFB4EOF encountered during streaming */
        struct completion last_eof_comp;
@@ -237,12 +238,14 @@ static void csi_vb2_buf_done(struct csi_priv *priv)
        done = priv->active_vb2_buf[priv->ipu_buf_num];
        if (done) {
                done->vbuf.field = vdev->fmt.fmt.pix.field;
+               done->vbuf.sequence = priv->frame_sequence;
                vb = &done->vbuf.vb2_buf;
                vb->timestamp = ktime_get_ns();
                vb2_buffer_done(vb, priv->nfb4eof ?
                                VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
        }
 
+       priv->frame_sequence++;
        priv->nfb4eof = false;
 
        /* get next queued buffer */
@@ -546,6 +549,7 @@ static int csi_idmac_start(struct csi_priv *priv)
 
        /* init EOF completion waitq */
        init_completion(&priv->last_eof_comp);
+       priv->frame_sequence = 0;
        priv->last_eof = false;
        priv->nfb4eof = false;