Skip to contentSkip to conversation

media: staging/imx: fill vb2_v4l2_buffer field entry

PATCH In review Peter Seiderer 5 participants 9 messages Mar 15, 2018 – Jun 12, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 media: staging/imx: fill vb2_v4l2_buffer field entry

- fixes gstreamer v4l2src warning:

0:00:00.716640334 349 0x164f720 WARN v4l2bufferpool gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src> Driver should never set v4l2_buffer.field to ANY

- fixes v4l2-compliance test failure:

Streaming ioctls:

          test read/write: OK (Not Supported)
              Video Capture:
                  Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
                  fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

---
Changes in v4:
- new patch (put first because patch is needed to advance with the v4l2-compliance test), thanks to Philipp Zabel <[email protected]> for suggested solution for the right field value source

---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 1 +
 drivers/staging/media/imx/imx-media-csi.c   | 1 +
 2 files changed, 2 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +1 -0
index ae453fd422f0..ffeb017c73b2 100644
@@ -210,6 +210,7 @@ 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;
 		vb = &done->vbuf.vb2_buf;
 		vb->timestamp = ktime_get_ns();
 		vb2_buffer_done(vb, priv->nfb4eof ?
drivers/staging/media/imx/imx-media-csi.c +1 -0
index 5a195f80a24d..5f69117b5811 100644
@@ -236,6 +236,7 @@ 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;
 		vb = &done->vbuf.vb2_buf;
 		vb->timestamp = ktime_get_ns();
 		vb2_buffer_done(vb, priv->nfb4eof ?
Signature · 6 lines
2.16.2

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#1 lore raw

PATCH v4 2/2 media: staging/imx: fill vb2_v4l2_buffer sequence entry

- 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)

---
Changes in v2:
- fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too (suggested by Steve Longerbeam)

Changes in v3:
- add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam and Dan Carpenter) and patch history
- use u32 (instead of __u32) (suggested by Dan Carpenter)
- let sequence counter start with zero, keeping v4l2-compliance testing happy (needs additional setting of field to a valid value, patch will follow soon)

Changes in v4:
- add v4l2-compliance test failure to changelog
- reorder frame_sequence increment and assignement to avoid -1 as start value (suggeted by Steve Longerbeam)

---
 drivers/staging/media/imx/imx-ic-prpencvf.c | 4 ++++
 drivers/staging/media/imx/imx-media-csi.c   | 4 ++++
 2 files changed, 8 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +4 -0
index ffeb017c73b2..28f41caba05d 100644
@@ -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;
 
drivers/staging/media/imx/imx-media-csi.c +4 -0
index 5f69117b5811..3f2ce05848f3 100644
@@ -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 */
@@ -544,6 +547,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;
 
Signature · 6 lines
2.16.2

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
#2 lore raw

Re: [PATCH v4 2/2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

MUCH BETTER!111!Exclamationmark! Thanks! :)

regards,
dan carpenter

maintainer Reviewed-by on v4 2/2
#3 lore raw

Re: [PATCH v4 2/2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

In reply to Peter Seiderer
Quoted 100 lines · Peter Seiderer

- 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)

---
Changes in v2:
- fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too (suggested by Steve Longerbeam)

Changes in v3:
- add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam and Dan Carpenter) and patch history
- use u32 (instead of __u32) (suggested by Dan Carpenter)
- let sequence counter start with zero, keeping v4l2-compliance testing happy (needs additional setting of field to a valid value, patch will follow soon)

Changes in v4:
- add v4l2-compliance test failure to changelog
- reorder frame_sequence increment and assignement to avoid -1 as start value (suggeted by Steve Longerbeam)

---
  drivers/staging/media/imx/imx-ic-prpencvf.c | 4 ++++
  drivers/staging/media/imx/imx-media-csi.c   | 4 ++++
  2 files changed, 8 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +4 -0
index ffeb017c73b2..28f41caba05d 100644
@@ -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;
 
drivers/staging/media/imx/imx-media-csi.c +3 -0
index 5f69117b5811..3f2ce05848f3 100644
@@ -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 */

drivers/staging/media/imx/imx-media-csi.c static int csi_idmac_start(struct csi_priv *priv) · line 553

Quoted 7 lines
drivers/staging/media/imx/imx-media-csi.c +1 -0
@@ -544,6 +547,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;
 

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#4 lore raw

Re: [PATCH v4 2/2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

Hello *,

Quoted 1 line · Steve Longerbeam

Ping? Anybody taking this one?

Regards,
Peter

Quoted 111 lines · Peter Seiderer
Quoted 107 lines

- 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)

---
Changes in v2:
- fill vb2_v4l2_buffer sequence entry in imx-ic-prpencvf too (suggested by Steve Longerbeam)

Changes in v3:
- add changelog (suggested by Greg Kroah-Hartman, Fabio Estevam and Dan Carpenter) and patch history
- use u32 (instead of __u32) (suggested by Dan Carpenter)
- let sequence counter start with zero, keeping v4l2-compliance testing happy (needs additional setting of field to a valid value, patch will follow soon)

Changes in v4:
- add v4l2-compliance test failure to changelog
- reorder frame_sequence increment and assignement to avoid -1 as start value (suggeted by Steve Longerbeam)

---
  drivers/staging/media/imx/imx-ic-prpencvf.c | 4 ++++
  drivers/staging/media/imx/imx-media-csi.c   | 4 ++++
  2 files changed, 8 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +4 -0
index ffeb017c73b2..28f41caba05d 100644
@@ -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;
 
drivers/staging/media/imx/imx-media-csi.c +4 -0
index 5f69117b5811..3f2ce05848f3 100644
@@ -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 */
@@ -544,6 +547,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;
 
#6 lore raw

Re: [PATCH v4 2/2] media: staging/imx: fill vb2_v4l2_buffer sequence entry

Quoted 11 lines · Philipp Zabel

Hi,

Quoted 7 lines · Peter Seiderer

Hello *,

Quoted 1 line · Steve Longerbeam

Ping? Anybody taking this one?

Quoted 9 lines

The patches have been marked not applicable in patchwork [1][2]. They do apply on media_tree master.

[1] https://patchwork.linuxtv.org/patch/47946/
[2] https://patchwork.linuxtv.org/patch/47947/

regards
Philipp

I changed the state to NEW and delegated it to me, so the next time I'm processing patches I'll handled them. I suspect the state was changed by mistake by someone (quite possibly me!).

Regards,

Hans

maintainer Reviewed-by on v4 1/2
#7 lore raw
In reply to Peter Seiderer
Quoted 41 lines · Peter Seiderer

- fixes gstreamer v4l2src warning:

   0:00:00.716640334  349  0x164f720 WARN  v4l2bufferpool gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src> Driver should never set v4l2_buffer.field to ANY

- fixes v4l2-compliance test failure:

Streaming ioctls:

           test read/write: OK (Not Supported)
               Video Capture:
                   Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
                   fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

---
Changes in v4:
- new patch (put first because patch is needed to advance with the v4l2-compliance test), thanks to Philipp Zabel <[email protected]> for suggested solution for the right field value source

---
  drivers/staging/media/imx/imx-ic-prpencvf.c | 1 +
  drivers/staging/media/imx/imx-media-csi.c   | 1 +
  2 files changed, 2 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +1 -0
index ae453fd422f0..ffeb017c73b2 100644
@@ -210,6 +210,7 @@ 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;
  		vb = &done->vbuf.vb2_buf;
  		vb->timestamp = ktime_get_ns();
  		vb2_buffer_done(vb, priv->nfb4eof ?
drivers/staging/media/imx/imx-media-csi.c +0 -0
index 5a195f80a24d..5f69117b5811 100644

drivers/staging/media/imx/imx-media-csi.c static void csi_vb2_buf_done(struct csi_priv *priv) · line 242

Quoted 7 lines
drivers/staging/media/imx/imx-media-csi.c +1 -0
@@ -236,6 +236,7 @@ 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;
  		vb = &done->vbuf.vb2_buf;
  		vb->timestamp = ktime_get_ns();
  		vb2_buffer_done(vb, priv->nfb4eof ?

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

#8 lore raw

Hello *,

Quoted 1 line · Steve Longerbeam

Ping? Anybody taking this one?

Regards,
Peter

Quoted 52 lines · Peter Seiderer
Quoted 48 lines

- fixes gstreamer v4l2src warning:

   0:00:00.716640334  349  0x164f720 WARN  v4l2bufferpool gstv4l2bufferpool.c:1195:gst_v4l2_buffer_pool_dqbuf:<v4l2src0:pool:src> Driver should never set v4l2_buffer.field to ANY

- fixes v4l2-compliance test failure:

Streaming ioctls:

           test read/write: OK (Not Supported)
               Video Capture:
                   Buffer: 0 Sequence: 0 Field: Any Timestamp: 58.383658s
                   fail: v4l2-test-buffers.cpp(297): g_field() == V4L2_FIELD_ANY

---
Changes in v4:
- new patch (put first because patch is needed to advance with the v4l2-compliance test), thanks to Philipp Zabel <[email protected]> for suggested solution for the right field value source

---
  drivers/staging/media/imx/imx-ic-prpencvf.c | 1 +
  drivers/staging/media/imx/imx-media-csi.c   | 1 +
  2 files changed, 2 insertions(+)
drivers/staging/media/imx/imx-ic-prpencvf.c +1 -0
index ae453fd422f0..ffeb017c73b2 100644
@@ -210,6 +210,7 @@ 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;
  		vb = &done->vbuf.vb2_buf;
  		vb->timestamp = ktime_get_ns();
  		vb2_buffer_done(vb, priv->nfb4eof ?
drivers/staging/media/imx/imx-media-csi.c +1 -0
index 5a195f80a24d..5f69117b5811 100644
@@ -236,6 +236,7 @@ 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;
  		vb = &done->vbuf.vb2_buf;
  		vb->timestamp = ktime_get_ns();
  		vb2_buffer_done(vb, priv->nfb4eof ?