Lines Matching refs:queue

45 	struct uvc_video_queue *queue = vb2_get_drv_priv(vq);  in uvc_queue_setup()  local
46 struct uvc_video *video = container_of(queue, struct uvc_video, queue); in uvc_queue_setup()
73 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_prepare() local
83 if (unlikely(queue->flags & UVC_QUEUE_DISCONNECTED)) in uvc_buffer_prepare()
87 if (queue->use_sg) { in uvc_buffer_prepare()
104 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_queue() local
109 spin_lock_irqsave(&queue->irqlock, flags); in uvc_buffer_queue()
111 if (likely(!(queue->flags & UVC_QUEUE_DISCONNECTED))) { in uvc_buffer_queue()
112 list_add_tail(&buf->queue, &queue->irqqueue); in uvc_buffer_queue()
122 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_buffer_queue()
133 int uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2_buf_type type, in uvcg_queue_init() argument
136 struct uvc_video *video = container_of(queue, struct uvc_video, queue); in uvcg_queue_init()
140 queue->queue.type = type; in uvcg_queue_init()
141 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in uvcg_queue_init()
142 queue->queue.drv_priv = queue; in uvcg_queue_init()
143 queue->queue.buf_struct_size = sizeof(struct uvc_buffer); in uvcg_queue_init()
144 queue->queue.ops = &uvc_queue_qops; in uvcg_queue_init()
145 queue->queue.lock = lock; in uvcg_queue_init()
147 queue->queue.mem_ops = &vb2_dma_sg_memops; in uvcg_queue_init()
148 queue->use_sg = 1; in uvcg_queue_init()
150 queue->queue.mem_ops = &vb2_vmalloc_memops; in uvcg_queue_init()
153 queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY in uvcg_queue_init()
155 queue->queue.dev = dev; in uvcg_queue_init()
157 ret = vb2_queue_init(&queue->queue); in uvcg_queue_init()
161 spin_lock_init(&queue->irqlock); in uvcg_queue_init()
162 INIT_LIST_HEAD(&queue->irqqueue); in uvcg_queue_init()
163 queue->flags = 0; in uvcg_queue_init()
171 void uvcg_free_buffers(struct uvc_video_queue *queue) in uvcg_free_buffers() argument
173 vb2_queue_release(&queue->queue); in uvcg_free_buffers()
179 int uvcg_alloc_buffers(struct uvc_video_queue *queue, in uvcg_alloc_buffers() argument
184 ret = vb2_reqbufs(&queue->queue, rb); in uvcg_alloc_buffers()
189 int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) in uvcg_query_buffer() argument
191 return vb2_querybuf(&queue->queue, buf); in uvcg_query_buffer()
194 int uvcg_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) in uvcg_queue_buffer() argument
196 return vb2_qbuf(&queue->queue, NULL, buf); in uvcg_queue_buffer()
203 int uvcg_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf, in uvcg_dequeue_buffer() argument
206 return vb2_dqbuf(&queue->queue, buf, nonblocking); in uvcg_dequeue_buffer()
215 __poll_t uvcg_queue_poll(struct uvc_video_queue *queue, struct file *file, in uvcg_queue_poll() argument
218 return vb2_poll(&queue->queue, file, wait); in uvcg_queue_poll()
221 int uvcg_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) in uvcg_queue_mmap() argument
223 return vb2_mmap(&queue->queue, vma); in uvcg_queue_mmap()
232 unsigned long uvcg_queue_get_unmapped_area(struct uvc_video_queue *queue, in uvcg_queue_get_unmapped_area() argument
235 return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0); in uvcg_queue_get_unmapped_area()
251 void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect) in uvcg_queue_cancel() argument
256 spin_lock_irqsave(&queue->irqlock, flags); in uvcg_queue_cancel()
257 while (!list_empty(&queue->irqqueue)) { in uvcg_queue_cancel()
258 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, in uvcg_queue_cancel()
259 queue); in uvcg_queue_cancel()
260 list_del(&buf->queue); in uvcg_queue_cancel()
264 queue->buf_used = 0; in uvcg_queue_cancel()
274 queue->flags |= UVC_QUEUE_DISCONNECTED; in uvcg_queue_cancel()
275 spin_unlock_irqrestore(&queue->irqlock, flags); in uvcg_queue_cancel()
295 int uvcg_queue_enable(struct uvc_video_queue *queue, int enable) in uvcg_queue_enable() argument
301 ret = vb2_streamon(&queue->queue, queue->queue.type); in uvcg_queue_enable()
305 queue->sequence = 0; in uvcg_queue_enable()
306 queue->buf_used = 0; in uvcg_queue_enable()
307 queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; in uvcg_queue_enable()
309 ret = vb2_streamoff(&queue->queue, queue->queue.type); in uvcg_queue_enable()
313 spin_lock_irqsave(&queue->irqlock, flags); in uvcg_queue_enable()
314 INIT_LIST_HEAD(&queue->irqqueue); in uvcg_queue_enable()
322 queue->flags &= ~UVC_QUEUE_DISCONNECTED; in uvcg_queue_enable()
323 spin_unlock_irqrestore(&queue->irqlock, flags); in uvcg_queue_enable()
330 void uvcg_complete_buffer(struct uvc_video_queue *queue, in uvcg_complete_buffer() argument
333 if (queue->flags & UVC_QUEUE_DROP_INCOMPLETE) { in uvcg_complete_buffer()
334 queue->flags &= ~UVC_QUEUE_DROP_INCOMPLETE; in uvcg_complete_buffer()
342 buf->buf.sequence = queue->sequence++; in uvcg_complete_buffer()
349 struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue) in uvcg_queue_head() argument
353 if (!list_empty(&queue->irqqueue)) in uvcg_queue_head()
354 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, in uvcg_queue_head()
355 queue); in uvcg_queue_head()