aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-03-10 09:58:28 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-11 09:34:36 -0400
commitca5f5fdb298a838958367b6fd769a3d084c67183 (patch)
tree55d1e2d0825448940cc92a2d29d9d80f6bbeef8b
parenta773632c1f9096f76d4b5a112d8e5a7183097aa6 (diff)
[media] mem2mem_testdev: fix field, sequence and time copying
- Set the sequence counters correctly. - Copy timestamps, timecode, relevant buffer flags and field from the received buffer to the outgoing buffer. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/mem2mem_testdev.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/media/platform/mem2mem_testdev.c b/drivers/media/platform/mem2mem_testdev.c
index 1ba1a839d5c1..dec8092921b1 100644
--- a/drivers/media/platform/mem2mem_testdev.c
+++ b/drivers/media/platform/mem2mem_testdev.c
@@ -112,6 +112,7 @@ struct m2mtest_q_data {
112 unsigned int width; 112 unsigned int width;
113 unsigned int height; 113 unsigned int height;
114 unsigned int sizeimage; 114 unsigned int sizeimage;
115 unsigned int sequence;
115 struct m2mtest_fmt *fmt; 116 struct m2mtest_fmt *fmt;
116}; 117};
117 118
@@ -234,12 +235,21 @@ static int device_process(struct m2mtest_ctx *ctx,
234 bytes_left = bytesperline - tile_w * MEM2MEM_NUM_TILES; 235 bytes_left = bytesperline - tile_w * MEM2MEM_NUM_TILES;
235 w = 0; 236 w = 0;
236 237
238 out_vb->v4l2_buf.sequence = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)->sequence++;
239 in_vb->v4l2_buf.sequence = q_data->sequence++;
237 memcpy(&out_vb->v4l2_buf.timestamp, 240 memcpy(&out_vb->v4l2_buf.timestamp,
238 &in_vb->v4l2_buf.timestamp, 241 &in_vb->v4l2_buf.timestamp,
239 sizeof(struct timeval)); 242 sizeof(struct timeval));
240 out_vb->v4l2_buf.flags &= ~V4L2_BUF_FLAG_TSTAMP_SRC_MASK; 243 if (in_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TIMECODE)
241 out_vb->v4l2_buf.flags |= 244 memcpy(&out_vb->v4l2_buf.timecode, &in_vb->v4l2_buf.timecode,
242 in_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK; 245 sizeof(struct v4l2_timecode));
246 out_vb->v4l2_buf.field = in_vb->v4l2_buf.field;
247 out_vb->v4l2_buf.flags = in_vb->v4l2_buf.flags &
248 (V4L2_BUF_FLAG_TIMECODE |
249 V4L2_BUF_FLAG_KEYFRAME |
250 V4L2_BUF_FLAG_PFRAME |
251 V4L2_BUF_FLAG_BFRAME |
252 V4L2_BUF_FLAG_TSTAMP_SRC_MASK);
243 253
244 switch (ctx->mode) { 254 switch (ctx->mode) {
245 case MEM2MEM_HFLIP | MEM2MEM_VFLIP: 255 case MEM2MEM_HFLIP | MEM2MEM_VFLIP:
@@ -765,9 +775,19 @@ static int m2mtest_buf_prepare(struct vb2_buffer *vb)
765static void m2mtest_buf_queue(struct vb2_buffer *vb) 775static void m2mtest_buf_queue(struct vb2_buffer *vb)
766{ 776{
767 struct m2mtest_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 777 struct m2mtest_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
778
768 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); 779 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb);
769} 780}
770 781
782static int m2mtest_start_streaming(struct vb2_queue *q, unsigned count)
783{
784 struct m2mtest_ctx *ctx = vb2_get_drv_priv(q);
785 struct m2mtest_q_data *q_data = get_q_data(ctx, q->type);
786
787 q_data->sequence = 0;
788 return 0;
789}
790
771static int m2mtest_stop_streaming(struct vb2_queue *q) 791static int m2mtest_stop_streaming(struct vb2_queue *q)
772{ 792{
773 struct m2mtest_ctx *ctx = vb2_get_drv_priv(q); 793 struct m2mtest_ctx *ctx = vb2_get_drv_priv(q);
@@ -792,6 +812,7 @@ static struct vb2_ops m2mtest_qops = {
792 .queue_setup = m2mtest_queue_setup, 812 .queue_setup = m2mtest_queue_setup,
793 .buf_prepare = m2mtest_buf_prepare, 813 .buf_prepare = m2mtest_buf_prepare,
794 .buf_queue = m2mtest_buf_queue, 814 .buf_queue = m2mtest_buf_queue,
815 .start_streaming = m2mtest_start_streaming,
795 .stop_streaming = m2mtest_stop_streaming, 816 .stop_streaming = m2mtest_stop_streaming,
796 .wait_prepare = vb2_ops_wait_prepare, 817 .wait_prepare = vb2_ops_wait_prepare,
797 .wait_finish = vb2_ops_wait_finish, 818 .wait_finish = vb2_ops_wait_finish,