Discussion:
CODA960: Fails to allocate memory
(too old to reply)
Jean-Michel Hautbois
2014-10-21 13:16:31 UTC
Permalink
Raw Message
Hi,

I am trying to use the CODA960 driver on a 3.18 kernel.
It seems pretty good when the module is probed (appart from the
unsupported firmware version) but when I try using the encoder, it
fails allocating dma buffers.

Here is the DT part I added :
&vpu {
compatible = "fsl,imx6q-vpu";
clocks = <&clks 168>, <&clks 140>, <&clks 142>;
clock-names = "per", "ahb", "ocram";
iramsize = <0x21000>;
iram = <&ocram>;
resets = <&src 1>;
status = "okay";
};

When booting, I see :
[ 4.410645] coda 2040000.vpu: Firmware code revision: 46056
[ 4.416312] coda 2040000.vpu: Initialized CODA960.
[ 4.421123] coda 2040000.vpu: Unsupported firmware version: 3.1.1
[ 4.483577] coda 2040000.vpu: codec registered as /dev/video[0-1]

I can start v4l2-ctl and it shows that the device seems to be ok :
v4l2-ctl --all -d /dev/video1
Driver Info (not using libv4l2):
Driver name : coda
Card type : CODA960
Bus info : platform:coda
Driver version: 3.18.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Priority: 2
Format Video Capture:
Width/Height : 1920/1088
Pixel Format : 'YU12'
Field : None
Bytes per Line: 1920
Size Image : 3133440
Colorspace : HDTV and modern devices (ITU709)
Flags :
Format Video Output:
Width/Height : 1920/1088
Pixel Format : 'H264'
Field : None
Bytes per Line: 0
Size Image : 1048576
Colorspace : HDTV and modern devices (ITU709)
Flags :
Selection: compose, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_default, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_bounds, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_padded, Left 0, Top 0, Width 1920, Height 1088
Selection: crop, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1088

User Controls

horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0

Codec Controls

video_gop_size (int) : min=1 max=60 step=1
default=16 value=16
video_bitrate (int) : min=0 max=32767000 step=1
default=0 value=0
number_of_intra_refresh_mbs (int) : min=0 max=8160 step=1
default=0 value=0
sequence_header_mode (menu) : min=0 max=1 default=1 value=1
maximum_bytes_in_a_slice (int) : min=1 max=1073741823 step=1
default=500 value=500
number_of_mbs_in_a_slice (int) : min=1 max=1073741823 step=1
default=1 value=1
slice_partitioning_method (menu) : min=0 max=2 default=0 value=0
h264_i_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_p_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_maximum_qp_value (int) : min=0 max=51 step=1
default=51 value=51
h264_loop_filter_alpha_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_beta_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_mode (menu) : min=0 max=1 default=0 value=0
mpeg4_i_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
mpeg4_p_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0




But when I try to get a file outputed, it fails :

v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 1197.292256] coda 2040000.vpu: dma_alloc_coherent of size 1048576 failed
VIDIOC_REQBUFS: failed: Cannot allocate memory

Did I forget to do something ?
Thanks,
JM
Hans Verkuil
2014-10-21 13:27:16 UTC
Permalink
Raw Message
Post by Jean-Michel Hautbois
Hi,
I am trying to use the CODA960 driver on a 3.18 kernel.
It seems pretty good when the module is probed (appart from the
unsupported firmware version) but when I try using the encoder, it
fails allocating dma buffers.
&vpu {
compatible = "fsl,imx6q-vpu";
clocks = <&clks 168>, <&clks 140>, <&clks 142>;
clock-names = "per", "ahb", "ocram";
iramsize = <0x21000>;
iram = <&ocram>;
resets = <&src 1>;
status = "okay";
};
[ 4.410645] coda 2040000.vpu: Firmware code revision: 46056
[ 4.416312] coda 2040000.vpu: Initialized CODA960.
[ 4.421123] coda 2040000.vpu: Unsupported firmware version: 3.1.1
[ 4.483577] coda 2040000.vpu: codec registered as /dev/video[0-1]
v4l2-ctl --all -d /dev/video1
Driver name : coda
Card type : CODA960
Bus info : platform:coda
Driver version: 3.18.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Priority: 2
Width/Height : 1920/1088
Pixel Format : 'YU12'
Field : None
Bytes per Line: 1920
Size Image : 3133440
Colorspace : HDTV and modern devices (ITU709)
Width/Height : 1920/1088
Pixel Format : 'H264'
Field : None
Bytes per Line: 0
Size Image : 1048576
Colorspace : HDTV and modern devices (ITU709)
Selection: compose, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_default, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_bounds, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_padded, Left 0, Top 0, Width 1920, Height 1088
Selection: crop, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1088
User Controls
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
Codec Controls
video_gop_size (int) : min=1 max=60 step=1
default=16 value=16
video_bitrate (int) : min=0 max=32767000 step=1
default=0 value=0
number_of_intra_refresh_mbs (int) : min=0 max=8160 step=1
default=0 value=0
sequence_header_mode (menu) : min=0 max=1 default=1 value=1
maximum_bytes_in_a_slice (int) : min=1 max=1073741823 step=1
default=500 value=500
number_of_mbs_in_a_slice (int) : min=1 max=1073741823 step=1
default=1 value=1
slice_partitioning_method (menu) : min=0 max=2 default=0 value=0
h264_i_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_p_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_maximum_qp_value (int) : min=0 max=51 step=1
default=51 value=51
h264_loop_filter_alpha_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_beta_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_mode (menu) : min=0 max=1 default=0 value=0
mpeg4_i_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
mpeg4_p_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 1197.292256] coda 2040000.vpu: dma_alloc_coherent of size 1048576 failed
VIDIOC_REQBUFS: failed: Cannot allocate memory
Did I forget to do something ?
I assume this is physically contiguous memory. Do you have that much phys. cont. memory
available at all? If the memory is fragmented you won't be able to get it.

Use cma (contiguous memory allocator). You probably have to do very little expect add
a kernel option to assign enough memory for these buffers.

Regards,

Hans
Jean-Michel Hautbois
2014-10-21 13:42:39 UTC
Permalink
Raw Message
Hi Hans,
Post by Hans Verkuil
Post by Jean-Michel Hautbois
Hi,
I am trying to use the CODA960 driver on a 3.18 kernel.
It seems pretty good when the module is probed (appart from the
unsupported firmware version) but when I try using the encoder, it
fails allocating dma buffers.
&vpu {
compatible = "fsl,imx6q-vpu";
clocks = <&clks 168>, <&clks 140>, <&clks 142>;
clock-names = "per", "ahb", "ocram";
iramsize = <0x21000>;
iram = <&ocram>;
resets = <&src 1>;
status = "okay";
};
[ 4.410645] coda 2040000.vpu: Firmware code revision: 46056
[ 4.416312] coda 2040000.vpu: Initialized CODA960.
[ 4.421123] coda 2040000.vpu: Unsupported firmware version: 3.1.1
[ 4.483577] coda 2040000.vpu: codec registered as /dev/video[0-1]
v4l2-ctl --all -d /dev/video1
Driver name : coda
Card type : CODA960
Bus info : platform:coda
Driver version: 3.18.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Priority: 2
Width/Height : 1920/1088
Pixel Format : 'YU12'
Field : None
Bytes per Line: 1920
Size Image : 3133440
Colorspace : HDTV and modern devices (ITU709)
Width/Height : 1920/1088
Pixel Format : 'H264'
Field : None
Bytes per Line: 0
Size Image : 1048576
Colorspace : HDTV and modern devices (ITU709)
Selection: compose, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_default, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_bounds, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_padded, Left 0, Top 0, Width 1920, Height 1088
Selection: crop, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1088
User Controls
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
Codec Controls
video_gop_size (int) : min=1 max=60 step=1
default=16 value=16
video_bitrate (int) : min=0 max=32767000 step=1
default=0 value=0
number_of_intra_refresh_mbs (int) : min=0 max=8160 step=1
default=0 value=0
sequence_header_mode (menu) : min=0 max=1 default=1 value=1
maximum_bytes_in_a_slice (int) : min=1 max=1073741823 step=1
default=500 value=500
number_of_mbs_in_a_slice (int) : min=1 max=1073741823 step=1
default=1 value=1
slice_partitioning_method (menu) : min=0 max=2 default=0 value=0
h264_i_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_p_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_maximum_qp_value (int) : min=0 max=51 step=1
default=51 value=51
h264_loop_filter_alpha_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_beta_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_mode (menu) : min=0 max=1 default=0 value=0
mpeg4_i_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
mpeg4_p_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 1197.292256] coda 2040000.vpu: dma_alloc_coherent of size 1048576 failed
VIDIOC_REQBUFS: failed: Cannot allocate memory
Did I forget to do something ?
I assume this is physically contiguous memory. Do you have that much phys. cont. memory
available at all? If the memory is fragmented you won't be able to get it.
Use cma (contiguous memory allocator). You probably have to do very little expect add
a kernel option to assign enough memory for these buffers.
I added a cma=128M in order to reserve some meory, and it fails...
well, differently :).

~# v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 56.372023] alloc_contig_range test_pages_isolated(48400, 486fd) failed
[ 56.459627] ------------[ cut here ]------------
[ 56.464273] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
[ 56.474750] Modules linked in: snd_soc_sgtl5000 coda v4l2_mem2mem
[ 56.480920] CPU: 1 PID: 838 Comm: v4l2-ctl Not tainted
3.18.0-rc1+yocto+gc943ff8 #1
[ 56.488597] Backtrace:
[ 56.491085] [<800130c0>] (dump_backtrace) from [<800133a0>]
(show_stack+0x18/0x1c)
[ 56.498677] r6:80ace2cc r5:00000000 r4:00000000 r3:00000000
[ 56.504422] [<80013388>] (show_stack) from [<806cf624>]
(dump_stack+0x8c/0xa4)
[ 56.511680] [<806cf598>] (dump_stack) from [<8002b870>]
(warn_slowpath_common+0x70/0x94)
[ 56.519807] r6:804c9554 r5:00000009 r4:00000000 r3:00000000
[ 56.525563] [<8002b800>] (warn_slowpath_common) from [<8002b938>]
(warn_slowpath_null+0x24/0x2c)
[ 56.534351] r8:00000000 r7:b6a305e0 r6:b6a305e0 r5:b6a31800 r4:b56cb800
[ 56.541166] [<8002b914>] (warn_slowpath_null) from [<804c9554>]
(vb2_buffer_done+0x120/0x158)
[ 56.549732] [<804c9434>] (vb2_buffer_done) from [<7f009efc>]
(coda_start_streaming+0x100/0x1b0 [coda])
[ 56.559058] r8:00000012 r7:b56cbb18 r6:b6a305e0 r5:ffffffea
r4:b56cb800 r3:00000002
[ 56.566913] [<7f009dfc>] (coda_start_streaming [coda]) from
[<804c95f0>] (vb2_start_streaming+0x64/0x160)
[ 56.576498] r7:b729a420 r6:b6a305e0 r5:b6a306e0 r4:b6a304b0
[ 56.582237] [<804c958c>] (vb2_start_streaming) from [<804cb9cc>]
(vb2_internal_streamon+0xf4/0x150)
[ 56.591312] r7:b729a420 r6:40045612 r5:b6a30400 r4:b6a305e0
[ 56.597072] [<804cb8d8>] (vb2_internal_streamon) from [<804cba5c>]
(vb2_streamon+0x34/0x58)
[ 56.605442] r5:b6a30400 r4:00000002
[ 56.609074] [<804cba28>] (vb2_streamon) from [<7f0007d4>]
(v4l2_m2m_streamon+0x28/0x40 [v4l2_mem2mem])
[ 56.618417] [<7f0007ac>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f000804>] (v4l2_m2m_ioctl_streamon+0x18/0x1c [v4l2_mem2mem])
[ 56.630003] r5:00000001 r4:b56cb9d8
[ 56.633631] [<7f0007ec>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<804b5214>] (v4l_streamon+0x20/0x24)
[ 56.643487] [<804b51f4>] (v4l_streamon) from [<804b7c5c>]
(__video_do_ioctl+0x280/0x2fc)
[ 56.651610] [<804b79dc>] (__video_do_ioctl) from [<804b7690>]
(video_usercopy+0x168/0x498)
[ 56.659895] r10:804b79dc r9:7e8655b4 r8:b638d780 r7:00000000
r6:b61a1e18 r5:00000004
[ 56.667825] r4:40045612
[ 56.670388] [<804b7528>] (video_usercopy) from [<804b79d4>]
(video_ioctl2+0x14/0x1c)
[ 56.678149] r10:00000000 r9:b61a0000 r8:b729a80c r7:b638d780
r6:7e8655b4 r5:40045612
[ 56.686077] r4:b729a420
[ 56.688638] [<804b79c0>] (video_ioctl2) from [<804b3b8c>]
(v4l2_ioctl+0x14c/0x174)
[ 56.696240] [<804b3a40>] (v4l2_ioctl) from [<8010a6a4>]
(do_vfs_ioctl+0x408/0x664)
[ 56.703819] r8:00000003 r7:8010a93c r6:b638d780 r5:7e8655b4
r4:b698cf90 r3:804b3a40
[ 56.711689] [<8010a29c>] (do_vfs_ioctl) from [<8010a93c>]
(SyS_ioctl+0x3c/0x64)
[ 56.719018] r10:00000000 r9:b61a0000 r8:00000003 r7:40045612
r6:b638d780 r5:7e8655b4
[ 56.726949] r4:b638d780
[ 56.729513] [<8010a900>] (SyS_ioctl) from [<8000f740>]
(ret_fast_syscall+0x0/0x48)
[ 56.737104] r8:8000f904 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e8619c8 r3:00000000
[ 56.744946] ---[ end trace efcf1fd10e10c970 ]---
[ 56.749753] ------------[ cut here ]------------
[ 56.754389] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
[ 56.764849] Modules linked in: snd_soc_sgtl5000 coda v4l2_mem2mem
[ 56.771021] CPU: 1 PID: 838 Comm: v4l2-ctl Tainted: G W
3.18.0-rc1+yocto+gc943ff8 #1
[ 56.779834] Backtrace:
[ 56.782318] [<800130c0>] (dump_backtrace) from [<800133a0>]
(show_stack+0x18/0x1c)
[ 56.789912] r6:80ace2cc r5:00000000 r4:00000000 r3:00000000
[ 56.795665] [<80013388>] (show_stack) from [<806cf624>]
(dump_stack+0x8c/0xa4)
[ 56.802905] [<806cf598>] (dump_stack) from [<8002b870>]
(warn_slowpath_common+0x70/0x94)
[ 56.811016] r6:804c9554 r5:00000009 r4:00000000 r3:00000000
[ 56.816768] [<8002b800>] (warn_slowpath_common) from [<8002b938>]
(warn_slowpath_null+0x24/0x2c)
[ 56.825572] r8:00000000 r7:b6a305e0 r6:b6a305e0 r5:b54d9800 r4:b56cb800
[ 56.832370] [<8002b914>] (warn_slowpath_null) from [<804c9554>]
(vb2_buffer_done+0x120/0x158)
[ 56.840934] [<804c9434>] (vb2_buffer_done) from [<7f009efc>]
(coda_start_streaming+0x100/0x1b0 [coda])
[ 56.850263] r8:00000012 r7:b56cbb18 r6:b6a305e0 r5:ffffffea
r4:b56cb800 r3:00000002
[ 56.858123] [<7f009dfc>] (coda_start_streaming [coda]) from
[<804c95f0>] (vb2_start_streaming+0x64/0x160)
[ 56.867708] r7:b729a420 r6:b6a305e0 r5:b6a306e0 r4:b6a304b0
[ 56.873445] [<804c958c>] (vb2_start_streaming) from [<804cb9cc>]
(vb2_internal_streamon+0xf4/0x150)
[ 56.882511] r7:b729a420 r6:40045612 r5:b6a30400 r4:b6a305e0
[ 56.888261] [<804cb8d8>] (vb2_internal_streamon) from [<804cba5c>]
(vb2_streamon+0x34/0x58)
[ 56.896629] r5:b6a30400 r4:00000002
[ 56.900261] [<804cba28>] (vb2_streamon) from [<7f0007d4>]
(v4l2_m2m_streamon+0x28/0x40 [v4l2_mem2mem])
[ 56.909606] [<7f0007ac>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f000804>] (v4l2_m2m_ioctl_streamon+0x18/0x1c [v4l2_mem2mem])
[ 56.921189] r5:00000001 r4:b56cb9d8
[ 56.924830] [<7f0007ec>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<804b5214>] (v4l_streamon+0x20/0x24)
[ 56.934676] [<804b51f4>] (v4l_streamon) from [<804b7c5c>]
(__video_do_ioctl+0x280/0x2fc)
[ 56.942797] [<804b79dc>] (__video_do_ioctl) from [<804b7690>]
(video_usercopy+0x168/0x498)
[ 56.951077] r10:804b79dc r9:7e8655b4 r8:b638d780 r7:00000000
r6:b61a1e18 r5:00000004
[ 56.959015] r4:40045612
[ 56.961574] [<804b7528>] (video_usercopy) from [<804b79d4>]
(video_ioctl2+0x14/0x1c)
[ 56.969337] r10:00000000 r9:b61a0000 r8:b729a80c r7:b638d780
r6:7e8655b4 r5:40045612
[ 56.977266] r4:b729a420
[ 56.979829] [<804b79c0>] (video_ioctl2) from [<804b3b8c>]
(v4l2_ioctl+0x14c/0x174)
[ 56.987432] [<804b3a40>] (v4l2_ioctl) from [<8010a6a4>]
(do_vfs_ioctl+0x408/0x664)
[ 56.995024] r8:00000003 r7:8010a93c r6:b638d780 r5:7e8655b4
r4:b698cf90 r3:804b3a40
[ 57.002860] [<8010a29c>] (do_vfs_ioctl) from [<8010a93c>]
(SyS_ioctl+0x3c/0x64)
[ 57.010187] r10:00000000 r9:b61a0000 r8:00000003 r7:40045612
r6:b638d780 r5:7e8655b4
[ 57.018121] r4:b638d780
[ 57.020685] [<8010a900>] (SyS_ioctl) from [<8000f740>]
(ret_fast_syscall+0x0/0x48)
[ 57.028273] r8:8000f904 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e8619c8 r3:00000000
[ 57.036142] ---[ end trace efcf1fd10e10c971 ]---
[ 57.040770] ------------[ cut here ]------------
[ 57.045418] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
[ 57.055873] Modules linked in: snd_soc_sgtl5000 coda v4l2_mem2mem
[ 57.062041] CPU: 1 PID: 838 Comm: v4l2-ctl Tainted: G W
3.18.0-rc1+yocto+gc943ff8 #1
[ 57.070844] Backtrace:
[ 57.073323] [<800130c0>] (dump_backtrace) from [<800133a0>]
(show_stack+0x18/0x1c)
[ 57.080912] r6:80ace2cc r5:00000000 r4:00000000 r3:00000000
[ 57.086664] [<80013388>] (show_stack) from [<806cf624>]
(dump_stack+0x8c/0xa4)
[ 57.093903] [<806cf598>] (dump_stack) from [<8002b870>]
(warn_slowpath_common+0x70/0x94)
[ 57.102014] r6:804c9554 r5:00000009 r4:00000000 r3:00000000
[ 57.107762] [<8002b800>] (warn_slowpath_common) from [<8002b938>]
(warn_slowpath_null+0x24/0x2c)
[ 57.116564] r8:00000000 r7:b6a305e0 r6:b6a305e0 r5:b54d8c00 r4:b56cb800
[ 57.123360] [<8002b914>] (warn_slowpath_null) from [<804c9554>]
(vb2_buffer_done+0x120/0x158)
[ 57.131920] [<804c9434>] (vb2_buffer_done) from [<7f009efc>]
(coda_start_streaming+0x100/0x1b0 [coda])
[ 57.141250] r8:00000012 r7:b56cbb18 r6:b6a305e0 r5:ffffffea
r4:b56cb800 r3:00000002
[ 57.149126] [<7f009dfc>] (coda_start_streaming [coda]) from
[<804c95f0>] (vb2_start_streaming+0x64/0x160)
[ 57.158716] r7:b729a420 r6:b6a305e0 r5:b6a306e0 r4:b6a304b0
[ 57.164459] [<804c958c>] (vb2_start_streaming) from [<804cb9cc>]
(vb2_internal_streamon+0xf4/0x150)
[ 57.173529] r7:b729a420 r6:40045612 r5:b6a30400 r4:b6a305e0
[ 57.179280] [<804cb8d8>] (vb2_internal_streamon) from [<804cba5c>]
(vb2_streamon+0x34/0x58)
[ 57.187654] r5:b6a30400 r4:00000002
[ 57.191288] [<804cba28>] (vb2_streamon) from [<7f0007d4>]
(v4l2_m2m_streamon+0x28/0x40 [v4l2_mem2mem])
[ 57.200631] [<7f0007ac>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f000804>] (v4l2_m2m_ioctl_streamon+0x18/0x1c [v4l2_mem2mem])
[ 57.212224] r5:00000001 r4:b56cb9d8
[ 57.215870] [<7f0007ec>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<804b5214>] (v4l_streamon+0x20/0x24)
[ 57.225728] [<804b51f4>] (v4l_streamon) from [<804b7c5c>]
(__video_do_ioctl+0x280/0x2fc)
[ 57.233836] [<804b79dc>] (__video_do_ioctl) from [<804b7690>]
(video_usercopy+0x168/0x498)
[ 57.242119] r10:804b79dc r9:7e8655b4 r8:b638d780 r7:00000000
r6:b61a1e18 r5:00000004
[ 57.250047] r4:40045612
[ 57.252609] [<804b7528>] (video_usercopy) from [<804b79d4>]
(video_ioctl2+0x14/0x1c)
[ 57.260371] r10:00000000 r9:b61a0000 r8:b729a80c r7:b638d780
r6:7e8655b4 r5:40045612
[ 57.268306] r4:b729a420
[ 57.270866] [<804b79c0>] (video_ioctl2) from [<804b3b8c>]
(v4l2_ioctl+0x14c/0x174)
[ 57.278468] [<804b3a40>] (v4l2_ioctl) from [<8010a6a4>]
(do_vfs_ioctl+0x408/0x664)
[ 57.286054] r8:00000003 r7:8010a93c r6:b638d780 r5:7e8655b4
r4:b698cf90 r3:804b3a40
[ 57.293892] [<8010a29c>] (do_vfs_ioctl) from [<8010a93c>]
(SyS_ioctl+0x3c/0x64)
[ 57.301225] r10:00000000 r9:b61a0000 r8:00000003 r7:40045612
r6:b638d780 r5:7e8655b4
[ 57.309164] r4:b638d780
[ 57.311730] [<8010a900>] (SyS_ioctl) from [<8000f740>]
(ret_fast_syscall+0x0/0x48)
[ 57.319320] r8:8000f904 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e8619c8 r3:00000000
[ 57.327166] ---[ end trace efcf1fd10e10c972 ]---
[ 57.331795] ------------[ cut here ]------------
[ 57.336443] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
[ 57.346899] Modules linked in: snd_soc_sgtl5000 coda v4l2_mem2mem
[ 57.353070] CPU: 1 PID: 838 Comm: v4l2-ctl Tainted: G W
3.18.0-rc1+yocto+gc943ff8 #1
[ 57.361874] Backtrace:
[ 57.364356] [<800130c0>] (dump_backtrace) from [<800133a0>]
(show_stack+0x18/0x1c)
[ 57.371945] r6:80ace2cc r5:00000000 r4:00000000 r3:00000000
[ 57.377705] [<80013388>] (show_stack) from [<806cf624>]
(dump_stack+0x8c/0xa4)
[ 57.384965] [<806cf598>] (dump_stack) from [<8002b870>]
(warn_slowpath_common+0x70/0x94)
[ 57.393066] r6:804c9554 r5:00000009 r4:00000000 r3:00000000
[ 57.398818] [<8002b800>] (warn_slowpath_common) from [<8002b938>]
(warn_slowpath_null+0x24/0x2c)
[ 57.407622] r8:00000000 r7:b6a305e0 r6:b6a305e0 r5:b54db400 r4:b56cb800
[ 57.414419] [<8002b914>] (warn_slowpath_null) from [<804c9554>]
(vb2_buffer_done+0x120/0x158)
[ 57.422985] [<804c9434>] (vb2_buffer_done) from [<7f009efc>]
(coda_start_streaming+0x100/0x1b0 [coda])
[ 57.432318] r8:00000012 r7:b56cbb18 r6:b6a305e0 r5:ffffffea
r4:b56cb800 r3:00000002
[ 57.440179] [<7f009dfc>] (coda_start_streaming [coda]) from
[<804c95f0>] (vb2_start_streaming+0x64/0x160)
[ 57.449765] r7:b729a420 r6:b6a305e0 r5:b6a306e0 r4:b6a304b0
[ 57.455519] [<804c958c>] (vb2_start_streaming) from [<804cb9cc>]
(vb2_internal_streamon+0xf4/0x150)
[ 57.464568] r7:b729a420 r6:40045612 r5:b6a30400 r4:b6a305e0
[ 57.470325] [<804cb8d8>] (vb2_internal_streamon) from [<804cba5c>]
(vb2_streamon+0x34/0x58)
[ 57.478697] r5:b6a30400 r4:00000002
[ 57.482328] [<804cba28>] (vb2_streamon) from [<7f0007d4>]
(v4l2_m2m_streamon+0x28/0x40 [v4l2_mem2mem])
[ 57.491669] [<7f0007ac>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f000804>] (v4l2_m2m_ioctl_streamon+0x18/0x1c [v4l2_mem2mem])
[ 57.503257] r5:00000001 r4:b56cb9d8
[ 57.506898] [<7f0007ec>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<804b5214>] (v4l_streamon+0x20/0x24)
[ 57.516754] [<804b51f4>] (v4l_streamon) from [<804b7c5c>]
(__video_do_ioctl+0x280/0x2fc)
[ 57.524876] [<804b79dc>] (__video_do_ioctl) from [<804b7690>]
(video_usercopy+0x168/0x498)
[ 57.533146] r10:804b79dc r9:7e8655b4 r8:b638d780 r7:00000000
r6:b61a1e18 r5:00000004
[ 57.541078] r4:40045612
[ 57.543637] [<804b7528>] (video_usercopy) from [<804b79d4>]
(video_ioctl2+0x14/0x1c)
[ 57.551398] r10:00000000 r9:b61a0000 r8:b729a80c r7:b638d780
r6:7e8655b4 r5:40045612
[ 57.559333] r4:b729a420
[ 57.561894] [<804b79c0>] (video_ioctl2) from [<804b3b8c>]
(v4l2_ioctl+0x14c/0x174)
[ 57.569495] [<804b3a40>] (v4l2_ioctl) from [<8010a6a4>]
(do_vfs_ioctl+0x408/0x664)
[ 57.577084] r8:00000003 r7:8010a93c r6:b638d780 r5:7e8655b4
r4:b698cf90 r3:804b3a40
[ 57.584939] [<8010a29c>] (do_vfs_ioctl) from [<8010a93c>]
(SyS_ioctl+0x3c/0x64)
[ 57.592258] r10:00000000 r9:b61a0000 r8:00000003 r7:40045612
r6:b638d780 r5:7e8655b4
[ 57.600192] r4:b638d780
[ 57.602758] [<8010a900>] (SyS_ioctl) from [<8000f740>]
(ret_fast_syscall+0x0/0x48)
[ 57.610346] r8:8000f904 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e8619c8 r3:00000000
[ 57.618191] ---[ end trace efcf1fd10e10c973 ]---
[ 57.622820] ------------[ cut here ]------------
[ 57.627467] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1781
vb2_start_streaming+0xc0/0x160()
[ 57.638184] Modules linked in: snd_soc_sgtl5000 coda v4l2_mem2mem
[ 57.644355] CPU: 1 PID: 838 Comm: v4l2-ctl Tainted: G W
3.18.0-rc1+yocto+gc943ff8 #1
[ 57.653159] Backtrace:
[ 57.655650] [<800130c0>] (dump_backtrace) from [<800133a0>]
(show_stack+0x18/0x1c)
[ 57.663222] r6:80ace2cc r5:00000000 r4:00000000 r3:00000000
[ 57.668979] [<80013388>] (show_stack) from [<806cf624>]
(dump_stack+0x8c/0xa4)
[ 57.676233] [<806cf598>] (dump_stack) from [<8002b870>]
(warn_slowpath_common+0x70/0x94)
[ 57.684333] r6:804c964c r5:00000009 r4:00000000 r3:00000000
[ 57.690097] [<8002b800>] (warn_slowpath_common) from [<8002b938>]
(warn_slowpath_null+0x24/0x2c)
[ 57.698901] r8:00000012 r7:ffffffea r6:b6a306f0 r5:b6a306e0 r4:b6a304b0
[ 57.705715] [<8002b914>] (warn_slowpath_null) from [<804c964c>]
(vb2_start_streaming+0xc0/0x160)
[ 57.714513] [<804c958c>] (vb2_start_streaming) from [<804cb9cc>]
(vb2_internal_streamon+0xf4/0x150)
[ 57.723578] r7:b729a420 r6:40045612 r5:b6a30400 r4:b6a305e0
[ 57.729325] [<804cb8d8>] (vb2_internal_streamon) from [<804cba5c>]
(vb2_streamon+0x34/0x58)
[ 57.737694] r5:b6a30400 r4:00000002
[ 57.741321] [<804cba28>] (vb2_streamon) from [<7f0007d4>]
(v4l2_m2m_streamon+0x28/0x40 [v4l2_mem2mem])
[ 57.750660] [<7f0007ac>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f000804>] (v4l2_m2m_ioctl_streamon+0x18/0x1c [v4l2_mem2mem])
[ 57.762244] r5:00000001 r4:b56cb9d8
[ 57.765886] [<7f0007ec>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<804b5214>] (v4l_streamon+0x20/0x24)
[ 57.775741] [<804b51f4>] (v4l_streamon) from [<804b7c5c>]
(__video_do_ioctl+0x280/0x2fc)
[ 57.783844] [<804b79dc>] (__video_do_ioctl) from [<804b7690>]
(video_usercopy+0x168/0x498)
[ 57.792131] r10:804b79dc r9:7e8655b4 r8:b638d780 r7:00000000
r6:b61a1e18 r5:00000004
[ 57.800060] r4:40045612
[ 57.802621] [<804b7528>] (video_usercopy) from [<804b79d4>]
(video_ioctl2+0x14/0x1c)
[ 57.810384] r10:00000000 r9:b61a0000 r8:b729a80c r7:b638d780
r6:7e8655b4 r5:40045612
[ 57.818316] r4:b729a420
[ 57.820876] [<804b79c0>] (video_ioctl2) from [<804b3b8c>]
(v4l2_ioctl+0x14c/0x174)
[ 57.828473] [<804b3a40>] (v4l2_ioctl) from [<8010a6a4>]
(do_vfs_ioctl+0x408/0x664)
[ 57.836063] r8:00000003 r7:8010a93c r6:b638d780 r5:7e8655b4
r4:b698cf90 r3:804b3a40
[ 57.843898] [<8010a29c>] (do_vfs_ioctl) from [<8010a93c>]
(SyS_ioctl+0x3c/0x64)
[ 57.851227] r10:00000000 r9:b61a0000 r8:00000003 r7:40045612
r6:b638d780 r5:7e8655b4
[ 57.859160] r4:b638d780
[ 57.861723] [<8010a900>] (SyS_ioctl) from [<8000f740>]
(ret_fast_syscall+0x0/0x48)
[ 57.869312] r8:8000f904 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e8619c8 r3:00000000
[ 57.877155] ---[ end trace efcf1fd10e10c974 ]---
VIDIOC_STREAMON: failed: Invalid argument

JM
Hans Verkuil
2014-10-21 13:49:37 UTC
Permalink
Raw Message
Post by Jean-Michel Hautbois
Hi Hans,
Post by Hans Verkuil
Post by Jean-Michel Hautbois
Hi,
I am trying to use the CODA960 driver on a 3.18 kernel.
It seems pretty good when the module is probed (appart from the
unsupported firmware version) but when I try using the encoder, it
fails allocating dma buffers.
&vpu {
compatible = "fsl,imx6q-vpu";
clocks = <&clks 168>, <&clks 140>, <&clks 142>;
clock-names = "per", "ahb", "ocram";
iramsize = <0x21000>;
iram = <&ocram>;
resets = <&src 1>;
status = "okay";
};
[ 4.410645] coda 2040000.vpu: Firmware code revision: 46056
[ 4.416312] coda 2040000.vpu: Initialized CODA960.
[ 4.421123] coda 2040000.vpu: Unsupported firmware version: 3.1.1
[ 4.483577] coda 2040000.vpu: codec registered as /dev/video[0-1]
v4l2-ctl --all -d /dev/video1
Driver name : coda
Card type : CODA960
Bus info : platform:coda
Driver version: 3.18.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Priority: 2
Width/Height : 1920/1088
Pixel Format : 'YU12'
Field : None
Bytes per Line: 1920
Size Image : 3133440
Colorspace : HDTV and modern devices (ITU709)
Width/Height : 1920/1088
Pixel Format : 'H264'
Field : None
Bytes per Line: 0
Size Image : 1048576
Colorspace : HDTV and modern devices (ITU709)
Selection: compose, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_default, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_bounds, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_padded, Left 0, Top 0, Width 1920, Height 1088
Selection: crop, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1088
User Controls
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
Codec Controls
video_gop_size (int) : min=1 max=60 step=1
default=16 value=16
video_bitrate (int) : min=0 max=32767000 step=1
default=0 value=0
number_of_intra_refresh_mbs (int) : min=0 max=8160 step=1
default=0 value=0
sequence_header_mode (menu) : min=0 max=1 default=1 value=1
maximum_bytes_in_a_slice (int) : min=1 max=1073741823 step=1
default=500 value=500
number_of_mbs_in_a_slice (int) : min=1 max=1073741823 step=1
default=1 value=1
slice_partitioning_method (menu) : min=0 max=2 default=0 value=0
h264_i_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_p_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_maximum_qp_value (int) : min=0 max=51 step=1
default=51 value=51
h264_loop_filter_alpha_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_beta_offset (int) : min=0 max=15 step=1 default=0 value=0
h264_loop_filter_mode (menu) : min=0 max=1 default=0 value=0
mpeg4_i_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
mpeg4_p_frame_qp_value (int) : min=1 max=31 step=1 default=2 value=2
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 1197.292256] coda 2040000.vpu: dma_alloc_coherent of size 1048576 failed
VIDIOC_REQBUFS: failed: Cannot allocate memory
Did I forget to do something ?
I assume this is physically contiguous memory. Do you have that much phys. cont. memory
available at all? If the memory is fragmented you won't be able to get it.
Use cma (contiguous memory allocator). You probably have to do very little expect add
a kernel option to assign enough memory for these buffers.
I added a cma=128M in order to reserve some meory, and it fails...
well, differently :).
~# v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 56.372023] alloc_contig_range test_pages_isolated(48400, 486fd) failed
[ 56.459627] ------------[ cut here ]------------
[ 56.464273] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
That looks like a driver bug. You are returning buffers in coda_start_streaming
with a wrong state. Check the WARN_ON at that line.

Regards,

Hans
Jean-Michel Hautbois
2014-10-21 15:39:30 UTC
Permalink
Raw Message
Post by Hans Verkuil
Post by Jean-Michel Hautbois
Hi Hans,
Post by Hans Verkuil
Post by Jean-Michel Hautbois
Hi,
I am trying to use the CODA960 driver on a 3.18 kernel.
It seems pretty good when the module is probed (appart from the
unsupported firmware version) but when I try using the encoder, it
fails allocating dma buffers.
&vpu {
compatible = "fsl,imx6q-vpu";
clocks = <&clks 168>, <&clks 140>, <&clks 142>;
clock-names = "per", "ahb", "ocram";
iramsize = <0x21000>;
iram = <&ocram>;
resets = <&src 1>;
status = "okay";
};
[ 4.410645] coda 2040000.vpu: Firmware code revision: 46056
[ 4.416312] coda 2040000.vpu: Initialized CODA960.
[ 4.421123] coda 2040000.vpu: Unsupported firmware version: 3.1.1
[ 4.483577] coda 2040000.vpu: codec registered as /dev/video[0-1]
v4l2-ctl --all -d /dev/video1
Driver name : coda
Card type : CODA960
Bus info : platform:coda
Driver version: 3.18.0
Capabilities : 0x84208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04208000
Video Memory-to-Memory
Streaming
Extended Pix Format
Priority: 2
Width/Height : 1920/1088
Pixel Format : 'YU12'
Field : None
Bytes per Line: 1920
Size Image : 3133440
Colorspace : HDTV and modern devices (ITU709)
Width/Height : 1920/1088
Pixel Format : 'H264'
Field : None
Bytes per Line: 0
Size Image : 1048576
Colorspace : HDTV and modern devices (ITU709)
Selection: compose, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_default, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_bounds, Left 0, Top 0, Width 1920, Height 1088
Selection: compose_padded, Left 0, Top 0, Width 1920, Height 1088
Selection: crop, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1088
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1088
User Controls
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
Codec Controls
video_gop_size (int) : min=1 max=60 step=1
default=16 value=16
video_bitrate (int) : min=0 max=32767000 step=1
default=0 value=0
number_of_intra_refresh_mbs (int) : min=0 max=8160 step=1
default=0 value=0
sequence_header_mode (menu) : min=0 max=1 default=1 value=1
maximum_bytes_in_a_slice (int) : min=1 max=1073741823 step=1
default=500 value=500
number_of_mbs_in_a_slice (int) : min=1 max=1073741823 step=1
default=1 value=1
slice_partitioning_method (menu) : min=0 max=2 default=0 value=0
h264_i_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_p_frame_qp_value (int) : min=0 max=51 step=1
default=25 value=25
h264_maximum_qp_value (int) : min=0 max=51 step=1
default=51 value=51
h264_loop_filter_alpha_offset (int) : min=0 max=15 step=1
default=0
value=0
h264_loop_filter_beta_offset (int) : min=0 max=15 step=1
default=0
value=0
h264_loop_filter_mode (menu) : min=0 max=1 default=0 value=0
mpeg4_i_frame_qp_value (int) : min=1 max=31 step=1
default=2
value=2
mpeg4_p_frame_qp_value (int) : min=1 max=31 step=1
default=2
value=2
horizontal_flip (bool) : default=0 value=0
vertical_flip (bool) : default=0 value=0
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 1197.292256] coda 2040000.vpu: dma_alloc_coherent of size 1048576 failed
VIDIOC_REQBUFS: failed: Cannot allocate memory
Did I forget to do something ?
I assume this is physically contiguous memory. Do you have that much
phys.
cont. memory
available at all? If the memory is fragmented you won't be able to get it.
Use cma (contiguous memory allocator). You probably have to do very
little
expect add
a kernel option to assign enough memory for these buffers.
I added a cma=128M in order to reserve some meory, and it fails...
well, differently :).
~# v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 56.372023] alloc_contig_range test_pages_isolated(48400, 486fd) failed
[ 56.459627] ------------[ cut here ]------------
[ 56.464273] WARNING: CPU: 1 PID: 838 at
drivers/media/v4l2-core/videobuf2-core.c:1181
vb2_buffer_done+0x120/0x158()
That looks like a driver bug. You are returning buffers in
coda_start_streaming
with a wrong state. Check the WARN_ON at that line.
Regards,
Hans
I added some instrumentation, and modified the state returned from
VB2_BUF_STATE_DEQUEUED to VB2_BUF_STATE_QUEUED and it fails when
getting bitstream payload...

Here are the modifications :

diff --git a/drivers/media/platform/coda/coda-common.c
b/drivers/media/platform/coda/coda-common.c
index ced4760..b958668 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1033,17 +1033,21 @@ static int coda_start_streaming(struct
vb2_queue *q, unsigned int count)
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
if (q_data_src->fourcc == V4L2_PIX_FMT_H264) {
+ v4l2_err(v4l2_dev, "fill bitstream\n");
/* copy the buffers that where queued before streamon */
mutex_lock(&ctx->bitstream_mutex);
coda_fill_bitstream(ctx);
mutex_unlock(&ctx->bitstream_mutex);

if (coda_get_bitstream_payload(ctx) < 512) {
+ v4l2_err(v4l2_dev, "fill bitstream
payload : %d\n", coda_get_bitstream_payload(ctx));
ret = -EINVAL;
goto err;
}
} else {
+ v4l2_err(v4l2_dev, "Not H264 pix fmt\n");
if (count < 1) {
+ v4l2_err(v4l2_dev, "count: %d\n", count);
ret = -EINVAL;
goto err;
}
@@ -1051,7 +1055,9 @@ static int coda_start_streaming(struct vb2_queue
*q, unsigned int count)

ctx->streamon_out = 1;
} else {
+ v4l2_err(v4l2_dev, "Not output type\n");
if (count < 1) {
+ v4l2_err(v4l2_dev, "count: %d\n", count);
ret = -EINVAL;
goto err;
}
@@ -1060,8 +1066,10 @@ static int coda_start_streaming(struct
vb2_queue *q, unsigned int count)
}

/* Don't start the coda unless both queues are on */
- if (!(ctx->streamon_out & ctx->streamon_cap))
+ if (!(ctx->streamon_out & ctx->streamon_cap)) {
+ v4l2_err(v4l2_dev, "streamon_out (%s), streamon_cap
(%s)\n", (ctx->streamon_out)?"Y":"N",(ctx->streamon_cap)?"Y":"N");
return 0;
+ }

/* Allow decoder device_run with no new buffers queued */
if (ctx->inst_type == CODA_INST_DECODER)
@@ -1083,8 +1091,10 @@ static int coda_start_streaming(struct
vb2_queue *q, unsigned int count)
if (ctx->inst_type == CODA_INST_DECODER) {
if (ret == -EAGAIN)
return 0;
- else if (ret < 0)
+ else if (ret < 0) {
+ v4l2_err(v4l2_dev, "Decoder instance error: %d\n", ret);
goto err;
+ }
}

ctx->initialized = 1;
@@ -1093,10 +1103,10 @@ static int coda_start_streaming(struct
vb2_queue *q, unsigned int count)
err:
if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
while ((buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx)))
- v4l2_m2m_buf_done(buf, VB2_BUF_STATE_DEQUEUED);
+ v4l2_m2m_buf_done(buf, VB2_BUF_STATE_QUEUED);
} else {
while ((buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx)))
- v4l2_m2m_buf_done(buf, VB2_BUF_STATE_DEQUEUED);
+ v4l2_m2m_buf_done(buf, VB2_BUF_STATE_QUEUED);
}
return ret;
}


And the output is now :
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 6208.240919] coda 2040000.vpu: Not output type
[ 6208.245316] coda 2040000.vpu: streamon_out (N), streamon_cap (Y)
[ 6208.251353] coda 2040000.vpu: fill bitstream
[ 6208.255653] coda 2040000.vpu: fill bitstream payload : 0
VIDIOC_STREAMON: failed: Invalid argument

Any idea ?
JM
Philipp Zabel
2014-10-21 16:21:25 UTC
Permalink
Raw Message
Hi Jean-Michel,

Am Dienstag, den 21.10.2014, 17:39 +0200 schrieb Jean-Michel Hautbois:
[...]
Post by Jean-Michel Hautbois
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 6208.240919] coda 2040000.vpu: Not output type
[ 6208.245316] coda 2040000.vpu: streamon_out (N), streamon_cap (Y)
[ 6208.251353] coda 2040000.vpu: fill bitstream
[ 6208.255653] coda 2040000.vpu: fill bitstream payload : 0
VIDIOC_STREAMON: failed: Invalid argument
Any idea ?
JM
$ trace-cmd record -e v4l2* v4l2-ctl -d13 --stream-out-mmap --stream-mmap --stream-to x.raw
[...]
$ trace-cmd report -R | grep bytesused
[...]
v4l2-ctl-308 [003] 1030.861067: v4l2_qbuf: minor=44 index=0 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861292: v4l2_qbuf: minor=44 index=1 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861471: v4l2_qbuf: minor=44 index=2 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861638: v4l2_qbuf: minor=44 index=3 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862301: v4l2_qbuf: minor=44 index=0 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030852944000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862490: v4l2_qbuf: minor=44 index=1 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853139000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862672: v4l2_qbuf: minor=44 index=2 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853322000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862841: v4l2_qbuf: minor=44 index=3 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853491000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0

The decoder is fed ~ 3 MiB input buffers, which it tries (and fails) to
copy into the 1 MiB bitstream ringbuffer (currently hard-coded via the
badly named CODA_MAX_FRAME_SIZE constant), so the bitstream payload in
the ringbuffer is 0 during start_streaming.

regards
Philipp
Jean-Michel Hautbois
2014-10-21 16:26:07 UTC
Permalink
Raw Message
Hi Philipp,
Post by Philipp Zabel
Hi Jean-Michel,
[...]
Post by Jean-Michel Hautbois
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 6208.240919] coda 2040000.vpu: Not output type
[ 6208.245316] coda 2040000.vpu: streamon_out (N), streamon_cap (Y)
[ 6208.251353] coda 2040000.vpu: fill bitstream
[ 6208.255653] coda 2040000.vpu: fill bitstream payload : 0
VIDIOC_STREAMON: failed: Invalid argument
Any idea ?
JM
$ trace-cmd record -e v4l2* v4l2-ctl -d13 --stream-out-mmap --stream-mmap --stream-to x.raw
[...]
$ trace-cmd report -R | grep bytesused
[...]
v4l2-ctl-308 [003] 1030.861067: v4l2_qbuf: minor=44 index=0 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861292: v4l2_qbuf: minor=44 index=1 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861471: v4l2_qbuf: minor=44 index=2 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861638: v4l2_qbuf: minor=44 index=3 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862301: v4l2_qbuf: minor=44 index=0 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030852944000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862490: v4l2_qbuf: minor=44 index=1 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853139000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862672: v4l2_qbuf: minor=44 index=2 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853322000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862841: v4l2_qbuf: minor=44 index=3 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853491000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
The decoder is fed ~ 3 MiB input buffers, which it tries (and fails) to
copy into the 1 MiB bitstream ringbuffer (currently hard-coded via the
badly named CODA_MAX_FRAME_SIZE constant), so the bitstream payload in
the ringbuffer is 0 during start_streaming.
Mmmh, nice, didn't thought to get perf out of there :).
Well, I understand it can't feed the ringbuffer, but is there a way to
make the encoder work ?
I could of course modify CODA_MAX_FRAME_SIZE but this is clearly not
the good thing to do...

Thanks,
JM
Jean-Michel Hautbois
2014-10-22 09:21:16 UTC
Permalink
Raw Message
Hi Philipp,
Post by Philipp Zabel
Hi Jean-Michel,
[...]
Post by Jean-Michel Hautbois
v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw
[ 6208.240919] coda 2040000.vpu: Not output type
[ 6208.245316] coda 2040000.vpu: streamon_out (N), streamon_cap (Y)
[ 6208.251353] coda 2040000.vpu: fill bitstream
[ 6208.255653] coda 2040000.vpu: fill bitstream payload : 0
VIDIOC_STREAMON: failed: Invalid argument
Any idea ?
JM
$ trace-cmd record -e v4l2* v4l2-ctl -d13 --stream-out-mmap --stream-mmap --stream-to x.raw
[...]
$ trace-cmd report -R | grep bytesused
[...]
v4l2-ctl-308 [003] 1030.861067: v4l2_qbuf: minor=44 index=0 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861292: v4l2_qbuf: minor=44 index=1 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861471: v4l2_qbuf: minor=44 index=2 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.861638: v4l2_qbuf: minor=44 index=3 type=1 bytesused=0 flags=16387 field=0 timestamp=0 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862301: v4l2_qbuf: minor=44 index=0 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030852944000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862490: v4l2_qbuf: minor=44 index=1 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853139000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862672: v4l2_qbuf: minor=44 index=2 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853322000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
v4l2-ctl-308 [003] 1030.862841: v4l2_qbuf: minor=44 index=3 type=2 bytesused=3133440 flags=16387 field=1 timestamp=1030853491000 timecode_type=0 timecode_flags=0 timecode_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0 sequence=0
I may have misunderstand something...
I try to encode, and modified the CODA_MAX_FRAME_SIZE to 0x500000 just to see.
And here is the trace-cmd :

$> trace-cmd record -e v4l2* v4l2-ctl -d1 --stream-out-mmap
--stream-mmap --stream-to x.raw
[...]
$> trace-cmd report -R | grep bytesused
v4l2-ctl-1162 [000] 324.061644: v4l2_qbuf:
minor=1 index=0 type=1 bytesused=0 flags=16387 field=0 timestamp=0
timecode_type=0 timecode_flags=0 timecode_frames=0 timeco
de_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0
timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0
sequence=0
v4l2-ctl-1162 [000] 324.062207: v4l2_qbuf:
minor=1 index=1 type=1 bytesused=0 flags=16387 field=0 timestamp=0
timecode_type=0 timecode_flags=0 timecode_frames=0 timeco
de_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0
timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0
sequence=0
v4l2-ctl-1162 [000] 324.062297: v4l2_qbuf:
minor=1 index=2 type=1 bytesused=0 flags=16387 field=0 timestamp=0
timecode_type=0 timecode_flags=0 timecode_frames=0 timeco
de_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0
timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0
sequence=0
v4l2-ctl-1162 [000] 324.062397: v4l2_qbuf:
minor=1 index=3 type=1 bytesused=0 flags=16387 field=0 timestamp=0
timecode_type=0 timecode_flags=0 timecode_frames=0 timeco
de_seconds=0 timecode_minutes=0 timecode_hours=0 timecode_userbits0=0
timecode_userbits1=0 timecode_userbits2=0 timecode_userbits3=0
sequence=0
v4l2-ctl-1162 [000] 324.062931: v4l2_qbuf:
minor=1 index=0 type=2 bytesused=5242880 flags=16387 field=1
timestamp=324047436000 timecode_type=0 timecode_flags=0 timecod
e_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0
timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0
timecode_userbits3=0 sequence=0
v4l2-ctl-1162 [000] 324.063070: v4l2_qbuf:
minor=1 index=1 type=2 bytesused=5242880 flags=16387 field=1
timestamp=324047575000 timecode_type=0 timecode_flags=0 timecod
e_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0
timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0
timecode_userbits3=0 sequence=0
v4l2-ctl-1162 [000] 324.063197: v4l2_qbuf:
minor=1 index=2 type=2 bytesused=5242880 flags=16387 field=1
timestamp=324047704000 timecode_type=0 timecode_flags=0 timecod
e_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0
timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0
timecode_userbits3=0 sequence=0
v4l2-ctl-1162 [000] 324.063330: v4l2_qbuf:
minor=1 index=3 type=2 bytesused=5242880 flags=16387 field=1
timestamp=324047837000 timecode_type=0 timecode_flags=0 timecod
e_frames=0 timecode_seconds=0 timecode_minutes=0 timecode_hours=0
timecode_userbits0=0 timecode_userbits1=0 timecode_userbits2=0
timecode_userbits3=0 sequence=0


And the bytesused is 5MB which corresponds to the 0x500000...
How is the encoder supposed to work precisely ? I missed something...

Thanks,
JM
Philipp Zabel
2014-10-22 09:29:21 UTC
Permalink
Raw Message
Hi Jean-Michel,
Post by Jean-Michel Hautbois
I may have misunderstand something...
I try to encode, and modified the CODA_MAX_FRAME_SIZE to 0x500000 just to see.
$> trace-cmd record -e v4l2* v4l2-ctl -d1 --stream-out-mmap
--stream-mmap --stream-to x.raw
Are you sure /dev/video1 is the encoder device?

$ cat /sys/class/video4linux/video12/name
coda-encoder

$ cat /sys/class/video4linux/video13/name
coda-decoder

[...]
Post by Jean-Michel Hautbois
And the bytesused is 5MB which corresponds to the 0x500000...
How is the encoder supposed to work precisely ? I missed something...
The encoder just takes raw frames and returns encoded frames. The
bitstream ringbuffer is not involved there.

regards
Philipp
Jean-Michel Hautbois
2014-10-22 09:38:58 UTC
Permalink
Raw Message
Post by Philipp Zabel
Hi Jean-Michel,
Post by Jean-Michel Hautbois
I may have misunderstand something...
I try to encode, and modified the CODA_MAX_FRAME_SIZE to 0x500000 just to see.
$> trace-cmd record -e v4l2* v4l2-ctl -d1 --stream-out-mmap
--stream-mmap --stream-to x.raw
Are you sure /dev/video1 is the encoder device?
$ cat /sys/class/video4linux/video12/name
coda-encoder
$ cat /sys/class/video4linux/video13/name
coda-decoder
Ahem you are right... :/

So, here is the trace-cmd with device 0 which is the encoder... and
this is pretty bad :(

$> trace-cmd record -e v4l2* v4l2-ctl -d0 --stream-out-mmap
--stream-mmap --stream-to x.raw

[ 1429.222887] cma: cma_alloc(cma 814923f8, count 3, align 2)
[ 1429.223856] cma: cma_alloc(): returned b7eb8f80
[ 1429.224073] cma: cma_alloc(cma 814923f8, count 1280, align 8)
[ 1429.224579] cma: cma_alloc(): returned b7ebe000
[ 1429.256453] cma: cma_alloc(cma 814923f8, count 1280, align 8)
[ 1429.258174] cma: cma_alloc(): memory range at b7ec8000 is busy, retrying
[ 1429.259623] cma: cma_alloc(): memory range at b7eca000 is busy, retrying
[ 1429.261581] cma: cma_alloc(): returned b7ecc000
[ 1429.279247] cma: cma_alloc(cma 814923f8, count 1280, align 8)
[ 1429.279618] cma: cma_alloc(): returned b7ed6000
[ 1429.293288] cma: cma_alloc(cma 814923f8, count 1280, align 8)
[ 1429.295417] cma: cma_alloc(): returned b7ee0000
[ 1429.309931] cma: cma_alloc(cma 814923f8, count 1280, align 8)
[ 1429.312176] cma: cma_alloc(): returned b7eea000
[ 1429.326262] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1429.328392] cma: cma_alloc(): returned b7ef4000
[ 1429.339247] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1429.339453] cma: cma_alloc(): returned b7efa000
[ 1429.349290] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1429.350072] cma: cma_alloc(): returned b7f00000
[ 1429.359980] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1429.361497] cma: cma_alloc(): returned b7f06000
[ 1429.373118] coda 2040000.vpu: Not output type
[ 1429.377539] coda 2040000.vpu: streamon_out (N), streamon_cap (Y)
[ 1429.383950] coda 2040000.vpu: Not H264 pix fmt
[ 1429.388526] cma: cma_alloc(cma 814923f8, count 20, align 5)
[ 1429.390033] cma: cma_alloc(): returned b7ebd400

[ 1429.391953] ======================================================
[ 1429.398137] [ INFO: possible circular locking dependency detected ]
[ 1429.404410] 3.18.0-rc1+yocto+gc943ff8 #2 Not tainted
[ 1429.409378] -------------------------------------------------------
[ 1429.415648] v4l2-ctl/1179 is trying to acquire lock:
[ 1429.420617] (&sb->s_type->i_mutex_key#3){+.+.+.}, at: [<802d7d9c>]
__create_file+0x70/0x21c
[ 1429.429157]
but task is already holding lock:
[ 1429.434996] (&dev->dev_mutex){+.+.+.}, at: [<8052be98>]
v4l2_ioctl+0x60/0x17c
[ 1429.442294]
which lock already depends on the new lock.

[ 1429.450477]
the existing dependency chain (in reverse order) is:
[ 1429.457964]
-> #2 (&dev->dev_mutex){+.+.+.}:
[ 1429.462473] [<807879ec>] mutex_lock_interruptible_nested+0x6c/0x454
[ 1429.469379] [<7f000e3c>] v4l2_m2m_fop_mmap+0x34/0x90 [v4l2_mem2mem]
[ 1429.476291] [<8052b9a8>] v4l2_mmap+0x64/0x9c
[ 1429.481191] [<80113de8>] mmap_region+0x380/0x6a0
[ 1429.486440] [<80114428>] do_mmap_pgoff+0x320/0x3b8
[ 1429.491859] [<800fe504>] vm_mmap_pgoff+0x74/0xa4
[ 1429.497115] [<80112868>] SyS_mmap_pgoff+0xa4/0xcc
[ 1429.502449] [<8000fa40>] ret_fast_syscall+0x0/0x48
[ 1429.507875]
-> #1 (&mm->mmap_sem){++++++}:
[ 1429.512208] [<8010bb28>] might_fault+0x70/0x98
[ 1429.517290] [<8013e6a0>] filldir64+0x7c/0x194
[ 1429.522279] [<80153020>] dcache_readdir+0x1a4/0x25c
[ 1429.527787] [<8013e41c>] iterate_dir+0x90/0x110
[ 1429.532946] [<8013e934>] SyS_getdents64+0x84/0xf8
[ 1429.538278] [<8000fa40>] ret_fast_syscall+0x0/0x48
[ 1429.543700]
-> #0 (&sb->s_type->i_mutex_key#3){+.+.+.}:
[ 1429.549180] [<8006cc3c>] lock_acquire+0xb0/0x118
[ 1429.554427] [<80786dd4>] mutex_lock_nested+0x60/0x3d4
[ 1429.560110] [<802d7d9c>] __create_file+0x70/0x21c
[ 1429.565445] [<802d7f7c>] debugfs_create_file+0x34/0x40
[ 1429.571212] [<802d830c>] debugfs_create_blob+0x24/0x30
[ 1429.576981] [<7f022ef4>] coda_alloc_aux_buf+0xa4/0x100 [coda]
[ 1429.583372] [<7f025080>] coda_alloc_context_buffers+0xa4/0x20c [coda]
[ 1429.590451] [<7f026068>] coda_start_encoding+0x2c/0x88c [coda]
[ 1429.596921] [<7f021f44>] coda_start_streaming+0xb8/0x268 [coda]
[ 1429.603474] [<80542d04>] vb2_start_streaming+0x6c/0x168
[ 1429.609337] [<805451d8>] vb2_internal_streamon+0xfc/0x158
[ 1429.615367] [<80545270>] vb2_streamon+0x3c/0x60
[ 1429.620527] [<7f00086c>] v4l2_m2m_streamon+0x30/0x48 [v4l2_mem2mem]
[ 1429.627429] [<7f0008a4>] v4l2_m2m_ioctl_streamon+0x20/0x24
[v4l2_mem2mem]
[ 1429.634851] [<8052d684>] v4l_streamon+0x28/0x2c
[ 1429.640012] [<80530bb8>] __video_do_ioctl+0x288/0x304
[ 1429.645695] [<805304fc>] video_usercopy+0x174/0x584
[ 1429.651201] [<80530928>] video_ioctl2+0x1c/0x24
[ 1429.656360] [<8052bf8c>] v4l2_ioctl+0x154/0x17c
[ 1429.661519] [<8013e0c4>] do_vfs_ioctl+0x410/0x66c
[ 1429.666851] [<8013e364>] SyS_ioctl+0x44/0x6c
[ 1429.671749] [<8000fa40>] ret_fast_syscall+0x0/0x48
[ 1429.677171]
other info that might help us debug this:

[ 1429.685181] Chain exists of:
&sb->s_type->i_mutex_key#3 --> &mm->mmap_sem --> &dev->dev_mutex

[ 1429.694250] Possible unsafe locking scenario:

[ 1429.700174] CPU0 CPU1
[ 1429.704706] ---- ----
[ 1429.709238] lock(&dev->dev_mutex);
[ 1429.712848] lock(&mm->mmap_sem);
[ 1429.718799] lock(&dev->dev_mutex);
[ 1429.724924] lock(&sb->s_type->i_mutex_key#3);
[ 1429.729502]
*** DEADLOCK ***

[ 1429.735428] 1 lock held by v4l2-ctl/1179:
[ 1429.739440] #0: (&dev->dev_mutex){+.+.+.}, at: [<8052be98>]
v4l2_ioctl+0x60/0x17c
[ 1429.747180]
stack backtrace:
[ 1429.751548] CPU: 1 PID: 1179 Comm: v4l2-ctl Not tainted
3.18.0-rc1+yocto+gc943ff8 #2
[ 1429.759296] Backtrace:
[ 1429.761770] [<80013b90>] (dump_backtrace) from [<80013ed4>]
(show_stack+0x20/0x24)
[ 1429.769344] r6:80c3e1f4 r5:00000000 r4:00000000 r3:00000000
[ 1429.775078] [<80013eb4>] (show_stack) from [<80782b28>]
(dump_stack+0x8c/0xa4)
[ 1429.782311] [<80782a9c>] (dump_stack) from [<80068738>]
(print_circular_bug+0x1d4/0x318)
[ 1429.790403] r6:80deafd0 r5:80e023b0 r4:80dcf6e0 r3:00000002
[ 1429.796135] [<80068564>] (print_circular_bug) from [<8006c2c0>]
(__lock_acquire+0x1d30/0x1e88)
[ 1429.804748] r10:00000001 r9:b6afa018 r8:00000001 r7:814461ec
r6:80c3e2d8 r5:b6a5ce00
[ 1429.812661] r4:b6a5d270 r3:b6a5d258
[ 1429.816277] [<8006a590>] (__lock_acquire) from [<8006cc3c>]
(lock_acquire+0xb0/0x118)
[ 1429.824109] r10:802d7d9c r9:00000000 r8:00000000 r7:00000000
r6:00000000 r5:b6773438
[ 1429.832020] r4:00000000
[ 1429.834580] [<8006cb8c>] (lock_acquire) from [<80786dd4>]
(mutex_lock_nested+0x60/0x3d4)
[ 1429.842673] r10:b6773400 r9:802d7d9c r8:b6afa030 r7:b6a5ce00
r6:814461ec r5:00000000
[ 1429.850586] r4:b6afa000
[ 1429.853147] [<80786d74>] (mutex_lock_nested) from [<802d7d9c>]
(__create_file+0x70/0x21c)
[ 1429.861326] r10:00000000 r9:b6a383c0 r8:7f028e30 r7:b4eafdf8
r6:000001a4 r5:b477f2e0
[ 1429.869238] r4:81497388
[ 1429.871796] [<802d7d2c>] (__create_file) from [<802d7f7c>]
(debugfs_create_file+0x34/0x40)
[ 1429.880062] r8:00000012 r7:b6a9c010 r6:7f028e30 r5:00014000 r4:b4eafdec
[ 1429.886853] [<802d7f48>] (debugfs_create_file) from [<802d830c>]
(debugfs_create_blob+0x24/0x30)
[ 1429.895656] [<802d82e8>] (debugfs_create_blob) from [<7f022ef4>]
(coda_alloc_aux_buf+0xa4/0x100 [coda])
[ 1429.905071] [<7f022e50>] (coda_alloc_aux_buf [coda]) from
[<7f025080>] (coda_alloc_context_buffers+0xa4/0x20c [coda])
[ 1429.915682] r7:b4eaf8e4 r6:b6a9c040 r5:b6a9c010 r4:b4eaf800
[ 1429.921428] [<7f024fdc>] (coda_alloc_context_buffers [coda]) from
[<7f026068>] (coda_start_encoding+0x2c/0x88c [coda])
[ 1429.932125] r7:34363248 r6:b6a9c040 r5:b6a9c010 r4:b4eaf800
[ 1429.937867] [<7f02603c>] (coda_start_encoding [coda]) from
[<7f021f44>] (coda_start_streaming+0xb8/0x268 [coda])
[ 1429.948042] r10:00000000 r9:b6a383c0 r8:00000012 r7:b4ccd9e0
r6:b6a9c040 r5:00000004
[ 1429.955955] r4:b4eaf800
[ 1429.958522] [<7f021e8c>] (coda_start_streaming [coda]) from
[<80542d04>] (vb2_start_streaming+0x6c/0x168)
[ 1429.968091] r7:b6a9c0d0 r6:b4ccd9e0 r5:b4ccdae0 r4:b4ccd8b0
[ 1429.973824] [<80542c98>] (vb2_start_streaming) from [<805451d8>]
(vb2_internal_streamon+0xfc/0x158)
[ 1429.982871] r7:b6a9c0d0 r6:40045612 r5:b4ccd800 r4:b4ccd9e0
[ 1429.988603] [<805450dc>] (vb2_internal_streamon) from [<80545270>]
(vb2_streamon+0x3c/0x60)
[ 1429.996956] r5:b4ccd800 r4:00000002
[ 1430.000580] [<80545234>] (vb2_streamon) from [<7f00086c>]
(v4l2_m2m_streamon+0x30/0x48 [v4l2_mem2mem])
[ 1430.009903] [<7f00083c>] (v4l2_m2m_streamon [v4l2_mem2mem]) from
[<7f0008a4>] (v4l2_m2m_ioctl_streamon+0x20/0x24 [v4l2_mem2mem])
[ 1430.021468] r5:00000001 r4:b4eaf9d8
[ 1430.025088] [<7f000884>] (v4l2_m2m_ioctl_streamon [v4l2_mem2mem])
from [<8052d684>] (v4l_streamon+0x28/0x2c)
[ 1430.034927] [<8052d65c>] (v4l_streamon) from [<80530bb8>]
(__video_do_ioctl+0x288/0x304)
[ 1430.043028] [<80530930>] (__video_do_ioctl) from [<805304fc>]
(video_usercopy+0x174/0x584)
[ 1430.051295] r10:b6a383c0 r9:80530930 r8:00000001 r7:00000000
r6:b6afbe18 r5:00000004
[ 1430.059209] r4:40045612
[ 1430.061770] [<80530388>] (video_usercopy) from [<80530928>]
(video_ioctl2+0x1c/0x24)
[ 1430.069518] r10:00000000 r9:b6afa000 r8:b6a9c80c r7:b6a383c0
r6:7e9ef5b4 r5:40045612
[ 1430.077431] r4:b6a9c0d0
[ 1430.079990] [<8053090c>] (video_ioctl2) from [<8052bf8c>]
(v4l2_ioctl+0x154/0x17c)
[ 1430.087573] [<8052be38>] (v4l2_ioctl) from [<8013e0c4>]
(do_vfs_ioctl+0x410/0x66c)
[ 1430.095145] r8:00000003 r7:8013e364 r6:b6a383c0 r5:7e9ef5b4
r4:b6b867f8 r3:8052be38
[ 1430.102977] [<8013dcb4>] (do_vfs_ioctl) from [<8013e364>]
(SyS_ioctl+0x44/0x6c)
[ 1430.110290] r10:00000000 r9:b6afa000 r8:00000003 r7:40045612
r6:b6a383c0 r5:7e9ef5b4
[ 1430.118203] r4:b6a383c0
[ 1430.120762] [<8013e320>] (SyS_ioctl) from [<8000fa40>]
(ret_fast_syscall+0x0/0x48)
[ 1430.128334] r8:8000fcc4 r7:00000036 r6:0003eb78 r5:000330f0
r4:7e9eb9c8 r3:00000000
[ 1430.138972] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1430.145725] cma: cma_alloc(): returned b7f0c000
[ 1430.158730] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1430.164549] cma: cma_alloc(): returned b7f12000
[ 1430.177621] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1430.183652] cma: cma_alloc(): returned b7f18000
[ 1430.196775] cma: cma_alloc(cma 814923f8, count 765, align 8)
[ 1430.203849] cma: cma_alloc(): returned b7f1e000
[ 1431.215547] coda 2040000.vpu: CODA PIC_RUN timeout

Thx,
JM

Loading...