Re: [PATCHv2 for v3.15] vb2: call finish() memop for prepared/queued buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please ignore this patch. This isn't valid for the current 3.15 tree. It will
become relevant later after additional patches have been applied.

I've rejected this patch in patchwork.

Regards,

	Hans

On 03/28/2014 12:43 PM, Hans Verkuil wrote:
> This supersedes "[PATCH for v3.15] vb2: call __buf_finish_memory for
> prepared/queued buffers". I realized that that patch was for an internal
> git branch and didn't apply to the master branch. The fix is the same,
> though.
> 
> v4l2-compliance reports unbalanced prepare/finish memops in the case
> where buffers are queued, streamon is never called and then reqbufs()
> is called that has to cancel any queued buffers.
> 
> When canceling a queue the finish() memop should be called for all
> buffers in the state 'PREPARED' or 'QUEUED' to ensure the prepare() and
> finish() memops are balanced.
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> ---
>  drivers/media/v4l2-core/videobuf2-core.c | 16 +++++++++++++---
>  1 file changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index f9059bb..cc1bd5a 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1063,6 +1063,15 @@ void *vb2_plane_cookie(struct vb2_buffer *vb, unsigned int plane_no)
>  }
>  EXPORT_SYMBOL_GPL(vb2_plane_cookie);
>  
> +static void vb2_buffer_finish(struct vb2_buffer *vb)
> +{
> +	unsigned plane;
> +
> +	/* sync buffers */
> +	for (plane = 0; plane < vb->num_planes; ++plane)
> +		call_memop(vb, finish, vb->planes[plane].mem_priv);
> +}
> +
>  /**
>   * vb2_buffer_done() - inform videobuf that an operation on a buffer is finished
>   * @vb:		vb2_buffer returned from the driver
> @@ -1086,7 +1095,6 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
>  {
>  	struct vb2_queue *q = vb->vb2_queue;
>  	unsigned long flags;
> -	unsigned int plane;
>  
>  	if (WARN_ON(vb->state != VB2_BUF_STATE_ACTIVE))
>  		return;
> @@ -1111,8 +1119,7 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state)
>  			vb->v4l2_buf.index, state);
>  
>  	/* sync buffers */
> -	for (plane = 0; plane < vb->num_planes; ++plane)
> -		call_memop(vb, finish, vb->planes[plane].mem_priv);
> +	vb2_buffer_finish(vb);
>  
>  	/* Add the buffer to the done buffers list */
>  	spin_lock_irqsave(&q->done_lock, flags);
> @@ -2041,6 +2048,9 @@ static void __vb2_queue_cancel(struct vb2_queue *q)
>  		struct vb2_buffer *vb = q->bufs[i];
>  
>  		if (vb->state != VB2_BUF_STATE_DEQUEUED) {
> +			if (vb->state == VB2_BUF_STATE_QUEUED ||
> +			    vb->state == VB2_BUF_STATE_PREPARED)
> +				vb2_buffer_finish(vb);
>  			vb->state = VB2_BUF_STATE_PREPARED;
>  			call_vb_qop(vb, buf_finish, vb);
>  		}
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux