aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/tw68
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/pci/tw68
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/pci/tw68')
-rw-r--r--drivers/media/pci/tw68/tw68-video.c19
-rw-r--r--drivers/media/pci/tw68/tw68.h3
2 files changed, 13 insertions, 9 deletions
diff --git a/drivers/media/pci/tw68/tw68-video.c b/drivers/media/pci/tw68/tw68-video.c
index 8355e55b4e8e..323721439b8e 100644
--- a/drivers/media/pci/tw68/tw68-video.c
+++ b/drivers/media/pci/tw68/tw68-video.c
@@ -423,9 +423,10 @@ static int tw68_queue_setup(struct vb2_queue *q, const struct v4l2_format *fmt,
423 */ 423 */
424static void tw68_buf_queue(struct vb2_buffer *vb) 424static void tw68_buf_queue(struct vb2_buffer *vb)
425{ 425{
426 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
426 struct vb2_queue *vq = vb->vb2_queue; 427 struct vb2_queue *vq = vb->vb2_queue;
427 struct tw68_dev *dev = vb2_get_drv_priv(vq); 428 struct tw68_dev *dev = vb2_get_drv_priv(vq);
428 struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb); 429 struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
429 struct tw68_buf *prev; 430 struct tw68_buf *prev;
430 unsigned long flags; 431 unsigned long flags;
431 432
@@ -457,9 +458,10 @@ static void tw68_buf_queue(struct vb2_buffer *vb)
457 */ 458 */
458static int tw68_buf_prepare(struct vb2_buffer *vb) 459static int tw68_buf_prepare(struct vb2_buffer *vb)
459{ 460{
461 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
460 struct vb2_queue *vq = vb->vb2_queue; 462 struct vb2_queue *vq = vb->vb2_queue;
461 struct tw68_dev *dev = vb2_get_drv_priv(vq); 463 struct tw68_dev *dev = vb2_get_drv_priv(vq);
462 struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb); 464 struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
463 struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0); 465 struct sg_table *dma = vb2_dma_sg_plane_desc(vb, 0);
464 unsigned size, bpl; 466 unsigned size, bpl;
465 467
@@ -499,9 +501,10 @@ static int tw68_buf_prepare(struct vb2_buffer *vb)
499 501
500static void tw68_buf_finish(struct vb2_buffer *vb) 502static void tw68_buf_finish(struct vb2_buffer *vb)
501{ 503{
504 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
502 struct vb2_queue *vq = vb->vb2_queue; 505 struct vb2_queue *vq = vb->vb2_queue;
503 struct tw68_dev *dev = vb2_get_drv_priv(vq); 506 struct tw68_dev *dev = vb2_get_drv_priv(vq);
504 struct tw68_buf *buf = container_of(vb, struct tw68_buf, vb); 507 struct tw68_buf *buf = container_of(vbuf, struct tw68_buf, vb);
505 508
506 pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma); 509 pci_free_consistent(dev->pci, buf->size, buf->cpu, buf->dma);
507} 510}
@@ -528,7 +531,7 @@ static void tw68_stop_streaming(struct vb2_queue *q)
528 container_of(dev->active.next, struct tw68_buf, list); 531 container_of(dev->active.next, struct tw68_buf, list);
529 532
530 list_del(&buf->list); 533 list_del(&buf->list);
531 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); 534 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
532 } 535 }
533} 536}
534 537
@@ -1012,10 +1015,10 @@ void tw68_irq_video_done(struct tw68_dev *dev, unsigned long status)
1012 buf = list_entry(dev->active.next, struct tw68_buf, list); 1015 buf = list_entry(dev->active.next, struct tw68_buf, list);
1013 list_del(&buf->list); 1016 list_del(&buf->list);
1014 spin_unlock(&dev->slock); 1017 spin_unlock(&dev->slock);
1015 v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp); 1018 v4l2_get_timestamp(&buf->vb.timestamp);
1016 buf->vb.v4l2_buf.field = dev->field; 1019 buf->vb.field = dev->field;
1017 buf->vb.v4l2_buf.sequence = dev->seqnr++; 1020 buf->vb.sequence = dev->seqnr++;
1018 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_DONE); 1021 vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
1019 status &= ~(TW68_DMAPI); 1022 status &= ~(TW68_DMAPI);
1020 if (0 == status) 1023 if (0 == status)
1021 return; 1024 return;
diff --git a/drivers/media/pci/tw68/tw68.h b/drivers/media/pci/tw68/tw68.h
index ef51e4d48866..6c7dcb300f34 100644
--- a/drivers/media/pci/tw68/tw68.h
+++ b/drivers/media/pci/tw68/tw68.h
@@ -36,6 +36,7 @@
36#include <media/v4l2-ioctl.h> 36#include <media/v4l2-ioctl.h>
37#include <media/v4l2-ctrls.h> 37#include <media/v4l2-ctrls.h>
38#include <media/v4l2-device.h> 38#include <media/v4l2-device.h>
39#include <media/videobuf2-v4l2.h>
39#include <media/videobuf2-dma-sg.h> 40#include <media/videobuf2-dma-sg.h>
40 41
41#include "tw68-reg.h" 42#include "tw68-reg.h"
@@ -118,7 +119,7 @@ struct tw68_dev; /* forward delclaration */
118 119
119/* buffer for one video/vbi/ts frame */ 120/* buffer for one video/vbi/ts frame */
120struct tw68_buf { 121struct tw68_buf {
121 struct vb2_buffer vb; 122 struct vb2_v4l2_buffer vb;
122 struct list_head list; 123 struct list_head list;
123 124
124 unsigned int size; 125 unsigned int size;