Lines Matching refs:vb
64 static int __verify_planes_array(struct vb2_buffer *vb, const struct v4l2_buffer *b)
71 dprintk(vb->vb2_queue, 1,
76 if (b->length < vb->num_planes || b->length > VB2_MAX_PLANES) {
77 dprintk(vb->vb2_queue, 1,
79 vb->num_planes, b->length);
86 static int __verify_planes_array_core(struct vb2_buffer *vb, const void *pb)
88 return __verify_planes_array(vb, pb);
95 static int __verify_length(struct vb2_buffer *vb, const struct v4l2_buffer *b)
105 for (plane = 0; plane < vb->num_planes; ++plane) {
109 : vb->planes[plane].length;
122 ? b->length : vb->planes[0].length;
134 static void __init_vb2_v4l2_buffer(struct vb2_buffer *vb)
136 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
141 static void __copy_timestamp(struct vb2_buffer *vb, const void *pb)
144 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
145 struct vb2_queue *q = vb->vb2_queue;
153 vb->timestamp = v4l2_buffer_get_timestamp(b);
160 static void vb2_warn_zero_bytesused(struct vb2_buffer *vb)
170 if (vb->vb2_queue->allow_zero_bytesused)
176 static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b)
178 struct vb2_queue *q = vb->vb2_queue;
179 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
184 ret = __verify_length(vb, b);
209 for (plane = 0; plane < vb->num_planes; ++plane) {
217 for (plane = 0; plane < vb->num_planes; ++plane) {
225 for (plane = 0; plane < vb->num_planes; ++plane) {
227 vb->planes[plane].m.offset;
229 vb->planes[plane].length;
252 for (plane = 0; plane < vb->num_planes; ++plane) {
257 vb2_warn_zero_bytesused(vb);
259 if (vb->vb2_queue->allow_zero_bytesused)
292 planes[0].m.offset = vb->planes[0].m.offset;
293 planes[0].length = vb->planes[0].length;
300 vb2_warn_zero_bytesused(vb);
302 if (vb->vb2_queue->allow_zero_bytesused)
314 if (!vb->vb2_queue->copy_timestamp || V4L2_TYPE_IS_CAPTURE(b->type)) {
345 struct vb2_buffer *vb,
354 vb->need_cache_sync_on_finish = 0;
355 vb->need_cache_sync_on_prepare = 0;
363 vb->need_cache_sync_on_prepare = 1;
364 vb->need_cache_sync_on_finish = 1;
382 vb->need_cache_sync_on_finish = 0;
385 vb->need_cache_sync_on_finish = 0;
388 vb->need_cache_sync_on_prepare = 0;
398 struct vb2_buffer *vb;
422 vb = q->bufs[b->index];
423 vbuf = to_vb2_v4l2_buffer(vb);
424 ret = __verify_planes_array(vb, b);
429 vb->state != VB2_BUF_STATE_DEQUEUED) {
434 if (!vb->prepared) {
435 set_buffer_cache_hints(q, vb, b);
438 sizeof(vbuf->planes[0]) * vb->num_planes);
439 ret = vb2_fill_vb2_v4l2_buffer(vb, b);
522 static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb)
525 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
526 struct vb2_queue *q = vb->vb2_queue;
530 b->index = vb->index;
531 b->type = vb->type;
532 b->memory = vb->memory;
537 v4l2_buffer_set_timestamp(b, vb->timestamp);
548 b->length = vb->num_planes;
549 for (plane = 0; plane < vb->num_planes; ++plane) {
551 struct vb2_plane *psrc = &vb->planes[plane];
569 b->length = vb->planes[0].length;
570 b->bytesused = vb->planes[0].bytesused;
572 b->m.offset = vb->planes[0].m.offset;
574 b->m.userptr = vb->planes[0].m.userptr;
576 b->m.fd = vb->planes[0].m.fd;
593 switch (vb->state) {
613 if ((vb->state == VB2_BUF_STATE_DEQUEUED ||
614 vb->state == VB2_BUF_STATE_IN_REQUEST) &&
615 vb->synced && vb->prepared)
618 if (vb2_buffer_in_use(q, vb))
631 static int __fill_vb2_buffer(struct vb2_buffer *vb, struct vb2_plane *planes)
633 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
636 if (!vb->vb2_queue->copy_timestamp)
637 vb->timestamp = 0;
639 for (plane = 0; plane < vb->num_planes; ++plane) {
640 if (vb->vb2_queue->memory != VB2_MEMORY_MMAP) {
686 struct vb2_buffer *vb;
698 vb = q->bufs[b->index];
699 ret = __verify_planes_array(vb, b);