Message ID | 1446545802-28496-5-git-send-email-jh1009.sung@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 11/03/15 11:16, Junghak Sung wrote: > The location in which last_buffer_queued is set is moved to fill_v4l2_buffer(). > So, __vb2_perform_fileio() can use vb2_core_dqbuf() instead of > vb2_internal_dqbuf(). > > 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> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> One comment: I think the struct vb2_buf_ops callbacks can all return void instead of int. I don't think they should ever be allowed to fail. If you agree, then that can be changed in a separate later. Regards, Hans > --- > drivers/media/v4l2-core/videobuf2-v4l2.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c > index 0ca9f23..b0293df 100644 > --- a/drivers/media/v4l2-core/videobuf2-v4l2.c > +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c > @@ -270,6 +270,11 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) > if (vb2_buffer_in_use(q, vb)) > b->flags |= V4L2_BUF_FLAG_MAPPED; > > + if (!q->is_output && > + b->flags & V4L2_BUF_FLAG_DONE && > + b->flags & V4L2_BUF_FLAG_LAST) > + q->last_buffer_dequeued = true; > + > return 0; > } > > @@ -579,10 +584,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, > > ret = vb2_core_dqbuf(q, b, nonblocking); > > - if (!ret && !q->is_output && > - b->flags & V4L2_BUF_FLAG_LAST) > - q->last_buffer_dequeued = true; > - > return ret; > } > > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 11/05/2015 07:00 PM, Hans Verkuil wrote: > On 11/03/15 11:16, Junghak Sung wrote: >> The location in which last_buffer_queued is set is moved to fill_v4l2_buffer(). >> So, __vb2_perform_fileio() can use vb2_core_dqbuf() instead of >> vb2_internal_dqbuf(). >> >> 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> > > Acked-by: Hans Verkuil <hans.verkuil@cisco.com> > > One comment: I think the struct vb2_buf_ops callbacks can all return void > instead of int. I don't think they should ever be allowed to fail. > > If you agree, then that can be changed in a separate later. > Dear Hans, IMHO, it seems to be better that vb2_buf_ops callbacks return int as it is. Because fill_vb2_buffer() includes verifying the bytesused value for each plane and checking ALTERNATE field for output buffer. It can return fail if the information provided in a v4l2_buffer by the userspace is not proper. Best regards, Junghak > Regards, > > Hans > >> --- >> drivers/media/v4l2-core/videobuf2-v4l2.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c >> index 0ca9f23..b0293df 100644 >> --- a/drivers/media/v4l2-core/videobuf2-v4l2.c >> +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c >> @@ -270,6 +270,11 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) >> if (vb2_buffer_in_use(q, vb)) >> b->flags |= V4L2_BUF_FLAG_MAPPED; >> >> + if (!q->is_output && >> + b->flags & V4L2_BUF_FLAG_DONE && >> + b->flags & V4L2_BUF_FLAG_LAST) >> + q->last_buffer_dequeued = true; >> + >> return 0; >> } >> >> @@ -579,10 +584,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, >> >> ret = vb2_core_dqbuf(q, b, nonblocking); >> >> - if (!ret && !q->is_output && >> - b->flags & V4L2_BUF_FLAG_LAST) >> - q->last_buffer_dequeued = true; >> - >> return ret; >> } >> >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-media" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c index 0ca9f23..b0293df 100644 --- a/drivers/media/v4l2-core/videobuf2-v4l2.c +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c @@ -270,6 +270,11 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) if (vb2_buffer_in_use(q, vb)) b->flags |= V4L2_BUF_FLAG_MAPPED; + if (!q->is_output && + b->flags & V4L2_BUF_FLAG_DONE && + b->flags & V4L2_BUF_FLAG_LAST) + q->last_buffer_dequeued = true; + return 0; } @@ -579,10 +584,6 @@ static int vb2_internal_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, ret = vb2_core_dqbuf(q, b, nonblocking); - if (!ret && !q->is_output && - b->flags & V4L2_BUF_FLAG_LAST) - q->last_buffer_dequeued = true; - return ret; }