Re: [RFC][PATCHv2 05/12] videobuf2: handle V4L2_FLAG_MEMORY_NON_CONSISTENT flag
From: Sergey Senozhatsky
Date: Wed Feb 19 2020 - 04:05:52 EST
On (20/02/19 09:48), Hans Verkuil wrote:
[..]
> > int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
> > {
> > int ret = vb2_verify_memory_type(q, req->memory, req->type);
> > + bool consistent = true;
> > +
> > + if (req->flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
> > + consistent = false;
>
> There is no check against allow_cache_hints: if that's 0, then
> the V4L2_FLAG_MEMORY_NON_CONSISTENT flag should be cleared since it is
> not supported.
The check is in set_queue_consistency()
static void set_queue_consistency(struct vb2_queue *q, bool consistent_mem)
{
if (!q->allow_cache_hints)
return;
if (consistent_mem)
q->dma_attrs &= ~DMA_ATTR_NON_CONSISTENT;
else
q->dma_attrs |= DMA_ATTR_NON_CONSISTENT;
}
I don't explicitly clear DMA_ATTR_NON_CONSISTENT attr for
!->allow_cache_hints queues just in case if the driver for
some reason sets that flag. ->allow_cache_hints is, thus,
only for cases when user-space asks us to set or clear it.
-ss