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()
122 ? b->length : vb->planes[0].length; in __verify_length()
134 static void __init_vb2_v4l2_buffer(struct vb2_buffer *vb) in __init_vb2_v4l2_buffer() argument
136 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __init_vb2_v4l2_buffer()
141 static void __copy_timestamp(struct vb2_buffer *vb, const void *pb) in __copy_timestamp() argument
144 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __copy_timestamp()
145 struct vb2_queue *q = vb->vb2_queue; in __copy_timestamp()
153 vb->timestamp = v4l2_buffer_get_timestamp(b); in __copy_timestamp()
160 static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) in vb2_warn_zero_bytesused() argument
170 if (vb->vb2_queue->allow_zero_bytesused) in vb2_warn_zero_bytesused()
176 static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) in vb2_fill_vb2_v4l2_buffer() argument
178 struct vb2_queue *q = vb->vb2_queue; in vb2_fill_vb2_v4l2_buffer()
179 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in vb2_fill_vb2_v4l2_buffer()
184 ret = __verify_length(vb, b); in vb2_fill_vb2_v4l2_buffer()
209 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
217 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
225 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
227 vb->planes[plane].m.offset; in vb2_fill_vb2_v4l2_buffer()
229 vb->planes[plane].length; in vb2_fill_vb2_v4l2_buffer()
252 for (plane = 0; plane < vb->num_planes; ++plane) { in vb2_fill_vb2_v4l2_buffer()
257 vb2_warn_zero_bytesused(vb); in vb2_fill_vb2_v4l2_buffer()
259 if (vb->vb2_queue->allow_zero_bytesused) in vb2_fill_vb2_v4l2_buffer()
292 planes[0].m.offset = vb->planes[0].m.offset; in vb2_fill_vb2_v4l2_buffer()
293 planes[0].length = vb->planes[0].length; in vb2_fill_vb2_v4l2_buffer()
306 vb2_warn_zero_bytesused(vb); in vb2_fill_vb2_v4l2_buffer()
308 if (vb->vb2_queue->allow_zero_bytesused) in vb2_fill_vb2_v4l2_buffer()
320 if (!vb->vb2_queue->copy_timestamp || V4L2_TYPE_IS_CAPTURE(b->type)) { in vb2_fill_vb2_v4l2_buffer()
351 struct vb2_buffer *vb, in set_buffer_cache_hints() argument
360 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
361 vb->need_cache_sync_on_prepare = 0; in set_buffer_cache_hints()
369 vb->need_cache_sync_on_prepare = 1; in set_buffer_cache_hints()
370 vb->need_cache_sync_on_finish = 1; in set_buffer_cache_hints()
388 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
391 vb->need_cache_sync_on_finish = 0; in set_buffer_cache_hints()
394 vb->need_cache_sync_on_prepare = 0; in set_buffer_cache_hints()
404 struct vb2_buffer *vb; in vb2_queue_or_prepare_buf() local
428 vb = q->bufs[b->index]; in vb2_queue_or_prepare_buf()
429 vbuf = to_vb2_v4l2_buffer(vb); in vb2_queue_or_prepare_buf()
430 ret = __verify_planes_array(vb, b); in vb2_queue_or_prepare_buf()
435 vb->state != VB2_BUF_STATE_DEQUEUED) { in vb2_queue_or_prepare_buf()
440 if (!vb->prepared) { in vb2_queue_or_prepare_buf()
441 set_buffer_cache_hints(q, vb, b); in vb2_queue_or_prepare_buf()
444 sizeof(vbuf->planes[0]) * vb->num_planes); in vb2_queue_or_prepare_buf()
445 ret = vb2_fill_vb2_v4l2_buffer(vb, b); in vb2_queue_or_prepare_buf()
528 static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb) in __fill_v4l2_buffer() argument
531 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __fill_v4l2_buffer()
532 struct vb2_queue *q = vb->vb2_queue; in __fill_v4l2_buffer()
536 b->index = vb->index; in __fill_v4l2_buffer()
537 b->type = vb->type; in __fill_v4l2_buffer()
538 b->memory = vb->memory; in __fill_v4l2_buffer()
543 v4l2_buffer_set_timestamp(b, vb->timestamp); in __fill_v4l2_buffer()
554 b->length = vb->num_planes; in __fill_v4l2_buffer()
555 for (plane = 0; plane < vb->num_planes; ++plane) { in __fill_v4l2_buffer()
557 struct vb2_plane *psrc = &vb->planes[plane]; in __fill_v4l2_buffer()
575 b->length = vb->planes[0].length; in __fill_v4l2_buffer()
576 b->bytesused = vb->planes[0].bytesused; in __fill_v4l2_buffer()
578 b->m.offset = vb->planes[0].m.offset; in __fill_v4l2_buffer()
580 b->m.userptr = vb->planes[0].m.userptr; in __fill_v4l2_buffer()
582 b->m.fd = vb->planes[0].m.fd; in __fill_v4l2_buffer()
599 switch (vb->state) { in __fill_v4l2_buffer()
619 if ((vb->state == VB2_BUF_STATE_DEQUEUED || in __fill_v4l2_buffer()
620 vb->state == VB2_BUF_STATE_IN_REQUEST) && in __fill_v4l2_buffer()
621 vb->synced && vb->prepared) in __fill_v4l2_buffer()
624 if (vb2_buffer_in_use(q, vb)) in __fill_v4l2_buffer()
637 static int __fill_vb2_buffer(struct vb2_buffer *vb, struct vb2_plane *planes) in __fill_vb2_buffer() argument
639 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); in __fill_vb2_buffer()
642 if (!vb->vb2_queue->copy_timestamp) in __fill_vb2_buffer()
643 vb->timestamp = 0; in __fill_vb2_buffer()
645 for (plane = 0; plane < vb->num_planes; ++plane) { in __fill_vb2_buffer()
646 if (vb->vb2_queue->memory != VB2_MEMORY_MMAP) { in __fill_vb2_buffer()
692 struct vb2_buffer *vb; in vb2_querybuf() local
704 vb = q->bufs[b->index]; in vb2_querybuf()
705 ret = __verify_planes_array(vb, b); in vb2_querybuf()