Home - n-aizu/linux-linaro-stable-mx6 GitHub Wiki
Kernel tree for SolidRun's HummingBoard.
- 3.14-1.0.x-mx6-sr
- Based on original SolidRun's kernel tree
- Some update is added
Kernel
See official instruction.
note:
If you want to increase encoder performance, you should enable CONFIG_MX6_VPU_352M.
CONFIG_MX6_VPU_352M(Prompt: MX6 VPU 352M)
-> Device Drivers
-> MXC support drivers
-> MXC VPU(Video Processing Unit) support
-> Support for MXC VPU(Video Processing Unit)
gstreamer-imx
https://github.com/n-aizu/gstreamer-imx.git
branch:picam-0.12.3
Userland example:ArchLinux
(Buildroot installation)
Install package
pacman -S imx-gpu-viv-fb firmware-imx libimxvpuapi linux-imx6-headers python gcc pkg-config
pacman -S gstreamer gst-plugins-good gst-plugins-bad gst-plugins-base gst-libav
Build, install and uninstall
On Hummingboard:
export PKG_CONFIG_PATH='/opt/fsl/lib/pkgconfig'
export LDFLAGS='-L/opt/fsl/lib'
export CPPFLAGS='-I/opt/fsl/include'
./waf configure --prefix=/usr --kernel-headers=/usr/include --egl-platform=fb
./waf build
./waf install
uninstall:
./waf uninstall
note:
It is necessary to save configured source tree to uninstall.
Capturing
preparation:
load virtual framebuffer driver and check fb number.
modprobe vfb_phymem
example)
# ls -l /dev/fb*
crw-rw-rw- 1 root video 29, 0 Apr 5 08:28 /dev/fb0
crw-rw-rw- 1 root video 29, 1 Apr 5 08:28 /dev/fb1
# modprobe vfb_phymem
# ls -l /dev/fb*
crw-rw-rw- 1 root video 29, 0 Apr 5 08:28 /dev/fb0
crw-rw-rw- 1 root video 29, 1 Apr 5 08:28 /dev/fb1
crw-rw-rw- 1 root video 29, 2 Apr 5 08:29 /dev/fb2 <--- virtual framebuffer device
Save in file:
gst-launch-1.0 imxv4l2videosrc imx-capture-mode=1 fps-n=45 queue-size=10 ! queue ! \
imxbayer fbnum=2 fbset=true red=1.05 green=1.0 blue=1.15 demosaic=2 ! video/x-raw,format=I420 ! \
queue ! imxvpuenc_h264 idr-interval=16 quant-param=20 ! queue ! h264parse ! mpegtsmux ! filesink location=testh264.mts
Save in file(HD Lite):
gst-launch-1.0 imxv4l2videosrc imx-capture-mode=2 fps-n=30 queue-size=10 ! queue ! \
imxbayer fbnum=2 fbset=true red=1.05 green=1.0 blue=1.15 demosaic=3 hdlite=true ! \
video/x-raw,format=I420 ! queue ! imxvpuenc_h264 idr-interval=16 quant-param=20 ! \
queue ! h264parse ! video/x-h264,pixel-aspect-ratio=9/6 ! matroskamux ! filesink location=testh264.mkv
note:
The maximum frame rate that the imxbayer element supports is less than the maximum frame rate that the ov5647 kernel driver supports.
parametors
*imx-capture-mode
Resolution setting.
- 0:1280x960
- 1:1280x720
- 2:1920x1080
- 3:640x480
- 4:1024x768
- 5:960x720
- 6:640x480(narrow angle of view)
*fps-n
Frame rate.
Supported frame rate:
- 640x480: 15,20,25,30,35,40,45,50,55
- 960x720: 15,20,25,30,35,40,45,50
- 1024x768: 15,20,25,30,35,40,45
- 1280x720: 15,20,25,30,35,40,45,50
- 1280x960: 15,20,25,30,35,40,45
- 1920x1080:15,18,20,22,24,26,28,30
*fbnum
Framebuffer device number(/dev/fbN).
*fbset
Call ioctl(FBIOPUT_VSCREENINFO) before start capturing.
If you change resolution, must set "fbset=true".
- false:not call ioctl
- true:call ioctl
*red/green/blue
Color filter value.
*demosaic
Choose demosaic(debayer) algorithm.
As a number becomes big, picture quality decreases and processing speed improves.
- 0:High-Quality Linear Interpolation(Malvar-He-Cutler)
- 1:Edge Aware Weighted bilinear interpolation
- 2:Edge Aware Weighted bilinear interpolation(in YUV color space)
- 3:Edge Aware Weighted bilinear interpolation(in YUV color space/less expensive version)
*hdlite
Downsample 1920x1080 to 1280x1080.
It is intended to improve processing speed while picture quality decreases.
This option is valid for demosaic=2 or 3.
If you set "hdlite=true", you must set aspect ratio to 16:9.
(e.g. set "pixel-aspect-ratio=9/6" to matroskamux)
- false:normal
- true:downsample
Screen preview:
gst-launch-1.0 imxv4l2videosrc imx-capture-mode=1 fps-n=30 queue-size=10 ! \
queue ! imxbayer fbnum=2 fbset=true red=1.05 green=1.0 blue=1.15 demosaic=2 ! \
video/x-raw,format=I420 ! queue ! imxipuvideosink
Resolution setting for other software(not support VIDIOC_S_PARM ioctl)
1280x960:
echo 0 > /sys/bus/i2c/devices/0-0036/ov5647_mode
1280x720:
echo 1 > /sys/bus/i2c/devices/0-0036/ov5647_mode
1920x1080:
echo 2 > /sys/bus/i2c/devices/0-0036/ov5647_mode
640x480:
echo 3 > /sys/bus/i2c/devices/0-0036/ov5647_mode
1024x768(default):
echo 4 > /sys/bus/i2c/devices/0-0036/ov5647_mode
960x720:
echo 5 > /sys/bus/i2c/devices/0-0036/ov5647_mode
640x480(narrow angle of view):
echo 6 > /sys/bus/i2c/devices/0-0036/ov5647_mode
reading/writing I2C registers
Read a register by setting the register:
/sys/bus/i2c/devices/0-0036# echo 3002 > ov5647_reg
/sys/bus/i2c/devices/0-0036# cat ov5647_reg
ov5647[0x3002]=0x1c
Write a register using regnum=value (in hex):
/sys/bus/i2c/devices/0-0036# echo 3603=1f > ov5647_reg
/sys/bus/i2c/devices/0-0036# cat ov5647_reg
ov5647[0x3603]=0x1f
note:
It is necessary to power on pi camera to read/write i2c registers(in other words, It is necessary to start capturing).
Color setting registers are 0x5800~0x583d
Etc
Camera module version
There are a number of vendors selling Raspberry Pi Camera module.
It is reported that there is camera module which doesn't work on HummingBoard.
SainSmart's camera module works on HummingBoard.
imxvpuenc_h264 video quality
gstreamer-imx's element imxvpuenc_h264 has "quant-param" option. This option controls video quality and data size.
When a quant-param value is '0', video quality is the highest.
An alternative option to modify quality is "bitrate". The unit of this option is KiB.
imxvpuenc_h264 idr-interval=16 bitrate=16384
- OV5647 data sheet
- Original patch set
- Other NXP community threads
- GStreamer i.MX6 Pipelines
- "[gst-imx] How to use gstreamer on the quad wandboard?"
- gstreamer-imx repository
-
Boundary Devices linux-imx6 kernel tree
- Some patches are cherry-picked from this tree.
- Raspberry Pi community threads
- Other OV5647 driver implementations
- Algorithm/Implementation for demosaicing
- HD Lite