Lines Matching refs:vb
74 struct video_buf *vb; in video_pool_alloc() local
122 vb = &pool->bufs[i]; in video_pool_alloc()
123 vb->pool = pool; in video_pool_alloc()
124 vb->index = i; in video_pool_alloc()
125 vb->state = VB_IDLE; in video_pool_alloc()
126 vb->length = buf_size; in video_pool_alloc()
127 vb->buf = (uint8_t *)kva + (size_t)i * buf_size; in video_pool_alloc()
256 struct video_buf *vb; in video_buf_acquire() local
259 vb = STAILQ_FIRST(&vd->queued); in video_buf_acquire()
260 if (vb != NULL) { in video_buf_acquire()
262 vb->state = VB_ACTIVE; in video_buf_acquire()
263 vb->bytesused = 0; in video_buf_acquire()
266 return (vb); in video_buf_acquire()
270 video_buf_write(struct video_buf *vb, size_t offset, const void *src, in video_buf_write() argument
274 if (offset > vb->length || len > vb->length - offset) in video_buf_write()
277 memcpy((uint8_t *)vb->buf + offset, src, len); in video_buf_write()
282 video_buf_done(struct video_buf *vb, size_t bytesused, uint32_t sequence) in video_buf_done() argument
287 overrun = bytesused > vb->length; in video_buf_done()
291 vd = vb->vd; in video_buf_done()
293 if (vb->state != VB_ACTIVE) { in video_buf_done()
297 vb->bytesused = bytesused; in video_buf_done()
298 vb->sequence = sequence; in video_buf_done()
299 getmicrouptime(&vb->timestamp); in video_buf_done()
300 vb->flags = V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; in video_buf_done()
302 vb->flags |= V4L2_BUF_FLAG_ERROR; in video_buf_done()
303 vb->state = VB_DONE; in video_buf_done()
304 STAILQ_INSERT_TAIL(&vd->done, vb, entry); in video_buf_done()
311 video_buf_error(struct video_buf *vb) in video_buf_error() argument
313 struct video_device *vd = vb->vd; in video_buf_error()
316 if (vb->state != VB_ACTIVE) { in video_buf_error()
320 vb->bytesused = 0; in video_buf_error()
321 vb->flags = V4L2_BUF_FLAG_ERROR; in video_buf_error()
322 getmicrouptime(&vb->timestamp); in video_buf_error()
323 vb->state = VB_ERROR; in video_buf_error()
324 STAILQ_INSERT_TAIL(&vd->done, vb, entry); in video_buf_error()
534 struct video_buf *vb; in video_querybuf() local
549 vb = &vd->pool->bufs[b->index]; in video_querybuf()
551 b->length = vb->length; in video_querybuf()
552 b->m.offset = vb->index * vd->pool->buf_size; in video_querybuf()
553 b->bytesused = vb->bytesused; in video_querybuf()
555 b->timestamp = vb->timestamp; in video_querybuf()
556 b->sequence = vb->sequence; in video_querybuf()
559 switch (vb->state) { in video_querybuf()
582 struct video_buf *vb; in video_qbuf() local
600 vb = &vd->pool->bufs[b->index]; in video_qbuf()
601 if (vb->state != VB_IDLE) { in video_qbuf()
606 vb->state = VB_QUEUED; in video_qbuf()
607 vb->bytesused = 0; in video_qbuf()
608 vb->vd = vd; in video_qbuf()
609 STAILQ_INSERT_TAIL(&vd->queued, vb, entry); in video_qbuf()
620 struct video_buf *vb; in video_dqbuf() local
649 vb = STAILQ_FIRST(&vd->done); in video_dqbuf()
652 b->index = vb->index; in video_dqbuf()
653 b->bytesused = vb->bytesused; in video_dqbuf()
655 b->timestamp = vb->timestamp; in video_dqbuf()
656 b->sequence = vb->sequence; in video_dqbuf()
658 b->m.offset = vb->index * vd->pool->buf_size; in video_dqbuf()
659 b->length = vb->length; in video_dqbuf()
662 if (vb->flags & V4L2_BUF_FLAG_ERROR) in video_dqbuf()
665 vb->state = VB_IDLE; in video_dqbuf()
711 struct video_buf *vb; in video_streamoff() local
740 vb = &vd->pool->bufs[i]; in video_streamoff()
741 vb->state = VB_IDLE; in video_streamoff()
742 vb->bytesused = 0; in video_streamoff()
743 vb->vd = NULL; in video_streamoff()
1008 struct video_buf *vb; in video_read() local
1071 vb = &vd->pool->bufs[i]; in video_read()
1072 vb->state = VB_QUEUED; in video_read()
1073 vb->vd = vd; in video_read()
1074 STAILQ_INSERT_TAIL(&vd->queued, vb, entry); in video_read()
1117 vb = vf->read_buf; in video_read()
1118 bytesused = vb->bytesused; in video_read()
1123 src = (uint8_t *)vb->buf + offset; in video_read()
1138 if (vf->read_buf == vb) { in video_read()
1143 vb->state = VB_QUEUED; in video_read()
1144 vb->bytesused = 0; in video_read()
1145 STAILQ_INSERT_TAIL(&vd->queued, vb, entry); in video_read()