*/
if (vb2_get_num_buffers(q)) {
bool unbalanced = q->cnt_start_streaming != q->cnt_stop_streaming ||
- q->cnt_prepare_streaming != q->cnt_unprepare_streaming ||
- q->cnt_wait_prepare != q->cnt_wait_finish;
+ q->cnt_prepare_streaming != q->cnt_unprepare_streaming;
if (unbalanced) {
pr_info("unbalanced counters for queue %p:\n", q);
if (q->cnt_prepare_streaming != q->cnt_unprepare_streaming)
pr_info(" prepare_streaming: %u unprepare_streaming: %u\n",
q->cnt_prepare_streaming, q->cnt_unprepare_streaming);
- if (q->cnt_wait_prepare != q->cnt_wait_finish)
- pr_info(" wait_prepare: %u wait_finish: %u\n",
- q->cnt_wait_prepare, q->cnt_wait_finish);
}
q->cnt_queue_setup = 0;
- q->cnt_wait_prepare = 0;
- q->cnt_wait_finish = 0;
q->cnt_prepare_streaming = 0;
q->cnt_start_streaming = 0;
q->cnt_stop_streaming = 0;
* become ready or for streamoff. Driver's lock is released to
* allow streamoff or qbuf to be called while waiting.
*/
- if (q->ops->wait_prepare)
- call_void_qop(q, wait_prepare, q);
- else if (q->lock)
- mutex_unlock(q->lock);
+ mutex_unlock(q->lock);
/*
* All locks have been released, it is safe to sleep now.
!list_empty(&q->done_list) || !q->streaming ||
q->error);
- if (q->ops->wait_finish)
- call_void_qop(q, wait_finish, q);
- else if (q->lock)
- mutex_lock(q->lock);
+ mutex_lock(q->lock);
q->waiting_in_dqbuf = 0;
/*
if (WARN_ON(q->min_reqbufs_allocation > q->max_num_buffers))
return -EINVAL;
- /* Either both or none are set */
- if (WARN_ON(!q->ops->wait_prepare ^ !q->ops->wait_finish))
- return -EINVAL;
-
- /* Warn if q->lock is NULL and no custom wait_prepare is provided */
- if (WARN_ON(!q->lock && !q->ops->wait_prepare))
+ /* Warn if q->lock is NULL */
+ if (WARN_ON(!q->lock))
return -EINVAL;
INIT_LIST_HEAD(&q->queued_list);
continue;
prequeue--;
} else {
- if (!threadio->stop) {
- if (q->ops->wait_finish)
- call_void_qop(q, wait_finish, q);
- else if (q->lock)
- mutex_lock(q->lock);
+ mutex_lock(q->lock);
+ if (!threadio->stop)
ret = vb2_core_dqbuf(q, &index, NULL, 0);
- if (q->ops->wait_prepare)
- call_void_qop(q, wait_prepare, q);
- else if (q->lock)
- mutex_unlock(q->lock);
- }
+ mutex_unlock(q->lock);
dprintk(q, 5, "file io: vb2_dqbuf result: %d\n", ret);
if (!ret)
vb = vb2_get_buffer(q, index);
if (copy_timestamp)
vb->timestamp = ktime_get_ns();
if (!threadio->stop) {
- if (q->ops->wait_finish)
- call_void_qop(q, wait_finish, q);
- else if (q->lock)
- mutex_lock(q->lock);
+ mutex_lock(q->lock);
ret = vb2_core_qbuf(q, vb, NULL, NULL);
- if (q->ops->wait_prepare)
- call_void_qop(q, wait_prepare, q);
- else if (q->lock)
- mutex_unlock(q->lock);
+ mutex_unlock(q->lock);
}
if (ret || threadio->stop)
break;
* \*num_buffers are being allocated additionally to
* the buffers already allocated. If either \*num_planes
* or the requested sizes are invalid callback must return %-EINVAL.
- * @wait_prepare: release any locks taken while calling vb2 functions;
- * it is called before an ioctl needs to wait for a new
- * buffer to arrive; required to avoid a deadlock in
- * blocking access type.
- * @wait_finish: reacquire all locks released in the previous callback;
- * required to continue operation after sleeping while
- * waiting for a new buffer to arrive.
* @buf_out_validate: called when the output buffer is prepared or queued
* to a request; drivers can use this to validate
* userspace-provided information; this is required only
unsigned int *num_buffers, unsigned int *num_planes,
unsigned int sizes[], struct device *alloc_devs[]);
- void (*wait_prepare)(struct vb2_queue *q);
- void (*wait_finish)(struct vb2_queue *q);
-
int (*buf_out_validate)(struct vb2_buffer *vb);
int (*buf_init)(struct vb2_buffer *vb);
int (*buf_prepare)(struct vb2_buffer *vb);
* @non_coherent_mem: when set queue will attempt to allocate buffers using
* non-coherent memory.
* @lock: pointer to a mutex that protects the &struct vb2_queue. The
- * driver can set this to a mutex to let the v4l2 core serialize
- * the queuing ioctls. If the driver wants to handle locking
- * itself, then this should be set to NULL. This lock is not used
- * by the videobuf2 core API.
+ * driver must set this to a mutex to let the v4l2 core serialize
+ * the queuing ioctls. This lock is used when waiting for a new
+ * buffer to arrive: the lock is released, we wait for the new
+ * buffer, and then retaken.
* @owner: The filehandle that 'owns' the buffers, i.e. the filehandle
* that called reqbufs, create_buffers or started fileio.
* This field is not used by the videobuf2 core API, but it allows
* called. Used to check for unbalanced ops.
*/
u32 cnt_queue_setup;
- u32 cnt_wait_prepare;
- u32 cnt_wait_finish;
u32 cnt_prepare_streaming;
u32 cnt_start_streaming;
u32 cnt_stop_streaming;
* @q: pointer to &struct vb2_queue with videobuf2 queue.
*
* This function will wait until all buffers that have been given to the driver
- * by &vb2_ops->buf_queue are given back to vb2 with vb2_buffer_done(). It
- * doesn't call &vb2_ops->wait_prepare/&vb2_ops->wait_finish pair.
+ * by &vb2_ops->buf_queue are given back to vb2 with vb2_buffer_done().
* It is intended to be called with all locks taken, for example from
* &vb2_ops->stop_streaming callback.
*/