Re: [media] CODA960: Fails to allocate memory
Hi Philipp, 2014-10-21 18:21 GMT+02:00 Philipp Zabel p.za...@pengutronix.de: Hi Jean-Michel, Am Dienstag, den 21.10.2014, 17:39 +0200 schrieb Jean-Michel Hautbois: [...] And the output is now : v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw [ 6208.240919] coda 204.vpu: Not output type [ 6208.245316] coda 204.vpu: streamon_out (N), streamon_cap (Y) [ 6208.251353] coda 204.vpu: fill bitstream [ 6208.255653] coda 204.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 0x50 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
Re: [media] CODA960: Fails to allocate memory
Hi Jean-Michel, Am Mittwoch, den 22.10.2014, 11:21 +0200 schrieb Jean-Michel Hautbois: I may have misunderstand something... I try to encode, and modified the CODA_MAX_FRAME_SIZE to 0x50 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 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 [...] And the bytesused is 5MB which corresponds to the 0x50... 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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [media] CODA960: Fails to allocate memory
2014-10-22 11:29 GMT+02:00 Philipp Zabel p.za...@pengutronix.de: Hi Jean-Michel, Am Mittwoch, den 22.10.2014, 11:21 +0200 schrieb Jean-Michel Hautbois: I may have misunderstand something... I try to encode, and modified the CODA_MAX_FRAME_SIZE to 0x50 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 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 b7ee [ 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 b7f0 [ 1429.359980] cma: cma_alloc(cma 814923f8, count 765, align 8) [ 1429.361497] cma: cma_alloc(): returned b7f06000 [ 1429.373118] coda 204.vpu: Not output type [ 1429.377539] coda 204.vpu: streamon_out (N), streamon_cap (Y) [ 1429.383950] coda 204.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]
[media] CODA960: Fails to allocate memory
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 204.vpu: Firmware code revision: 46056 [4.416312] coda 204.vpu: Initialized CODA960. [4.421123] coda 204.vpu: Unsupported firmware version: 3.1.1 [4.483577] coda 204.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 204.vpu: dma_alloc_coherent of size 1048576 failed VIDIOC_REQBUFS: failed: Cannot allocate memory Did I forget to do something ? Thanks, JM -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [media] CODA960: Fails to allocate memory
On 10/21/2014 03:16 PM, Jean-Michel Hautbois wrote: 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 204.vpu: Firmware code revision: 46056 [4.416312] coda 204.vpu: Initialized CODA960. [4.421123] coda 204.vpu: Unsupported firmware version: 3.1.1 [4.483577] coda 204.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 204.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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [media] CODA960: Fails to allocate memory
Hi Hans, 2014-10-21 15:27 GMT+02:00 Hans Verkuil hverk...@xs4all.nl: On 10/21/2014 03:16 PM, Jean-Michel Hautbois wrote: 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 204.vpu: Firmware code revision: 46056 [4.416312] coda 204.vpu: Initialized CODA960. [4.421123] coda 204.vpu: Unsupported firmware version: 3.1.1 [4.483577] coda 204.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 204.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
Re: [media] CODA960: Fails to allocate memory
On 10/21/2014 03:42 PM, Jean-Michel Hautbois wrote: Hi Hans, 2014-10-21 15:27 GMT+02:00 Hans Verkuil hverk...@xs4all.nl: On 10/21/2014 03:16 PM, Jean-Michel Hautbois wrote: 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 204.vpu: Firmware code revision: 46056 [4.416312] coda 204.vpu: Initialized CODA960. [4.421123] coda 204.vpu: Unsupported firmware version: 3.1.1 [4.483577] coda 204.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 204.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
Re: [media] CODA960: Fails to allocate memory
2014-10-21 15:49 GMT+02:00 Hans Verkuil hverk...@xs4all.nl: On 10/21/2014 03:42 PM, Jean-Michel Hautbois wrote: Hi Hans, 2014-10-21 15:27 GMT+02:00 Hans Verkuil hverk...@xs4all.nl: On 10/21/2014 03:16 PM, Jean-Michel Hautbois wrote: 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 204.vpu: Firmware code revision: 46056 [4.416312] coda 204.vpu: Initialized CODA960. [4.421123] coda 204.vpu: Unsupported firmware version: 3.1.1 [4.483577] coda 204.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 204.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 [
Re: [media] CODA960: Fails to allocate memory
Hi Jean-Michel, Am Dienstag, den 21.10.2014, 17:39 +0200 schrieb Jean-Michel Hautbois: [...] And the output is now : v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw [ 6208.240919] coda 204.vpu: Not output type [ 6208.245316] coda 204.vpu: streamon_out (N), streamon_cap (Y) [ 6208.251353] coda 204.vpu: fill bitstream [ 6208.255653] coda 204.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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [media] CODA960: Fails to allocate memory
Hi Philipp, 2014-10-21 18:21 GMT+02:00 Philipp Zabel p.za...@pengutronix.de: Hi Jean-Michel, Am Dienstag, den 21.10.2014, 17:39 +0200 schrieb Jean-Michel Hautbois: [...] And the output is now : v4l2-ctl -d1 --stream-out-mmap --stream-mmap --stream-to x.raw [ 6208.240919] coda 204.vpu: Not output type [ 6208.245316] coda 204.vpu: streamon_out (N), streamon_cap (Y) [ 6208.251353] coda 204.vpu: fill bitstream [ 6208.255653] coda 204.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 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html