Lines Matching full:vb
64 static int __verify_planes_array(struct vb2_buffer *vb, const struct v4l2_buffer *b) in __verify_planes_array() argument
71 dprintk(vb->vb2_queue, 1, in __verify_planes_array()
76 if (b->length < vb->num_planes || b->length > VB2_MAX_PLANES) { in __verify_planes_array()
77 dprintk(vb->vb2_queue, 1, in __verify_planes_array()
79 vb->num_planes, b->length); in __verify_planes_array()
86 static int __verify_planes_array_core(struct vb2_buffer *vb, const void *pb) in __verify_planes_array_core() argument
88 return __verify_planes_array(vb, pb); in __verify_planes_array_core()
95 static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b) in __verify_length() argument
105 for (plane = 0; plane < vb->num_planes; ++plane) { in __verify_length()
109 : vb->planes[plane].length; in __verify_length()
123 ? b->length : vb->planes[0].length; in __verify_length()
135 static void __init_vb2_v4l2_buffer(struct vb2_buffer *vb) in __init_vb2_v4l2_buffer() argument
137 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __init_vb2_v4l2_buffer()
142 static void __copy_timestamp(struct vb2_buffer *vb, const void *pb) in __copy_timestamp() argument
145 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __copy_timestamp()
146 struct vb2_queue *q = vb->vb2_queue; in __copy_timestamp()
154 vb->timestamp = v4l2_buffer_get_timestamp(b); in __copy_timestamp()
161 static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) in vb2_warn_zero_bytesused() argument
171 if (vb->vb2_queue->allow_zero_bytesused) in vb2_warn_zero_bytesused()
177 static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) in vb2_fill_vb2_v4l2_buffer() argument
179 struct vb2_queue *q = vb->vb2_queue; in vb2_fill_vb2_v4l2_buffer()
180 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in vb2_fill_vb2_v4l2_buffer()
185 ret = __verify_length(vb, b); in vb2_fill_vb2_v4l2_buffer()
210 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
218 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
226 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
228 vb->planes[plane].m.offset; in vb2_fill_vb2_v4l2_buffer()
230 vb->planes[plane].length; in vb2_fill_vb2_v4l2_buffer()
253 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
258 vb2_warn_zero_bytesused(vb); in vb2_fill_vb2_v4l2_buffer()
260 if (vb->vb2_queue->allow_zero_bytesused) in vb2_fill_vb2_v4l2_buffer()
293 planes[0].m.offset = vb->planes[0].m.offset; in vb2_fill_vb2_v4l2_buffer()
294 planes[0].length = vb->planes[0].length; in vb2_fill_vb2_v4l2_buffer()
301 vb2_warn_zero_bytesused(vb); in vb2_fill_vb2_v4l2_buffer()
303 if (vb->vb2_queue->allow_zero_bytesused) in vb2_fill_vb2_v4l2_buffer()
315 if (!vb->vb2_queue->copy_timestamp || V4L2_TYPE_IS_CAPTURE(b->type)) { in vb2_fill_vb2_v4l2_buffer()
346 struct vb2_buffer *vb, in set_buffer_cache_hints() argument
355 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
356 vb->need_cache_sync_on_prepare = 0; in set_buffer_cache_hints()
364 vb->need_cache_sync_on_prepare = 1; in set_buffer_cache_hints()
365 vb->need_cache_sync_on_finish = 1; in set_buffer_cache_hints()
383 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
386 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
389 vb->need_cache_sync_on_prepare = 0; in set_buffer_cache_hints()
399 struct vb2_buffer *vb; in vb2_queue_or_prepare_buf() local
423 vb = q->bufs[b->index]; in vb2_queue_or_prepare_buf()
424 vbuf = to_vb2_v4l2_buffer(vb); in vb2_queue_or_prepare_buf()
425 ret = __verify_planes_array(vb, b); in vb2_queue_or_prepare_buf()
430 vb->state != VB2_BUF_STATE_DEQUEUED) { in vb2_queue_or_prepare_buf()
435 if (!vb->prepared) { in vb2_queue_or_prepare_buf()
436 set_buffer_cache_hints(q, vb, b); in vb2_queue_or_prepare_buf()
439 sizeof(vbuf->planes[0]) * vb->num_planes); in vb2_queue_or_prepare_buf()
440 ret = vb2_fill_vb2_v4l2_buffer(vb, b); in vb2_queue_or_prepare_buf()
523 static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) in __fill_v4l2_buffer() argument
526 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __fill_v4l2_buffer()
527 struct vb2_queue *q = vb->vb2_queue; in __fill_v4l2_buffer()
531 b->index = vb->index; in __fill_v4l2_buffer()
532 b->type = vb->type; in __fill_v4l2_buffer()
533 b->memory = vb->memory; in __fill_v4l2_buffer()
538 v4l2_buffer_set_timestamp(b, vb->timestamp); in __fill_v4l2_buffer()
549 b->length = vb->num_planes; in __fill_v4l2_buffer()
550 for (plane = 0; plane < vb->num_planes; ++plane) { in __fill_v4l2_buffer()
552 struct vb2_plane *psrc = &vb->planes[plane]; in __fill_v4l2_buffer()
570 b->length = vb->planes[0].length; in __fill_v4l2_buffer()
571 b->bytesused = vb->planes[0].bytesused; in __fill_v4l2_buffer()
573 b->m.offset = vb->planes[0].m.offset; in __fill_v4l2_buffer()
575 b->m.userptr = vb->planes[0].m.userptr; in __fill_v4l2_buffer()
577 b->m.fd = vb->planes[0].m.fd; in __fill_v4l2_buffer()
594 switch (vb->state) { in __fill_v4l2_buffer()
614 if ((vb->state == VB2_BUF_STATE_DEQUEUED || in __fill_v4l2_buffer()
615 vb->state == VB2_BUF_STATE_IN_REQUEST) && in __fill_v4l2_buffer()
616 vb->synced && vb->prepared) in __fill_v4l2_buffer()
619 if (vb2_buffer_in_use(q, vb)) in __fill_v4l2_buffer()
632 static int __fill_vb2_buffer(struct vb2_buffer *vb, struct vb2_plane *planes) in __fill_vb2_buffer() argument
634 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __fill_vb2_buffer()
637 if (!vb->vb2_queue->copy_timestamp) in __fill_vb2_buffer()
638 vb->timestamp = 0; in __fill_vb2_buffer()
640 for (plane = 0; plane < vb->num_planes; ++plane) { in __fill_vb2_buffer()
641 if (vb->vb2_queue->memory != VB2_MEMORY_MMAP) { in __fill_vb2_buffer()
687 struct vb2_buffer *vb; in vb2_querybuf() local
699 vb = q->bufs[b->index]; in vb2_querybuf()
700 ret = __verify_planes_array(vb, b); in vb2_querybuf()