Changes between Version 7 and Version 8 of ventana/vpu


Ignore:
Timestamp:
01/22/2019 08:24:56 PM (5 years ago)
Author:
Tim Harvey
Comment:

added more details about VPU/coda requirements

Legend:

Unmodified
Added
Removed
Modified
  • ventana/vpu

    v7 v8  
    88[=#vpu]
    99= IMX6 VPU - Video Processing Unit (Codec Support)
    10 The Video Processing Unit (VPU) in the IMX6 is a CODA960 licensed IP block provided by Chips&Media supporting the following codecs:
     10The Video Processing Unit (VPU) in the IMX6 is a CODA960 licensed IP block provided by Chips&Media supporting the following codecs^^^1^^^:
    1111
    1212Encode:
     
    4444  * libfslcodec-* - various gstreamer libraries
    4545
     46Notes:
     47 1. **support for certain codecs may require software from NXP**
     48 2. The CODA960 encoder requires NV12/I420/YV12 YUV pixel formats with rec709 colorimetry
     49
    4650Documentation:
    4751 * Yocto BSP's - i.MX_6_VPU_Application_Programming_Interface_Linux_Reference_Manual.pdf (from the Freescale i.MX6 Yocto BSP releases which you must download from Freescale)
     
    6569[=#coda]
    6670== Kernel Driver (coda)
    67 '''Note that coda support for the IMX6 was added to Linux in the 3.16 kernel. This page applies to Linux 3.16 and beyond. If you are using a kernel earlier than that for the Ventana IMX6 based boards (such as the Gateworks 3.14 kernel) you will need to refer the Yocto GStreamer pages documenting the proprietary VPU drivers and software from Freescale:
    68  * [wiki:Yocto/gstreamer]
    69  * [wiki:Yocto/gstreamer/compositing]
    70  * [wiki:Yocto/gstreamer/latency]
    71  * [wiki:Yocto/gstreamer/multimedia]
    72  * [wiki:Yocto/gstreamer/streaming]
    73  * [wiki:Yocto/gstreamer/video]
    74 '''
    75 
    76 The Linux [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/coda coda] media driver as of Linux 3.16 supports the CODA960 in the IMX6 and currently provides access to H264 encode/decode, MPEG4 encode/decode, and MPEG2 decode.
     71The Linux [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/media/platform/coda coda] media driver as of Linux 3.16 supports the CODA960 in the IMX6 and currently provides access to the following:
     72 * decode
     73  - H264
     74  - MPEG4
     75  - MPEG2
     76 * encode:
     77  - H264
     78  - MPEG4
     79
     80If the CODA driver is enabled in the kernel (CONFIG_VIDEO_CODA=m) and firmware is able to be loaded from {{{/lib/firmware/vpu}}} two {{{/dev/videoN}}} devices are created (one for encode, the other for decode):
     81{{{#!bash
     82root@imx6q-gw5404:~/# dmesg | grep coda
     83[   12.893365] coda 2040000.vpu: Direct firmware load for vpu_fw_imx6q.bin failed with error -2
     84[   12.893389] coda 2040000.vpu: Falling back to syfs fallback for: vpu_fw_imx6q.bin
     85[   15.168874] coda 2040000.vpu: Using fallback firmware vpu/vpu_fw_imx6q.bin
     86[   15.201391] coda 2040000.vpu: Firmware code revision: 570363
     87[   15.201421] coda 2040000.vpu: Initialized CODA960.
     88[   15.201433] coda 2040000.vpu: Firmware version: 3.1.1
     89[   15.205867] coda 2040000.vpu: codec registered as /dev/video[8-9]
     90root@imx6q-gw5404:~/# cat /sys/class/video4linux/video8/name
     91coda-encoder
     92root@imx6q-gw5404:~/# cat /sys/class/video4linux/video9/name
     93coda-decoder
     94}}}
     95
     96Note that the CODA960 encoder requires NV12/I420/YV12 YUV pixel formats with rec709 colorimetry.
     97
     98Note also that the CODA driver requires CMA memory for buffers when it is used. Make sure to provide the kernel with enough CMA memory with the kernel command-line (ie 'cma=64M' for 64MB which should be enough)
    7799
    78100Encoder and Decoder options are exposed through the v4l2 control IDs (CID) and can be listed with the {{{v4l2-ctl -L}}} and {{{v4l2-ctl -l}}} parameters on the devices exposed by the coda driver:
     
    192214}}}
    193215
     216Note that the CODA960 encoder requires NV12/I420/YV12 YUV pixel formats with rec709 colorimetry
    194217
    195218Examples:
    196219 * Encode and stream 1080p videotestsrc using UDP/RTP/H264:
    197220{{{#!bash
    198 gst-launch-1.0 videotestsrc ! 'video/x-raw, width=1920, height=1080, framerate=30/1, format=NV12, colorimetry=bt709' ! v4l2h264enc output-io-mode=4 ! rtph264pay ! udpsink host=$SERVER port=5000
     221gst-launch-1.0 videotestsrc ! \
     222  'video/x-raw,width=1920,height=1080,framerate=30/1,format=NV12,colorimetry=bt709' ! \
     223  v4l2h264enc output-io-mode=4 ! rtph264pay ! udpsink host=$SERVER port=5000
    199224}}}
    200225 * Decode and display an H264 video stream:
    201226{{{#!bash
    202 gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,payload=96 ! rtph264depay ! v4l2h264dec ! kmssink
     227gst-launch-1.0 udpsrc port=5000 ! \
     228  application/x-rtp,payload=96 ! \
     229  rtph264depay ! v4l2h264dec ! kmssink
    203230}}}
    204231
    205232=== Troubleshooting
    206 - If you do not have the VPU firmware installed you will see these elements.
     233- If you do not have the VPU firmware installed you will see the {{{/dev/videoN}}} devices associated with the coda driver.
    207234- CODA driver needs CMA memory.
    208235 - In bootloader "setenv extra cma=64M"