diff options
Diffstat (limited to 'drivers/media/platform/vim2m.c')
-rw-r--r-- | drivers/media/platform/vim2m.c | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index d47cfba32c58..7c3ced045304 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c | |||
@@ -197,8 +197,8 @@ static struct vim2m_q_data *get_q_data(struct vim2m_ctx *ctx, | |||
197 | 197 | ||
198 | 198 | ||
199 | static int device_process(struct vim2m_ctx *ctx, | 199 | static int device_process(struct vim2m_ctx *ctx, |
200 | struct vb2_buffer *in_vb, | 200 | struct vb2_v4l2_buffer *in_vb, |
201 | struct vb2_buffer *out_vb) | 201 | struct vb2_v4l2_buffer *out_vb) |
202 | { | 202 | { |
203 | struct vim2m_dev *dev = ctx->dev; | 203 | struct vim2m_dev *dev = ctx->dev; |
204 | struct vim2m_q_data *q_data; | 204 | struct vim2m_q_data *q_data; |
@@ -213,15 +213,16 @@ static int device_process(struct vim2m_ctx *ctx, | |||
213 | height = q_data->height; | 213 | height = q_data->height; |
214 | bytesperline = (q_data->width * q_data->fmt->depth) >> 3; | 214 | bytesperline = (q_data->width * q_data->fmt->depth) >> 3; |
215 | 215 | ||
216 | p_in = vb2_plane_vaddr(in_vb, 0); | 216 | p_in = vb2_plane_vaddr(&in_vb->vb2_buf, 0); |
217 | p_out = vb2_plane_vaddr(out_vb, 0); | 217 | p_out = vb2_plane_vaddr(&out_vb->vb2_buf, 0); |
218 | if (!p_in || !p_out) { | 218 | if (!p_in || !p_out) { |
219 | v4l2_err(&dev->v4l2_dev, | 219 | v4l2_err(&dev->v4l2_dev, |
220 | "Acquiring kernel pointers to buffers failed\n"); | 220 | "Acquiring kernel pointers to buffers failed\n"); |
221 | return -EFAULT; | 221 | return -EFAULT; |
222 | } | 222 | } |
223 | 223 | ||
224 | if (vb2_plane_size(in_vb, 0) > vb2_plane_size(out_vb, 0)) { | 224 | if (vb2_plane_size(&in_vb->vb2_buf, 0) > |
225 | vb2_plane_size(&out_vb->vb2_buf, 0)) { | ||
225 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); | 226 | v4l2_err(&dev->v4l2_dev, "Output buffer is too small\n"); |
226 | return -EINVAL; | 227 | return -EINVAL; |
227 | } | 228 | } |
@@ -231,13 +232,15 @@ static int device_process(struct vim2m_ctx *ctx, | |||
231 | bytes_left = bytesperline - tile_w * MEM2MEM_NUM_TILES; | 232 | bytes_left = bytesperline - tile_w * MEM2MEM_NUM_TILES; |
232 | w = 0; | 233 | w = 0; |
233 | 234 | ||
234 | out_vb->v4l2_buf.sequence = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)->sequence++; | 235 | out_vb->sequence = |
235 | in_vb->v4l2_buf.sequence = q_data->sequence++; | 236 | get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE)->sequence++; |
236 | out_vb->v4l2_buf.timestamp = in_vb->v4l2_buf.timestamp; | 237 | in_vb->sequence = q_data->sequence++; |
237 | if (in_vb->v4l2_buf.flags & V4L2_BUF_FLAG_TIMECODE) | 238 | out_vb->timestamp = in_vb->timestamp; |
238 | out_vb->v4l2_buf.timecode = in_vb->v4l2_buf.timecode; | 239 | |
239 | out_vb->v4l2_buf.field = in_vb->v4l2_buf.field; | 240 | if (in_vb->flags & V4L2_BUF_FLAG_TIMECODE) |
240 | out_vb->v4l2_buf.flags = in_vb->v4l2_buf.flags & | 241 | out_vb->timecode = in_vb->timecode; |
242 | out_vb->field = in_vb->field; | ||
243 | out_vb->flags = in_vb->flags & | ||
241 | (V4L2_BUF_FLAG_TIMECODE | | 244 | (V4L2_BUF_FLAG_TIMECODE | |
242 | V4L2_BUF_FLAG_KEYFRAME | | 245 | V4L2_BUF_FLAG_KEYFRAME | |
243 | V4L2_BUF_FLAG_PFRAME | | 246 | V4L2_BUF_FLAG_PFRAME | |
@@ -371,7 +374,7 @@ static void device_run(void *priv) | |||
371 | { | 374 | { |
372 | struct vim2m_ctx *ctx = priv; | 375 | struct vim2m_ctx *ctx = priv; |
373 | struct vim2m_dev *dev = ctx->dev; | 376 | struct vim2m_dev *dev = ctx->dev; |
374 | struct vb2_buffer *src_buf, *dst_buf; | 377 | struct vb2_v4l2_buffer *src_buf, *dst_buf; |
375 | 378 | ||
376 | src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); | 379 | src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); |
377 | dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); | 380 | dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); |
@@ -386,7 +389,7 @@ static void device_isr(unsigned long priv) | |||
386 | { | 389 | { |
387 | struct vim2m_dev *vim2m_dev = (struct vim2m_dev *)priv; | 390 | struct vim2m_dev *vim2m_dev = (struct vim2m_dev *)priv; |
388 | struct vim2m_ctx *curr_ctx; | 391 | struct vim2m_ctx *curr_ctx; |
389 | struct vb2_buffer *src_vb, *dst_vb; | 392 | struct vb2_v4l2_buffer *src_vb, *dst_vb; |
390 | unsigned long flags; | 393 | unsigned long flags; |
391 | 394 | ||
392 | curr_ctx = v4l2_m2m_get_curr_priv(vim2m_dev->m2m_dev); | 395 | curr_ctx = v4l2_m2m_get_curr_priv(vim2m_dev->m2m_dev); |
@@ -744,6 +747,7 @@ static int vim2m_queue_setup(struct vb2_queue *vq, | |||
744 | 747 | ||
745 | static int vim2m_buf_prepare(struct vb2_buffer *vb) | 748 | static int vim2m_buf_prepare(struct vb2_buffer *vb) |
746 | { | 749 | { |
750 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); | ||
747 | struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); | 751 | struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); |
748 | struct vim2m_q_data *q_data; | 752 | struct vim2m_q_data *q_data; |
749 | 753 | ||
@@ -751,9 +755,9 @@ static int vim2m_buf_prepare(struct vb2_buffer *vb) | |||
751 | 755 | ||
752 | q_data = get_q_data(ctx, vb->vb2_queue->type); | 756 | q_data = get_q_data(ctx, vb->vb2_queue->type); |
753 | if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) { | 757 | if (V4L2_TYPE_IS_OUTPUT(vb->vb2_queue->type)) { |
754 | if (vb->v4l2_buf.field == V4L2_FIELD_ANY) | 758 | if (vbuf->field == V4L2_FIELD_ANY) |
755 | vb->v4l2_buf.field = V4L2_FIELD_NONE; | 759 | vbuf->field = V4L2_FIELD_NONE; |
756 | if (vb->v4l2_buf.field != V4L2_FIELD_NONE) { | 760 | if (vbuf->field != V4L2_FIELD_NONE) { |
757 | dprintk(ctx->dev, "%s field isn't supported\n", | 761 | dprintk(ctx->dev, "%s field isn't supported\n", |
758 | __func__); | 762 | __func__); |
759 | return -EINVAL; | 763 | return -EINVAL; |
@@ -773,9 +777,10 @@ static int vim2m_buf_prepare(struct vb2_buffer *vb) | |||
773 | 777 | ||
774 | static void vim2m_buf_queue(struct vb2_buffer *vb) | 778 | static void vim2m_buf_queue(struct vb2_buffer *vb) |
775 | { | 779 | { |
780 | struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); | ||
776 | struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); | 781 | struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue); |
777 | 782 | ||
778 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vb); | 783 | v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf); |
779 | } | 784 | } |
780 | 785 | ||
781 | static int vim2m_start_streaming(struct vb2_queue *q, unsigned count) | 786 | static int vim2m_start_streaming(struct vb2_queue *q, unsigned count) |
@@ -790,18 +795,18 @@ static int vim2m_start_streaming(struct vb2_queue *q, unsigned count) | |||
790 | static void vim2m_stop_streaming(struct vb2_queue *q) | 795 | static void vim2m_stop_streaming(struct vb2_queue *q) |
791 | { | 796 | { |
792 | struct vim2m_ctx *ctx = vb2_get_drv_priv(q); | 797 | struct vim2m_ctx *ctx = vb2_get_drv_priv(q); |
793 | struct vb2_buffer *vb; | 798 | struct vb2_v4l2_buffer *vbuf; |
794 | unsigned long flags; | 799 | unsigned long flags; |
795 | 800 | ||
796 | for (;;) { | 801 | for (;;) { |
797 | if (V4L2_TYPE_IS_OUTPUT(q->type)) | 802 | if (V4L2_TYPE_IS_OUTPUT(q->type)) |
798 | vb = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); | 803 | vbuf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); |
799 | else | 804 | else |
800 | vb = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); | 805 | vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); |
801 | if (vb == NULL) | 806 | if (vbuf == NULL) |
802 | return; | 807 | return; |
803 | spin_lock_irqsave(&ctx->dev->irqlock, flags); | 808 | spin_lock_irqsave(&ctx->dev->irqlock, flags); |
804 | v4l2_m2m_buf_done(vb, VB2_BUF_STATE_ERROR); | 809 | v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); |
805 | spin_unlock_irqrestore(&ctx->dev->irqlock, flags); | 810 | spin_unlock_irqrestore(&ctx->dev->irqlock, flags); |
806 | } | 811 | } |
807 | } | 812 | } |