[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>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
c139990e84
commit
2d7007153f
@@ -342,8 +342,9 @@ static int isp_video_queue_setup(struct vb2_queue *queue,
|
||||
|
||||
static int isp_video_buffer_prepare(struct vb2_buffer *buf)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(buf);
|
||||
struct isp_video_fh *vfh = vb2_get_drv_priv(buf->vb2_queue);
|
||||
struct isp_buffer *buffer = to_isp_buffer(buf);
|
||||
struct isp_buffer *buffer = to_isp_buffer(vbuf);
|
||||
struct isp_video *video = vfh->video;
|
||||
dma_addr_t addr;
|
||||
|
||||
@@ -363,7 +364,8 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
vb2_set_plane_payload(&buffer->vb, 0, vfh->format.fmt.pix.sizeimage);
|
||||
vb2_set_plane_payload(&buffer->vb.vb2_buf, 0,
|
||||
vfh->format.fmt.pix.sizeimage);
|
||||
buffer->dma = addr;
|
||||
|
||||
return 0;
|
||||
@@ -380,8 +382,9 @@ static int isp_video_buffer_prepare(struct vb2_buffer *buf)
|
||||
*/
|
||||
static void isp_video_buffer_queue(struct vb2_buffer *buf)
|
||||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(buf);
|
||||
struct isp_video_fh *vfh = vb2_get_drv_priv(buf->vb2_queue);
|
||||
struct isp_buffer *buffer = to_isp_buffer(buf);
|
||||
struct isp_buffer *buffer = to_isp_buffer(vbuf);
|
||||
struct isp_video *video = vfh->video;
|
||||
struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
|
||||
enum isp_pipeline_state state;
|
||||
@@ -392,7 +395,7 @@ static void isp_video_buffer_queue(struct vb2_buffer *buf)
|
||||
spin_lock_irqsave(&video->irqlock, flags);
|
||||
|
||||
if (unlikely(video->error)) {
|
||||
vb2_buffer_done(&buffer->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buffer->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
spin_unlock_irqrestore(&video->irqlock, flags);
|
||||
return;
|
||||
}
|
||||
@@ -464,7 +467,7 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
|
||||
list_del(&buf->irqlist);
|
||||
spin_unlock_irqrestore(&video->irqlock, flags);
|
||||
|
||||
v4l2_get_timestamp(&buf->vb.v4l2_buf.timestamp);
|
||||
v4l2_get_timestamp(&buf->vb.timestamp);
|
||||
|
||||
/* Do frame number propagation only if this is the output video node.
|
||||
* Frame number either comes from the CSI receivers or it gets
|
||||
@@ -473,15 +476,15 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
|
||||
* first, so the input number might lag behind by 1 in some cases.
|
||||
*/
|
||||
if (video == pipe->output && !pipe->do_propagation)
|
||||
buf->vb.v4l2_buf.sequence =
|
||||
buf->vb.sequence =
|
||||
atomic_inc_return(&pipe->frame_number);
|
||||
else
|
||||
buf->vb.v4l2_buf.sequence = atomic_read(&pipe->frame_number);
|
||||
buf->vb.sequence = atomic_read(&pipe->frame_number);
|
||||
|
||||
if (pipe->field != V4L2_FIELD_NONE)
|
||||
buf->vb.v4l2_buf.sequence /= 2;
|
||||
buf->vb.sequence /= 2;
|
||||
|
||||
buf->vb.v4l2_buf.field = pipe->field;
|
||||
buf->vb.field = pipe->field;
|
||||
|
||||
/* Report pipeline errors to userspace on the capture device side. */
|
||||
if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pipe->error) {
|
||||
@@ -491,7 +494,7 @@ struct isp_buffer *omap3isp_video_buffer_next(struct isp_video *video)
|
||||
state = VB2_BUF_STATE_DONE;
|
||||
}
|
||||
|
||||
vb2_buffer_done(&buf->vb, state);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, state);
|
||||
|
||||
spin_lock_irqsave(&video->irqlock, flags);
|
||||
|
||||
@@ -546,7 +549,7 @@ void omap3isp_video_cancel_stream(struct isp_video *video)
|
||||
buf = list_first_entry(&video->dmaqueue,
|
||||
struct isp_buffer, irqlist);
|
||||
list_del(&buf->irqlist);
|
||||
vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
|
||||
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
|
||||
}
|
||||
|
||||
video->error = true;
|
||||
|
Reference in New Issue
Block a user