Re: [RFC][PATCH 06/15] videobuf2: handle V4L2_FLAG_MEMORY_NON_CONSISTENT in CREATE_BUFS

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

 



On 1/23/20 4:41 AM, Sergey Senozhatsky wrote:
> On (20/01/10 10:59), Hans Verkuil wrote:
> [..]
>>>  
>>>  	num_buffers = min(*count, VB2_MAX_FRAME - q->num_buffers);
>>> diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
>>> index 0eabb589684f..48d123a1ac2a 100644
>>> --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
>>> +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
>>> @@ -730,6 +730,7 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
>>>  	unsigned requested_sizes[VIDEO_MAX_PLANES];
>>>  	struct v4l2_format *f = &create->format;
>>>  	int ret = vb2_verify_memory_type(q, create->memory, f->type);
>>> +	bool consistent = true;
>>>  	unsigned i;
>>>  
>>>  	fill_buf_caps(q, &create->capabilities);
>>> @@ -775,7 +776,11 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
>>>  	for (i = 0; i < requested_planes; i++)
>>>  		if (requested_sizes[i] == 0)
>>>  			return -EINVAL;
>>> -	return ret ? ret : vb2_core_create_bufs(q, create->memory,
>>> +
>>> +	if (create->flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
>>> +		consistent = false;
>>> +
>>> +	return ret ? ret : vb2_core_create_bufs(q, create->memory, consistent,
>>>  		&create->count, requested_planes, requested_sizes);
>>
>> As mentioned before: we need a V4L2_BUF_CAP capability.
> 
> I can add V4L2_BUF_CAP for memory consistency. Isn't it just q->memory
> property though? User space may request MMAP consistent memory or MMAP
> inconsistent memory.

So instead of adding a flag we add a V4L2_MEMORY_MMAP_NON_CONSISTENT memory
type and add a V4L2_BUF_CAP_SUPPORTS_MMAP_NON_CONSISTENT to signal support
for this?

I like that better than a flag. It also automatically enforces that all
buffers must be of that type.

Regards,

	Hans

> 
> 	-ss
> 




[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