aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-common.c
diff options
context:
space:
mode:
authorJunghak Sung <jh1009.sung@samsung.com>2015-09-22 09:30:30 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-10-01 08:04:43 -0400
commit2d7007153f0c9b1dd00c01894df7d26ddc32b79f (patch)
tree8320f9d22f45dd7dcea64088b50ff706bb0082b2 /drivers/media/platform/coda/coda-common.c
parentc139990e842d550db2f59bd4f5993bba90f140e0 (diff)
[media] media: videobuf2: Restructure vb2_buffer
Remove v4l2 stuff - v4l2_buf, v4l2_plane - from struct vb2_buffer. Add new member variables - bytesused, length, offset, userptr, fd, data_offset - to struct vb2_plane in order to cover all information of v4l2_plane. struct vb2_plane { <snip> unsigned int bytesused; unsigned int length; union { unsigned int offset; unsigned long userptr; int fd; } m; unsigned int data_offset; } Replace v4l2_buf with new member variables - index, type, memory - which are common fields for buffer management. struct vb2_buffer { <snip> unsigned int index; unsigned int type; unsigned int memory; unsigned int num_planes; struct vb2_plane planes[VIDEO_MAX_PLANES]; <snip> }; v4l2 specific fields - flags, field, timestamp, timecode, sequence - are moved to vb2_v4l2_buffer in videobuf2-v4l2.c struct vb2_v4l2_buffer { struct vb2_buffer vb2_buf; __u32 flags; __u32 field; struct timeval timestamp; struct v4l2_timecode timecode; __u32 sequence; }; Signed-off-by: Junghak Sung <jh1009.sung@samsung.com> Signed-off-by: Geunyoung Kim <nenggun.kim@samsung.com> Acked-by: Seung-Woo Kim <sw0312.kim@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> 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/coda-common.c')
-rw-r--r--drivers/media/platform/coda/coda-common.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 998fe6614b33..60336eec75af 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -84,9 +84,9 @@ unsigned int coda_read(struct coda_dev *dev, u32 reg)
84} 84}
85 85
86void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data, 86void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
87 struct vb2_buffer *buf, unsigned int reg_y) 87 struct vb2_v4l2_buffer *buf, unsigned int reg_y)
88{ 88{
89 u32 base_y = vb2_dma_contig_plane_dma_addr(buf, 0); 89 u32 base_y = vb2_dma_contig_plane_dma_addr(&buf->vb2_buf, 0);
90 u32 base_cb, base_cr; 90 u32 base_cb, base_cr;
91 91
92 switch (q_data->fourcc) { 92 switch (q_data->fourcc) {
@@ -684,17 +684,17 @@ static int coda_qbuf(struct file *file, void *priv,
684} 684}
685 685
686static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx, 686static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
687 struct vb2_buffer *buf) 687 struct vb2_v4l2_buffer *buf)
688{ 688{
689 struct vb2_queue *src_vq; 689 struct vb2_queue *src_vq;
690 690
691 src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 691 src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
692 692
693 return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) && 693 return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) &&
694 (buf->v4l2_buf.sequence == (ctx->qsequence - 1))); 694 (buf->sequence == (ctx->qsequence - 1)));
695} 695}
696 696
697void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf, 697void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
698 enum vb2_buffer_state state) 698 enum vb2_buffer_state state)
699{ 699{
700 const struct v4l2_event eos_event = { 700 const struct v4l2_event eos_event = {
@@ -702,7 +702,7 @@ void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
702 }; 702 };
703 703
704 if (coda_buf_is_end_of_stream(ctx, buf)) { 704 if (coda_buf_is_end_of_stream(ctx, buf)) {
705 buf->v4l2_buf.flags |= V4L2_BUF_FLAG_LAST; 705 buf->flags |= V4L2_BUF_FLAG_LAST;
706 706
707 v4l2_event_queue_fh(&ctx->fh, &eos_event); 707 v4l2_event_queue_fh(&ctx->fh, &eos_event);
708 } 708 }
@@ -1175,6 +1175,7 @@ static int coda_buf_prepare(struct vb2_buffer *vb)
1175 1175
1176static void coda_buf_queue(struct vb2_buffer *vb) 1176static void coda_buf_queue(struct vb2_buffer *vb)
1177{ 1177{
1178 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
1178 struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); 1179 struct coda_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
1179 struct vb2_queue *vq = vb->vb2_queue; 1180 struct vb2_queue *vq = vb->vb2_queue;
1180 struct coda_q_data *q_data; 1181 struct coda_q_data *q_data;
@@ -1193,12 +1194,12 @@ static void coda_buf_queue(struct vb2_buffer *vb)
1193 if (vb2_get_plane_payload(vb, 0) == 0) 1194 if (vb2_get_plane_payload(vb, 0) == 0)
1194 coda_bit_stream_end_flag(ctx); 1195 coda_bit_stream_end_flag(ctx);
1195 mutex_lock(&ctx->bitstream_mutex); 1196 mutex_lock(&ctx->bitstream_mutex);
1196 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); 1197 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
1197 if (vb2_is_streaming(vb->vb2_queue)) 1198 if (vb2_is_streaming(vb->vb2_queue))
1198 coda_fill_bitstream(ctx, true); 1199 coda_fill_bitstream(ctx, true);
1199 mutex_unlock(&ctx->bitstream_mutex); 1200 mutex_unlock(&ctx->bitstream_mutex);
1200 } else { 1201 } else {
1201 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); 1202 v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
1202 } 1203 }
1203} 1204}
1204 1205
@@ -1247,7 +1248,7 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
1247 struct coda_ctx *ctx = vb2_get_drv_priv(q); 1248 struct coda_ctx *ctx = vb2_get_drv_priv(q);
1248 struct v4l2_device *v4l2_dev = &ctx->dev->v4l2_dev; 1249 struct v4l2_device *v4l2_dev = &ctx->dev->v4l2_dev;
1249 struct coda_q_data *q_data_src, *q_data_dst; 1250 struct coda_q_data *q_data_src, *q_data_dst;
1250 struct vb2_buffer *buf; 1251 struct vb2_v4l2_buffer *buf;
1251 int ret = 0; 1252 int ret = 0;
1252 1253
1253 q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 1254 q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
@@ -1338,7 +1339,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
1338{ 1339{
1339 struct coda_ctx *ctx = vb2_get_drv_priv(q); 1340 struct coda_ctx *ctx = vb2_get_drv_priv(q);
1340 struct coda_dev *dev = ctx->dev; 1341 struct coda_dev *dev = ctx->dev;
1341 struct vb2_buffer *buf; 1342 struct vb2_v4l2_buffer *buf;
1342 unsigned long flags; 1343 unsigned long flags;
1343 bool stop; 1344 bool stop;
1344 1345