CM-iGLX: Linux: Video Input Port

From Compulab Mediawiki
Jump to: navigation, search

Introduction

CM-iGLX has Video Input Port (VIP in short) integrated into Geode LX processor. The VIP receives data from video decoder (for instance SAA7113h assembled on the SB-iGLX) and this data can be stored as a video stream or presented as a display overlay. This functionality can be enabled in using "Video for Linux 2 (v4l2)" API. CompuLab provides geodelx-v4l2 package which contains a driver that implements the v4l2 API on CM-iGLX (geodelx-v4l2/geode_lx_video.patch) and application examples for video capture (geodelx-v4l2/examples/capture.c) and video overlay (geodelx-v4l2/examples/overlay.c).

Kernel configuration

The v4l2 driver for CM-iGLX included in the geodelx-v4l2 package is available as a patch vs. Linux kernel 2.6.24. After applying the patch to kernel source tree you will need to enable the #Geode LX framebuffer driver and #Geode LX v4l2 driver. After updating kernel configuration as described below, build the kernel and install the resulting image and loadable kernel modules to CM-iGLX.

Geode LX framebuffer driver

In the "Device Drivers -> Graphics support" menu enable "Support for frame buffer devices":

 .config - Linux Kernel v2.6.24 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌─────────────────────────── Graphics support ────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    < > /dev/agpgart (AGP Support)  --->                             │ │
  │ │    < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI suppor│ │
  │ │    < > Lowlevel video output switch controls                        │ │
  │ │    <*> Support for frame buffer devices  --->                       │ │
  │ │    [ ] Backlight & LCD device support  --->                         │ │
  │ │        Display device support  --->                                 │ │
  │ │        Console display driver support  --->                         │ │
  │ │    [ ] Bootup logo  --->                                            │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

and in the "Support for frame buffer devices" menu enable "AMD Geode family framebuffer support" and "AMD Geode LX framebuffer support":

 .config - Linux Kernel v2.6.24 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌─────────────────── Support for frame buffer devices ────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Support for frame buffer devices                             │ │
  │ │    [ ]   Enable firmware EDID                                       │ │
  │ │    [ ]   Enable Video Mode Handling Helpers                         │ │
  │ │    [ ]   Enable Tile Blitting Support                               │ │
  │ │          *** Frame buffer hardware drivers ***                      │ │
  │ │    < >   Cirrus Logic support                                       │ │
  │ │    < >   Permedia2 support                                          │ │
  │ │    < >   CyberPro 2000/2010/5000 support                            │ │
  │ │    < >   Arc Monochrome LCD board support                           │ │
  .............
  │ │    < >   3Dfx Voodoo Graphics (sst1) support                        │ │
  │ │    < >   VIA VT8623 support                                         │ │
  │ │    < >   Cyberblade/i1 support                                      │ │
  │ │    < >   Trident support                                            │ │
  │ │    < >   ARK 2000PV support                                         │ │
  │ │    < >   Permedia3 support (EXPERIMENTAL)                           │ │
  │ │    [*]   AMD Geode family framebuffer support (EXPERIMENTAL)        │ │
  │ │    <*>     AMD Geode LX framebuffer support (EXPERIMENTAL)          │ │
  │ │    < >     AMD Geode GX framebuffer support (EXPERIMENTAL)          │ │
  │ │    < >     AMD Geode GX1 framebuffer support (EXPERIMENTAL)         │ │
  │ │    < >   Virtual Frame Buffer support (ONLY FOR TESTING!)           │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Geode LX v4l2 driver

In the "Device Drivers -> Multimedia devices" menu enable "Video for Linux":

 .config - Linux Kernel v2.6.24 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌────────────────────────── Multimedia devices ───────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    <M> Video For Linux                                              │ │
  │ │    [ ]   Enable Video For Linux API 1 (DEPRECATED)                  │ │
  │ │    [*]   Enable Video For Linux API 1 compatible Layer              │ │
  │ │    [*]   Video capture adapters  --->                               │ │
  │ │    [ ]   Radio Adapters  --->                                       │ │
  │ │    < > DVB for Linux                                                │ │
  │ │    [ ] DAB adapters                                                 │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ │                                                                     │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Next, go to "Video capture adapters" menu and enable "Geode LX Video capture interface":

.config - Linux Kernel v2.6.24 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌──────────────────────── Video capture adapters ─────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Video capture adapters                                       │ │
  │ │    [ ]   Enable advanced debug functionality                        │ │
  │ │    [ ]   Autoselect pertinent encoders/decoders and other helper chi│ │
  │ │            Encoders/decoders and other helper chips  --->           │ │
  │ │    < >   Virtual Video Driver                                       │ │
  │ │    < >   SAA5246A, SAA5281 Teletext processor                       │ │
  │ │    < >   SAA5249 Teletext processor                                 │ │
  │ │    < >   Philips SAA7134 support                                    │ │
  │ │    < >   Hexium HV-PCI6 and Orion frame grabber                     │ │
  │ │    < >   Hexium Gemini frame grabber                                │ │
  │ │    < >   Conexant 2388x (bt878 successor) support                   │ │
  │ │    <M>   Geode LX Video capture interface  --->                     │ │
  │ │    < >   Marvell 88ALP01 (Cafe) CMOS Camera Controller support      │ │
  │ │    [ ]   V4L USB devices  --->                                      │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

If you are using SB-iGLX base board disable "Autoselect pertinent encoders/decoders and other helper chips" option and select SAA7113 video decoder:

 .config - Linux Kernel v2.6.24 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌─────────────── Encoders/decoders and other helper chips ────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │        *** Audio decoders ***                                       │ │
  │ │    < > Philips TDA9840 audio processor                              │ │
  │ │    < > Philips TEA6415C audio processor                             │ │
  │ │    < > Philips TEA6420 audio processor                              │ │
  │ │    < > Micronas MSP34xx audio decoders                              │ │
  │ │    < > Cirrus Logic CS53L32A audio ADC                              │ │
  │ │    < > Texas Instruments TLV320AIC23B audio codec                   │ │
  │ │    < > Wolfson Microelectronics WM8775 audio ADC with input mixer   │ │
  │ │    < > Wolfson Microelectronics WM8739 stereo audio ADC             │ │
  │ │    < > Panasonic VP27s internal MPX                                 │ │
  │ │        *** Video decoders ***                                       │ │
  │ │    < > OmniVision OV7670 sensor support                             │ │
  │ │    < > TCM825x camera sensor support                                │ │
  │ │    <M> Philips SAA7113/4/5 video decoders                           │ │
  │ │    < > Texas Instruments TVP5150 video decoder                      │ │
  │ │        *** Video and audio decoders ***                             │ │
  │ │    < > Conexant CX2584x audio/video decoders                        │ │
  │ │        *** MPEG video encoders ***                                  │ │
  │ │    < > Conexant CX2341x MPEG encoders                               │ │
  │ │        *** Video encoders ***                                       │ │
  │ │    < > Philips SAA7127/9 digital video encoders                     │ │
  │ │        *** Video improvement chips ***                              │ │
  │ │    < > NEC Electronics uPD64031A Ghost Reduction                    │ │
  │ │    < > NEC Electronics uPD64083 3-Dimensional Y/C separation        │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Application examples

The geodelx-v4l2 package includes two simple examples for video capture and video overlay.

Capture

The capture example accepts the following command line options:

-d | --device name   Video device name [/dev/video]
-h | --help          Print this message
-m | --mmap          Use memory mapped buffers
-r | --read          Use read() calls
-o | --output        Capture to file [file]

Overlay

The overlay example accepts the following command line options:

-d | --device name   Video device name [/dev/video]
-w | --width value   Overlay window width [640]
-e | --height value  Overlay window height [480]
-l | --left value    Overlay window left coord [0]
-t | --top value     Overlay window top coord [0]
-s | --steps value   Steps for control adjustment []
-v | --verbose       Verbose output
-h | --help          Print this message