* videobuf & read/write operation
@ 2015-11-01 19:21 Ran Shalit
2015-11-01 19:39 ` Hans Verkuil
0 siblings, 1 reply; 4+ messages in thread
From: Ran Shalit @ 2015-11-01 19:21 UTC (permalink / raw)
To: linux-media
Hello,
I'm trying to understand how to imeplement v4l driver using videobuf.
The videobuf documentation if very helpful.
When the documentation refers to " I/O stream" , does it also include
the read/write operation or only streaming I/O method ?
In case I am using only read/write, do I need to implement all these 4 APIs:
struct videobuf_queue_ops {
int (*buf_setup)(struct videobuf_queue *q,
unsigned int *count, unsigned int *size);
int (*buf_prepare)(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field);
void (*buf_queue)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
void (*buf_release)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
};
Are these APIs relevant for both read/write and streaminf I/O ?
Best Regards,
Ran
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: videobuf & read/write operation
2015-11-01 19:21 videobuf & read/write operation Ran Shalit
@ 2015-11-01 19:39 ` Hans Verkuil
2015-11-01 20:13 ` Ran Shalit
0 siblings, 1 reply; 4+ messages in thread
From: Hans Verkuil @ 2015-11-01 19:39 UTC (permalink / raw)
To: Ran Shalit, linux-media
On 11/01/2015 08:21 PM, Ran Shalit wrote:
> Hello,
>
> I'm trying to understand how to imeplement v4l driver using videobuf.
> The videobuf documentation if very helpful.
Don't use videobuf! Use videobuf2, just like the skeleton driver.
The old videobuf framework is deprecated and you shouldn't use it as it is
horrible.
Why on earth are you trying to use videobuf if the skeleton driver clearly
uses vb2?
Regards,
Hans
> When the documentation refers to " I/O stream" , does it also include
> the read/write operation or only streaming I/O method ?
>
> In case I am using only read/write, do I need to implement all these 4 APIs:
>
> struct videobuf_queue_ops {
> int (*buf_setup)(struct videobuf_queue *q,
> unsigned int *count, unsigned int *size);
> int (*buf_prepare)(struct videobuf_queue *q,
> struct videobuf_buffer *vb,
> enum v4l2_field field);
> void (*buf_queue)(struct videobuf_queue *q,
> struct videobuf_buffer *vb);
> void (*buf_release)(struct videobuf_queue *q,
> struct videobuf_buffer *vb);
> };
>
> Are these APIs relevant for both read/write and streaminf I/O ?
>
> Best Regards,
> Ran
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: videobuf & read/write operation
2015-11-01 19:39 ` Hans Verkuil
@ 2015-11-01 20:13 ` Ran Shalit
2015-11-01 21:48 ` Hans Verkuil
0 siblings, 1 reply; 4+ messages in thread
From: Ran Shalit @ 2015-11-01 20:13 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media
> Don't use videobuf! Use videobuf2, just like the skeleton driver.
>
> The old videobuf framework is deprecated and you shouldn't use it as it is
> horrible.
>
> Why on earth are you trying to use videobuf if the skeleton driver clearly
> uses vb2?
>
Right,
I now see that I was examining code which is quite old (2.6.37 from
SDK I'm using).
In case we only need read/write operation, do we still need to
implement all videobuf2 APIs ?
Regards,
Ran
>
>> When the documentation refers to " I/O stream" , does it also include
>> the read/write operation or only streaming I/O method ?
>>
>> In case I am using only read/write, do I need to implement all these 4 APIs:
>>
>> struct videobuf_queue_ops {
>> int (*buf_setup)(struct videobuf_queue *q,
>> unsigned int *count, unsigned int *size);
>> int (*buf_prepare)(struct videobuf_queue *q,
>> struct videobuf_buffer *vb,
>> enum v4l2_field field);
>> void (*buf_queue)(struct videobuf_queue *q,
>> struct videobuf_buffer *vb);
>> void (*buf_release)(struct videobuf_queue *q,
>> struct videobuf_buffer *vb);
>> };
>>
>> Are these APIs relevant for both read/write and streaminf I/O ?
>>
>> Best Regards,
>> Ran
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: videobuf & read/write operation
2015-11-01 20:13 ` Ran Shalit
@ 2015-11-01 21:48 ` Hans Verkuil
0 siblings, 0 replies; 4+ messages in thread
From: Hans Verkuil @ 2015-11-01 21:48 UTC (permalink / raw)
To: Ran Shalit; +Cc: linux-media
On 11/01/2015 09:13 PM, Ran Shalit wrote:
>> Don't use videobuf! Use videobuf2, just like the skeleton driver.
>>
>> The old videobuf framework is deprecated and you shouldn't use it as it is
>> horrible.
>>
>> Why on earth are you trying to use videobuf if the skeleton driver clearly
>> uses vb2?
>>
>
> Right,
> I now see that I was examining code which is quite old (2.6.37 from
> SDK I'm using).
>
> In case we only need read/write operation, do we still need to
> implement all videobuf2 APIs ?
vb2 only got merged in 2.6.39. For what kernel are you doing this? 2.6.37 is ancient.
Anyway, for read/write you implement exactly the same vb2 callbacks as for stream I/O.
Read/write is implemented in the vb2 framework on top of stream I/O.
Typically drivers will have to implement queue_setup, buf_queue and start/stop_streaming
at minimum. The wait_prepare/finish callbacks are also needed, but you can typically use
the vb2_ops_wait_prepare/finish helper functions for that. Again, follow what the skeleton
driver does.
Regards,
Hans
>
>
> Regards,
> Ran
>
>
>>
>>> When the documentation refers to " I/O stream" , does it also include
>>> the read/write operation or only streaming I/O method ?
>>>
>>> In case I am using only read/write, do I need to implement all these 4 APIs:
>>>
>>> struct videobuf_queue_ops {
>>> int (*buf_setup)(struct videobuf_queue *q,
>>> unsigned int *count, unsigned int *size);
>>> int (*buf_prepare)(struct videobuf_queue *q,
>>> struct videobuf_buffer *vb,
>>> enum v4l2_field field);
>>> void (*buf_queue)(struct videobuf_queue *q,
>>> struct videobuf_buffer *vb);
>>> void (*buf_release)(struct videobuf_queue *q,
>>> struct videobuf_buffer *vb);
>>> };
>>>
>>> Are these APIs relevant for both read/write and streaminf I/O ?
>>>
>>> Best Regards,
>>> Ran
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>>
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-01 21:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-01 19:21 videobuf & read/write operation Ran Shalit
2015-11-01 19:39 ` Hans Verkuil
2015-11-01 20:13 ` Ran Shalit
2015-11-01 21:48 ` Hans Verkuil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox