linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* v4l2 kernel module debugging methods
@ 2015-12-05 22:00 Ran Shalit
  2015-12-06  0:23 ` Nicolas Dufresne
  0 siblings, 1 reply; 6+ messages in thread
From: Ran Shalit @ 2015-12-05 22:00 UTC (permalink / raw)
  To: linux-media

Hello,

I would like to ask a general question regarding methods to debug a
v4l2 device driver.
Since I assume that the kernel driver will probably won't work in
first try after coding everything inside the device driver...

1. Do you think qemu/kgdb debugger is a good method for the device
driver debugging , or is it plain printing ?

2. Is there a simple way to display the image of a YUV-like buffer in memory ?

Any other methods, tips, about validation, testing and developing a
v4l2 device is appreciated.

Best Regards,
Ran

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: v4l2 kernel module debugging methods
  2015-12-05 22:00 v4l2 kernel module debugging methods Ran Shalit
@ 2015-12-06  0:23 ` Nicolas Dufresne
  2015-12-10 21:46   ` Ran Shalit
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Dufresne @ 2015-12-06  0:23 UTC (permalink / raw)
  To: Ran Shalit, linux-media

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

Le dimanche 06 décembre 2015 à 00:00 +0200, Ran Shalit a écrit :
> Hello,
> 
> I would like to ask a general question regarding methods to debug a
> v4l2 device driver.
> Since I assume that the kernel driver will probably won't work in
> first try after coding everything inside the device driver...
> 
> 1. Do you think qemu/kgdb debugger is a good method for the device
> driver debugging , or is it plain printing ?
> 
> 2. Is there a simple way to display the image of a YUV-like buffer in
> memory ?

Most Linux distribution ships GStreamer. You can with GStreamer read
and display a raw YUV images (you need to know the specific format)
using videoparse element.

  gst-launch-1.0 filesrc location=my.yuv ! videoparse format=yuy2 width=320 height=240 ! imagefreeze ! videoconvert ! autovideosink

You could also encode and store to various formats, replacing the
imagefreeze ... section with an encoder and a filesink. Note that
videoparse unfortunatly does not allow passing strides array or
offsets. So it will work only if you set the width/height to padded
width/height.

regards,
Nicolas

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: v4l2 kernel module debugging methods
  2015-12-06  0:23 ` Nicolas Dufresne
@ 2015-12-10 21:46   ` Ran Shalit
  2015-12-11  0:22     ` Nicolas Dufresne
  2015-12-11  8:50     ` Fabien DESSENNE
  0 siblings, 2 replies; 6+ messages in thread
From: Ran Shalit @ 2015-12-10 21:46 UTC (permalink / raw)
  To: Nicolas Dufresne; +Cc: linux-media

On Sun, Dec 6, 2015 at 2:23 AM, Nicolas Dufresne
<nicolas.dufresne@collabora.com> wrote:
> Le dimanche 06 décembre 2015 à 00:00 +0200, Ran Shalit a écrit :
>> Hello,
>>
>> I would like to ask a general question regarding methods to debug a
>> v4l2 device driver.
>> Since I assume that the kernel driver will probably won't work in
>> first try after coding everything inside the device driver...
>>
>> 1. Do you think qemu/kgdb debugger is a good method for the device
>> driver debugging , or is it plain printing ?
>>
>> 2. Is there a simple way to display the image of a YUV-like buffer in
>> memory ?
>
> Most Linux distribution ships GStreamer. You can with GStreamer read
> and display a raw YUV images (you need to know the specific format)
> using videoparse element.
>
>   gst-launch-1.0 filesrc location=my.yuv ! videoparse format=yuy2 width=320 height=240 ! imagefreeze ! videoconvert ! autovideosink
>
> You could also encode and store to various formats, replacing the
> imagefreeze ... section with an encoder and a filesink. Note that
> videoparse unfortunatly does not allow passing strides array or
> offsets. So it will work only if you set the width/height to padded
> width/height.
>
> regards,
> Nicolas

Hi Nicolas,

Thank you for the comment.
As someone expreinced with v4l2 device driver, do you recommened using
debugging technique such as qemu (or kgdb) or do you rather use plain
printing ?

Thank you very much,
Ran

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: v4l2 kernel module debugging methods
  2015-12-10 21:46   ` Ran Shalit
@ 2015-12-11  0:22     ` Nicolas Dufresne
  2015-12-11  8:50     ` Fabien DESSENNE
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Dufresne @ 2015-12-11  0:22 UTC (permalink / raw)
  To: Ran Shalit; +Cc: linux-media

[-- Attachment #1: Type: text/plain, Size: 386 bytes --]

Le jeudi 10 décembre 2015 à 23:46 +0200, Ran Shalit a écrit :
> Thank you for the comment.
> As someone expreinced with v4l2 device driver, do you recommened
> using
> debugging technique such as qemu (or kgdb) or do you rather use plain
> printing ?

I never used that, printing I used. You should also run v4l2-
compliance. It's a test suite, part of v4l-utils.

Nicolas

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: v4l2 kernel module debugging methods
  2015-12-10 21:46   ` Ran Shalit
  2015-12-11  0:22     ` Nicolas Dufresne
@ 2015-12-11  8:50     ` Fabien DESSENNE
  2015-12-12 11:40       ` Ran Shalit
  1 sibling, 1 reply; 6+ messages in thread
From: Fabien DESSENNE @ 2015-12-11  8:50 UTC (permalink / raw)
  To: Ran Shalit, Nicolas Dufresne; +Cc: linux-media@vger.kernel.org

Hi Ran,

On 12/10/2015 10:46 PM, Ran Shalit wrote:
> On Sun, Dec 6, 2015 at 2:23 AM, Nicolas Dufresne
> <nicolas.dufresne@collabora.com> wrote:
>> Le dimanche 06 décembre 2015 à 00:00 +0200, Ran Shalit a écrit :
>>> Hello,
>>>
>>> I would like to ask a general question regarding methods to debug a
>>> v4l2 device driver.
>>> Since I assume that the kernel driver will probably won't work in
>>> first try after coding everything inside the device driver...
>>>
>>> 1. Do you think qemu/kgdb debugger is a good method for the device
>>> driver debugging , or is it plain printing ?
>>>
>>> 2. Is there a simple way to display the image of a YUV-like buffer in
>>> memory ?
>>
>> Most Linux distribution ships GStreamer. You can with GStreamer read
>> and display a raw YUV images (you need to know the specific format)
>> using videoparse element.
>>
>>    gst-launch-1.0 filesrc location=my.yuv ! videoparse format=yuy2 width=320 height=240 ! imagefreeze ! videoconvert ! autovideosink
>>
>> You could also encode and store to various formats, replacing the
>> imagefreeze ... section with an encoder and a filesink. Note that
>> videoparse unfortunatly does not allow passing strides array or
>> offsets. So it will work only if you set the width/height to padded
>> width/height.
>>
>> regards,
>> Nicolas
>
> Hi Nicolas,
>
> Thank you for the comment.
> As someone expreinced with v4l2 device driver, do you recommened using
> debugging technique such as qemu (or kgdb) or do you rather use plain
> printing ?
>
> Thank you very much,
> Ran


You can get several level of logs.
First, you can enable v4l2 core debug logs. Example:
  echo 3 > /sys/class/video4linux/video0/debug
More details: 
https://www.kernel.org/doc/Documentation/video4linux/v4l2-framework.txt

If the tested driver uses the v4l2_mem2mem framework you can get M2M 
logs with:
  echo Y > /sys/module/v4l2_mem2mem/parameters/debug

Get also internal vb2 logs with:
  echo 3 > /sys/module/videobuf2_core/parameters/debug

And optionally more logs using the dynamic debug feature: 
(https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt). Example:
  echo "module my_driver +p" > /sys/kernel/debug/dynamic_debug/control

Fabien

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: v4l2 kernel module debugging methods
  2015-12-11  8:50     ` Fabien DESSENNE
@ 2015-12-12 11:40       ` Ran Shalit
  0 siblings, 0 replies; 6+ messages in thread
From: Ran Shalit @ 2015-12-12 11:40 UTC (permalink / raw)
  To: Fabien DESSENNE; +Cc: Nicolas Dufresne, linux-media@vger.kernel.org

On Fri, Dec 11, 2015 at 10:50 AM, Fabien DESSENNE
<fabien.dessenne@st.com> wrote:
> Hi Ran,
>
> On 12/10/2015 10:46 PM, Ran Shalit wrote:
>> On Sun, Dec 6, 2015 at 2:23 AM, Nicolas Dufresne
>> <nicolas.dufresne@collabora.com> wrote:
>>> Le dimanche 06 décembre 2015 à 00:00 +0200, Ran Shalit a écrit :
>>>> Hello,
>>>>
>>>> I would like to ask a general question regarding methods to debug a
>>>> v4l2 device driver.
>>>> Since I assume that the kernel driver will probably won't work in
>>>> first try after coding everything inside the device driver...
>>>>
>>>> 1. Do you think qemu/kgdb debugger is a good method for the device
>>>> driver debugging , or is it plain printing ?
>>>>
>>>> 2. Is there a simple way to display the image of a YUV-like buffer in
>>>> memory ?
>>>
>>> Most Linux distribution ships GStreamer. You can with GStreamer read
>>> and display a raw YUV images (you need to know the specific format)
>>> using videoparse element.
>>>
>>>    gst-launch-1.0 filesrc location=my.yuv ! videoparse format=yuy2 width=320 height=240 ! imagefreeze ! videoconvert ! autovideosink
>>>
>>> You could also encode and store to various formats, replacing the
>>> imagefreeze ... section with an encoder and a filesink. Note that
>>> videoparse unfortunatly does not allow passing strides array or
>>> offsets. So it will work only if you set the width/height to padded
>>> width/height.
>>>
>>> regards,
>>> Nicolas
>>
>> Hi Nicolas,
>>
>> Thank you for the comment.
>> As someone expreinced with v4l2 device driver, do you recommened using
>> debugging technique such as qemu (or kgdb) or do you rather use plain
>> printing ?
>>
>> Thank you very much,
>> Ran
>
>
> You can get several level of logs.
> First, you can enable v4l2 core debug logs. Example:
>   echo 3 > /sys/class/video4linux/video0/debug
> More details:
> https://www.kernel.org/doc/Documentation/video4linux/v4l2-framework.txt
>
> If the tested driver uses the v4l2_mem2mem framework you can get M2M
> logs with:
>   echo Y > /sys/module/v4l2_mem2mem/parameters/debug
>
> Get also internal vb2 logs with:
>   echo 3 > /sys/module/videobuf2_core/parameters/debug
>
> And optionally more logs using the dynamic debug feature:
> (https://www.kernel.org/doc/Documentation/dynamic-debug-howto.txt). Example:
>   echo "module my_driver +p" > /sys/kernel/debug/dynamic_debug/control
>
> Fabien

Thank you very much for the helpful ideas.

Regards,
Ran

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-12-12 11:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-05 22:00 v4l2 kernel module debugging methods Ran Shalit
2015-12-06  0:23 ` Nicolas Dufresne
2015-12-10 21:46   ` Ran Shalit
2015-12-11  0:22     ` Nicolas Dufresne
2015-12-11  8:50     ` Fabien DESSENNE
2015-12-12 11:40       ` Ran Shalit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).