• Home
  • Raw
  • Download

Lines Matching refs:queue

36 uvc_queue_to_stream(struct uvc_video_queue *queue)  in uvc_queue_to_stream()  argument
38 return container_of(queue, struct uvc_streaming, queue); in uvc_queue_to_stream()
51 static void uvc_queue_return_buffers(struct uvc_video_queue *queue, in uvc_queue_return_buffers() argument
58 while (!list_empty(&queue->irqqueue)) { in uvc_queue_return_buffers()
59 struct uvc_buffer *buf = list_first_entry(&queue->irqqueue, in uvc_queue_return_buffers()
61 queue); in uvc_queue_return_buffers()
62 list_del(&buf->queue); in uvc_queue_return_buffers()
76 struct uvc_video_queue *queue = vb2_get_drv_priv(vq); in uvc_queue_setup() local
86 stream = uvc_queue_to_stream(queue); in uvc_queue_setup()
107 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_prepare() local
116 if (unlikely(queue->flags & UVC_QUEUE_DISCONNECTED)) in uvc_buffer_prepare()
134 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_queue() local
138 spin_lock_irqsave(&queue->irqlock, flags); in uvc_buffer_queue()
139 if (likely(!(queue->flags & UVC_QUEUE_DISCONNECTED))) { in uvc_buffer_queue()
141 list_add_tail(&buf->queue, &queue->irqqueue); in uvc_buffer_queue()
150 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_buffer_queue()
156 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_finish() local
157 struct uvc_streaming *stream = uvc_queue_to_stream(queue); in uvc_buffer_finish()
166 struct uvc_video_queue *queue = vb2_get_drv_priv(vq); in uvc_start_streaming() local
167 struct uvc_streaming *stream = uvc_queue_to_stream(queue); in uvc_start_streaming()
172 queue->buf_used = 0; in uvc_start_streaming()
178 spin_lock_irq(&queue->irqlock); in uvc_start_streaming()
179 uvc_queue_return_buffers(queue, UVC_BUF_STATE_QUEUED); in uvc_start_streaming()
180 spin_unlock_irq(&queue->irqlock); in uvc_start_streaming()
187 struct uvc_video_queue *queue = vb2_get_drv_priv(vq); in uvc_stop_streaming() local
192 uvc_video_stop_streaming(uvc_queue_to_stream(queue)); in uvc_stop_streaming()
194 spin_lock_irq(&queue->irqlock); in uvc_stop_streaming()
195 uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR); in uvc_stop_streaming()
196 spin_unlock_irq(&queue->irqlock); in uvc_stop_streaming()
219 int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, in uvc_queue_init() argument
224 queue->queue.type = type; in uvc_queue_init()
225 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR; in uvc_queue_init()
226 queue->queue.drv_priv = queue; in uvc_queue_init()
227 queue->queue.buf_struct_size = sizeof(struct uvc_buffer); in uvc_queue_init()
228 queue->queue.mem_ops = &vb2_vmalloc_memops; in uvc_queue_init()
229 queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC in uvc_queue_init()
231 queue->queue.lock = &queue->mutex; in uvc_queue_init()
235 queue->queue.ops = &uvc_meta_queue_qops; in uvc_queue_init()
238 queue->queue.io_modes |= VB2_DMABUF; in uvc_queue_init()
239 queue->queue.ops = &uvc_queue_qops; in uvc_queue_init()
243 ret = vb2_queue_init(&queue->queue); in uvc_queue_init()
247 mutex_init(&queue->mutex); in uvc_queue_init()
248 spin_lock_init(&queue->irqlock); in uvc_queue_init()
249 INIT_LIST_HEAD(&queue->irqqueue); in uvc_queue_init()
250 queue->flags = drop_corrupted ? UVC_QUEUE_DROP_CORRUPTED : 0; in uvc_queue_init()
255 void uvc_queue_release(struct uvc_video_queue *queue) in uvc_queue_release() argument
257 mutex_lock(&queue->mutex); in uvc_queue_release()
258 vb2_queue_release(&queue->queue); in uvc_queue_release()
259 mutex_unlock(&queue->mutex); in uvc_queue_release()
266 int uvc_request_buffers(struct uvc_video_queue *queue, in uvc_request_buffers() argument
271 mutex_lock(&queue->mutex); in uvc_request_buffers()
272 ret = vb2_reqbufs(&queue->queue, rb); in uvc_request_buffers()
273 mutex_unlock(&queue->mutex); in uvc_request_buffers()
278 int uvc_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) in uvc_query_buffer() argument
282 mutex_lock(&queue->mutex); in uvc_query_buffer()
283 ret = vb2_querybuf(&queue->queue, buf); in uvc_query_buffer()
284 mutex_unlock(&queue->mutex); in uvc_query_buffer()
289 int uvc_create_buffers(struct uvc_video_queue *queue, in uvc_create_buffers() argument
294 mutex_lock(&queue->mutex); in uvc_create_buffers()
295 ret = vb2_create_bufs(&queue->queue, cb); in uvc_create_buffers()
296 mutex_unlock(&queue->mutex); in uvc_create_buffers()
301 int uvc_queue_buffer(struct uvc_video_queue *queue, in uvc_queue_buffer() argument
306 mutex_lock(&queue->mutex); in uvc_queue_buffer()
307 ret = vb2_qbuf(&queue->queue, mdev, buf); in uvc_queue_buffer()
308 mutex_unlock(&queue->mutex); in uvc_queue_buffer()
313 int uvc_export_buffer(struct uvc_video_queue *queue, in uvc_export_buffer() argument
318 mutex_lock(&queue->mutex); in uvc_export_buffer()
319 ret = vb2_expbuf(&queue->queue, exp); in uvc_export_buffer()
320 mutex_unlock(&queue->mutex); in uvc_export_buffer()
325 int uvc_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf, in uvc_dequeue_buffer() argument
330 mutex_lock(&queue->mutex); in uvc_dequeue_buffer()
331 ret = vb2_dqbuf(&queue->queue, buf, nonblocking); in uvc_dequeue_buffer()
332 mutex_unlock(&queue->mutex); in uvc_dequeue_buffer()
337 int uvc_queue_streamon(struct uvc_video_queue *queue, enum v4l2_buf_type type) in uvc_queue_streamon() argument
341 mutex_lock(&queue->mutex); in uvc_queue_streamon()
342 ret = vb2_streamon(&queue->queue, type); in uvc_queue_streamon()
343 mutex_unlock(&queue->mutex); in uvc_queue_streamon()
348 int uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type) in uvc_queue_streamoff() argument
352 mutex_lock(&queue->mutex); in uvc_queue_streamoff()
353 ret = vb2_streamoff(&queue->queue, type); in uvc_queue_streamoff()
354 mutex_unlock(&queue->mutex); in uvc_queue_streamoff()
359 int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) in uvc_queue_mmap() argument
361 return vb2_mmap(&queue->queue, vma); in uvc_queue_mmap()
365 unsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue, in uvc_queue_get_unmapped_area() argument
368 return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0); in uvc_queue_get_unmapped_area()
372 __poll_t uvc_queue_poll(struct uvc_video_queue *queue, struct file *file, in uvc_queue_poll() argument
377 mutex_lock(&queue->mutex); in uvc_queue_poll()
378 ret = vb2_poll(&queue->queue, file, wait); in uvc_queue_poll()
379 mutex_unlock(&queue->mutex); in uvc_queue_poll()
391 int uvc_queue_allocated(struct uvc_video_queue *queue) in uvc_queue_allocated() argument
395 mutex_lock(&queue->mutex); in uvc_queue_allocated()
396 allocated = vb2_is_busy(&queue->queue); in uvc_queue_allocated()
397 mutex_unlock(&queue->mutex); in uvc_queue_allocated()
414 void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect) in uvc_queue_cancel() argument
418 spin_lock_irqsave(&queue->irqlock, flags); in uvc_queue_cancel()
419 uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR); in uvc_queue_cancel()
427 queue->flags |= UVC_QUEUE_DISCONNECTED; in uvc_queue_cancel()
428 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_queue_cancel()
438 __uvc_queue_get_current_buffer(struct uvc_video_queue *queue) in __uvc_queue_get_current_buffer() argument
440 if (list_empty(&queue->irqqueue)) in __uvc_queue_get_current_buffer()
443 return list_first_entry(&queue->irqqueue, struct uvc_buffer, queue); in __uvc_queue_get_current_buffer()
446 struct uvc_buffer *uvc_queue_get_current_buffer(struct uvc_video_queue *queue) in uvc_queue_get_current_buffer() argument
451 spin_lock_irqsave(&queue->irqlock, flags); in uvc_queue_get_current_buffer()
452 nextbuf = __uvc_queue_get_current_buffer(queue); in uvc_queue_get_current_buffer()
453 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_queue_get_current_buffer()
465 static void uvc_queue_buffer_requeue(struct uvc_video_queue *queue, in uvc_queue_buffer_requeue() argument
480 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_queue_buffer_complete() local
482 if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) { in uvc_queue_buffer_complete()
483 uvc_queue_buffer_requeue(queue, buf); in uvc_queue_buffer_complete()
506 struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, in uvc_queue_next_buffer() argument
512 spin_lock_irqsave(&queue->irqlock, flags); in uvc_queue_next_buffer()
513 list_del(&buf->queue); in uvc_queue_next_buffer()
514 nextbuf = __uvc_queue_get_current_buffer(queue); in uvc_queue_next_buffer()
515 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_queue_next_buffer()