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,
360 vb->skip_cache_sync_on_finish = 1;
363 vb->skip_cache_sync_on_prepare = 1;
373 struct vb2_buffer *vb;
397 vb = q->bufs[b->index];
398 vbuf = to_vb2_v4l2_buffer(vb);
399 ret = __verify_planes_array(vb, b);
404 vb->state != VB2_BUF_STATE_DEQUEUED) {
409 if (!vb->prepared) {
410 set_buffer_cache_hints(q, vb, b);
413 sizeof(vbuf->planes[0]) * vb->num_planes);
414 ret = vb2_fill_vb2_v4l2_buffer(vb, b);
492 static void __fill_v4l2_buffer(struct vb2_buffer *vb, void *pb)
495 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
496 struct vb2_queue *q = vb->vb2_queue;
500 b->index = vb->index;
501 b->type = vb->type;
502 b->memory = vb->memory;
507 v4l2_buffer_set_timestamp(b, vb->timestamp);
518 b->length = vb->num_planes;
519 for (plane = 0; plane < vb->num_planes; ++plane) {
521 struct vb2_plane *psrc = &vb->planes[plane];
539 b->length = vb->planes[0].length;
540 b->bytesused = vb->planes[0].bytesused;
542 b->m.offset = vb->planes[0].m.offset;
544 b->m.userptr = vb->planes[0].m.userptr;
546 b->m.fd = vb->planes[0].m.fd;
563 switch (vb->state) {
583 if ((vb->state == VB2_BUF_STATE_DEQUEUED ||
584 vb->state == VB2_BUF_STATE_IN_REQUEST) &&
585 vb->synced && vb->prepared)
588 if (vb2_buffer_in_use(q, vb))
601 static int __fill_vb2_buffer(struct vb2_buffer *vb, struct vb2_plane *planes)
603 struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
606 if (!vb->vb2_queue->copy_timestamp)
607 vb->timestamp = 0;
609 for (plane = 0; plane < vb->num_planes; ++plane) {
610 if (vb->vb2_queue->memory != VB2_MEMORY_MMAP) {
655 struct vb2_buffer *vb;
667 vb = q->bufs[b->index];
668 ret = __verify_planes_array(vb, b);