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()
66 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_prepare() local
76 if (unlikely(queue->flags & UVC_QUEUE_DISCONNECTED)) in uvc_buffer_prepare()
80 if (queue->use_sg) { in uvc_buffer_prepare()
97 struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); in uvc_buffer_queue() local
102 spin_lock_irqsave(&queue->irqlock, flags); in uvc_buffer_queue()
104 if (likely(!(queue->flags & UVC_QUEUE_DISCONNECTED))) { in uvc_buffer_queue()
105 list_add_tail(&buf->queue, &queue->irqqueue); in uvc_buffer_queue()
114 spin_unlock_irqrestore(&queue->irqlock, flags); in uvc_buffer_queue()
125 int uvcg_queue_init(struct uvc_video_queue *queue, struct device *dev, enum v4l2_buf_type type, in uvcg_queue_init() argument
128 struct uvc_video *video = container_of(queue, struct uvc_video, queue); in uvcg_queue_init()
132 queue->queue.type = type; in uvcg_queue_init()
133 queue->queue.io_modes = VB2_MMAP | VB2_USERPTR | VB2_DMABUF; in uvcg_queue_init()
134 queue->queue.drv_priv = queue; in uvcg_queue_init()
135 queue->queue.buf_struct_size = sizeof(struct uvc_buffer); in uvcg_queue_init()
136 queue->queue.ops = &uvc_queue_qops; in uvcg_queue_init()
137 queue->queue.lock = lock; in uvcg_queue_init()
139 queue->queue.mem_ops = &vb2_dma_sg_memops; in uvcg_queue_init()
140 queue->use_sg = 1; in uvcg_queue_init()
142 queue->queue.mem_ops = &vb2_vmalloc_memops; in uvcg_queue_init()
145 queue->queue.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY in uvcg_queue_init()
147 queue->queue.dev = dev; in uvcg_queue_init()
149 ret = vb2_queue_init(&queue->queue); in uvcg_queue_init()
153 spin_lock_init(&queue->irqlock); in uvcg_queue_init()
154 INIT_LIST_HEAD(&queue->irqqueue); in uvcg_queue_init()
155 queue->flags = 0; in uvcg_queue_init()
163 void uvcg_free_buffers(struct uvc_video_queue *queue) in uvcg_free_buffers() argument
165 vb2_queue_release(&queue->queue); in uvcg_free_buffers()
171 int uvcg_alloc_buffers(struct uvc_video_queue *queue, in uvcg_alloc_buffers() argument
176 ret = vb2_reqbufs(&queue->queue, rb); in uvcg_alloc_buffers()
181 int uvcg_query_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) in uvcg_query_buffer() argument
183 return vb2_querybuf(&queue->queue, buf); in uvcg_query_buffer()
186 int uvcg_queue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf) in uvcg_queue_buffer() argument
191 ret = vb2_qbuf(&queue->queue, NULL, buf); in uvcg_queue_buffer()
195 spin_lock_irqsave(&queue->irqlock, flags); in uvcg_queue_buffer()
196 ret = (queue->flags & UVC_QUEUE_PAUSED) != 0; in uvcg_queue_buffer()
197 queue->flags &= ~UVC_QUEUE_PAUSED; in uvcg_queue_buffer()
198 spin_unlock_irqrestore(&queue->irqlock, flags); in uvcg_queue_buffer()
206 int uvcg_dequeue_buffer(struct uvc_video_queue *queue, struct v4l2_buffer *buf, in uvcg_dequeue_buffer() argument
209 return vb2_dqbuf(&queue->queue, buf, nonblocking); in uvcg_dequeue_buffer()
218 __poll_t uvcg_queue_poll(struct uvc_video_queue *queue, struct file *file, in uvcg_queue_poll() argument
221 return vb2_poll(&queue->queue, file, wait); in uvcg_queue_poll()
224 int uvcg_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) in uvcg_queue_mmap() argument
226 return vb2_mmap(&queue->queue, vma); in uvcg_queue_mmap()
235 unsigned long uvcg_queue_get_unmapped_area(struct uvc_video_queue *queue, in uvcg_queue_get_unmapped_area() argument
238 return vb2_get_unmapped_area(&queue->queue, 0, 0, pgoff, 0); in uvcg_queue_get_unmapped_area()
254 void uvcg_queue_cancel(struct uvc_video_queue *queue, int disconnect) in uvcg_queue_cancel() argument
259 spin_lock_irqsave(&queue->irqlock, flags); in uvcg_queue_cancel()
260 while (!list_empty(&queue->irqqueue)) { in uvcg_queue_cancel()
261 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, in uvcg_queue_cancel()
262 queue); in uvcg_queue_cancel()
263 list_del(&buf->queue); 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()
308 ret = vb2_streamoff(&queue->queue, queue->queue.type); in uvcg_queue_enable()
312 spin_lock_irqsave(&queue->irqlock, flags); in uvcg_queue_enable()
313 INIT_LIST_HEAD(&queue->irqqueue); in uvcg_queue_enable()
321 queue->flags &= ~UVC_QUEUE_DISCONNECTED; in uvcg_queue_enable()
322 spin_unlock_irqrestore(&queue->irqlock, flags); in uvcg_queue_enable()
329 struct uvc_buffer *uvcg_queue_next_buffer(struct uvc_video_queue *queue, in uvcg_queue_next_buffer() argument
334 if ((queue->flags & UVC_QUEUE_DROP_INCOMPLETE) && in uvcg_queue_next_buffer()
341 list_del(&buf->queue); in uvcg_queue_next_buffer()
342 if (!list_empty(&queue->irqqueue)) in uvcg_queue_next_buffer()
343 nextbuf = list_first_entry(&queue->irqqueue, struct uvc_buffer, in uvcg_queue_next_buffer()
344 queue); in uvcg_queue_next_buffer()
349 buf->buf.sequence = queue->sequence++; in uvcg_queue_next_buffer()
358 struct uvc_buffer *uvcg_queue_head(struct uvc_video_queue *queue) in uvcg_queue_head() argument
362 if (!list_empty(&queue->irqqueue)) in uvcg_queue_head()
363 buf = list_first_entry(&queue->irqqueue, struct uvc_buffer, in uvcg_queue_head()
364 queue); in uvcg_queue_head()
366 queue->flags |= UVC_QUEUE_PAUSED; in uvcg_queue_head()