Commit b2dfd1a4 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB: videobuf: Add support for V4L2_BUF_FLAG_ERROR

For recoverable stream errors dqbuf() now returns 0 and the error flag
is set instead of returning EIO.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent bc0f7f19
...@@ -285,8 +285,10 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, ...@@ -285,8 +285,10 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b,
case VIDEOBUF_ACTIVE: case VIDEOBUF_ACTIVE:
b->flags |= V4L2_BUF_FLAG_QUEUED; b->flags |= V4L2_BUF_FLAG_QUEUED;
break; break;
case VIDEOBUF_DONE:
case VIDEOBUF_ERROR: case VIDEOBUF_ERROR:
b->flags |= V4L2_BUF_FLAG_ERROR;
/* fall through */
case VIDEOBUF_DONE:
b->flags |= V4L2_BUF_FLAG_DONE; b->flags |= V4L2_BUF_FLAG_DONE;
break; break;
case VIDEOBUF_NEEDS_INIT: case VIDEOBUF_NEEDS_INIT:
...@@ -670,6 +672,7 @@ int videobuf_dqbuf(struct videobuf_queue *q, ...@@ -670,6 +672,7 @@ int videobuf_dqbuf(struct videobuf_queue *q,
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);
memset(b, 0, sizeof(*b));
mutex_lock(&q->vb_lock); mutex_lock(&q->vb_lock);
retval = stream_next_buffer(q, &buf, nonblocking); retval = stream_next_buffer(q, &buf, nonblocking);
...@@ -681,23 +684,20 @@ int videobuf_dqbuf(struct videobuf_queue *q, ...@@ -681,23 +684,20 @@ int videobuf_dqbuf(struct videobuf_queue *q,
switch (buf->state) { switch (buf->state) {
case VIDEOBUF_ERROR: case VIDEOBUF_ERROR:
dprintk(1, "dqbuf: state is error\n"); dprintk(1, "dqbuf: state is error\n");
retval = -EIO;
CALL(q, sync, q, buf);
buf->state = VIDEOBUF_IDLE;
break; break;
case VIDEOBUF_DONE: case VIDEOBUF_DONE:
dprintk(1, "dqbuf: state is done\n"); dprintk(1, "dqbuf: state is done\n");
CALL(q, sync, q, buf);
buf->state = VIDEOBUF_IDLE;
break; break;
default: default:
dprintk(1, "dqbuf: state invalid\n"); dprintk(1, "dqbuf: state invalid\n");
retval = -EINVAL; retval = -EINVAL;
goto done; goto done;
} }
list_del(&buf->stream); CALL(q, sync, q, buf);
memset(b, 0, sizeof(*b));
videobuf_status(q, b, buf, q->type); videobuf_status(q, b, buf, q->type);
list_del(&buf->stream);
buf->state = VIDEOBUF_IDLE;
b->flags &= ~V4L2_BUF_FLAG_DONE;
done: done:
mutex_unlock(&q->vb_lock); mutex_unlock(&q->vb_lock);
return retval; return retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment