Zoran devices (zr36057, zr36067): Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
m (VPX3224/5)
(No difference)

Revision as of 12:58, 5 March 2006

NB : this is a work in progress.

Cards supported by the zoran driver

Straight from the mjpeg zoran-driverpage :

Iomega Buz
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7111 TV decoder
* Philips saa7185 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, saa7111, saa7185, zr36060, zoran
Inputs: Composite and S-video
Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
Card number: 7
Linux Media Labs LML33
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Brooktree bt819 TV decoder
* Brooktree bt856 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, bt819, bt856, zr36060, zoran
Inputs: Composite and S-video
Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
Card number: 5 
Linux Media Labs LML33R10
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7114 TV decoder
* Analog Devices adv7170 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, saa7114, adv7170, zr36060, zoran
Inputs: Composite and S-video
Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps)
Card number: 6 
Pinnacle/Miro DC10(new)
* Zoran zr36057 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7110a TV decoder
* Analog Devices adv7176 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, saa7110, adv7175, zr36060, zoran
Inputs: Composite, S-video and Internal
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
Card number: 1 
Pinnacle/Miro DC10+
* Zoran zr36067 PCI controller
* Zoran zr36060 MJPEG codec
* Philips saa7110a TV decoder
* Analog Devices adv7176 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, sa7110, adv7175, zr36060, zoran
Inputs: Composite, S-video and Internal
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
Card number: 2 
Pinnacle/Miro DC10(old)
* Zoran zr36057 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End or Fuji md0211 Video Front End (clone?)
* Micronas vpx3220a TV decoder
* mse3000 TV encoder or Analog Devices adv7176 TV encoder *
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zoran
Inputs: Composite, S-video and Internal
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
Card number: 0 
Pinnacle/Miro DC30
* Zoran zr36057 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End
* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder
* Analog Devices adv7176 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zoran
Inputs: Composite, S-video and Internal
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
Card number: 3 
Pinnacle/Miro DC30+
* Zoran zr36067 PCI controller
* Zoran zr36050 MJPEG codec
* Zoran zr36016 Video Front End
* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder
* Analog Devices adv7176 TV encoder
Drivers to use: videodev, i2c-core, i2c-algo-bit, videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36015, zoran
Inputs: Composite, S-video and Internal
Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps)
Card number: 4 

Note: No module for the mse3000 is available yet
Note: No module for the vpx3224 is available yet
Note: For VPX3224D and VPX3225D support see the TechniSat TechniPC/MediaFocus Linux driver project.

Output from lspci -v with a DC10+ installed :

0000:02:0e.0 Multimedia video controller: Zoran Corporation ZR36057PQC Video cutting chipset (rev 02)
        Subsystem: Miro Computer Products AG DC10 Plus
        Flags: fast devsel, IRQ 18
        Memory at dd000000 (32-bit, non-prefetchable)

Hardware configuration, known caveats

DISCLAIMER : I am not sponsored by / employed by any company selling boards (may it be mainboards or video capture boards), chipsets (Intel, SiS, VIA...). Any information in that section, and others, is either derived from my personal experience, other users' experience, forums, and web sites.

  • The zoran boards are quite picky, at least compared to most other PCI boards. Ideally, the mainboard should use an Intel or SiS chipset, VIA-based boards are known to cause trouble.
  • When selecting a PCI slot to install a zoran-based card, check that this slot does not share an interrupt with other devices or other slots. Doing "cat /proc/interrupts" will tell you about devices on your system and their interrupts. Your mainboard's manual should help in selecting a good (i.e. not shared) PCI slot.

Example output :

# cat /proc/interrupts 
          CPU0       
 0:     297527    IO-APIC-edge  timer
 1:          9    IO-APIC-edge  i8042
 8:          2    IO-APIC-edge  rtc
14:       5228    IO-APIC-edge  ide0
15:         12    IO-APIC-edge  ide1
18:       2566   IO-APIC-level  DC10plus[0]
19:         40   IO-APIC-level  uhci_hcd
20:      33244   IO-APIC-level  acpi, eth0
22:       1092   IO-APIC-level  Ensoniq AudioPCI
23:          0   IO-APIC-level  uhci_hcd
  • Zoran devices using the (older) zr36057 PCI controller have two known, documented (by Zoran) hardware bugs, mostly requiring the driver to be unloaded then reloaded after each use (this information may be wrong and / or out of date).
  • The Iomega Buz is more likely to drop frames than other zoran boards (but works perfectly in some cases). Lowering the size of the capture might help if you get dropped frames (at the obvious expense of image quality).

What these cards can do

  • Capturing video and displaying it _raw_ on the screen, via overlay (using PCI-PCI transfer). You have to use xawtv or motv for that, and use Load "v4l" in your xorg.conf Modules section. My experience is that the image quality using that mode is terrible, but maybe I missed something in my setup.
  • Capturing video (Composite or S-Video) and writing it to disk using the (hardware) MJPEG codec. You have to install the mjpegtools for that, and use lavrec. Having good disk I/O and is essential, BTW, since capturing at the maximum supported resolution and JPEG quality means writing about 6MB/s to the hard drive. In this mode, image quality is perfect (after all, zoran boards are high-end framegrabbers).
From mplayer, during playback :
VIDEO:  [MJPG]  768x576  24bpp  25.000 fps  47699.1 kbps (5822.6 kbyte/s)
  • Sending a MJPEG avi to the card, using lavplay, and selecting either S-Video or Composite input (man lavplay).

What these cards cannot (yet) do

  • Capturing video at high res and displaying it immediately (framegrabber mode) - or at least I haven't been able to do it.

A brief overview of the (weird) software configuration needed to make these cards work

(Or what to do during a rainy afternoon)

Kernel setup

This is for a DC10+ :
Device drivers > Multimedia devices > <M> Video For Linux
Device drivers > Multimedia devices > Video For Linux > <M> Zoran ZR36057/36067 Video For Linux
Device drivers > Multimedia devices > Video For Linux > <M> Pinnacle/Miro DC10(+) support
Device drivers > I2C support > <M> I2C support Device drivers > I2C support > <M> I2C device interface


(pb12) I had trouble building a 2.6.11 kernel on Debian unstable. i2c-core.o would not build. Had success with 2.6.12

The 128KB buffer problem and a workaround

NB : I'm using 512MB of SDRAM. You'll have to adapt the numbers here to your configuration.
The Linux kernel (even 2.6) will not give access to a contiguous memory block larger than 128KB. The problem is, to capture a 768x576 image (PAL), zoran cards need larger buffers (512KB). There are two workarounds : the first is to reserve some memory at boot time, and to tell the zoran driver to use that memory as capture buffers. For a good capture (without any dropped frames), 32 buffers is a large enough number (but YMMV) ; 32x512KB = 16MB, 512-16 = 496MB.
In lilo.conf (I'm sure this is exactly the same for grub, but feel free to edit this page if you know how to do it), use append="mem=496M" like in :

image=/boot/vmlinuz-2.6.11.7
   label=g2611-7 
   root=/dev/whatever 
   read-only 
   append="mem=496M" 

Additionally, you probably need to recompile the driver with -DBUZ_USE_HIMEM in the gcc commandline for it to use the high memory that you reserved by using the "mem" kernel parameter.

The second way to do the same thing is to use the bigphysmem kernel patch. I've never attempted to do that, since loosing 16MB of system ram looked like a decent solution (and the only bigphysmem patches available are for 2.2 or 2.4 kernels).

module loading options

With a DC10+ (zr36067 PCI controller), the module to load is "zr36067". There are several options to know about, namely :
card=$number where $number is the corresponding number for your card in "Cards supported by the zoran driver"
v4l_bufsize=$number where $number is the size of one buffer
v4l_nbufs=$number where $number is the number of the buffers reserved for the card
Ideally, (v4l_nbufs * v4l_bufsize) = (totalmem - append= in your lilo.conf)

What I'm using (DC10+) : modprobe zr36067 v4l_bufsize=512 card=2 v4l_nbufs=32

Other (useful) options are debug=2 if you're having trouble, and low_bitrate=1 if you experience frame drops with a Buz card.

You'll have to figure out how to load the module properly with your distribution's documentation, of course.

User space setup

Applications known to work with these cards

The most obvious one are xawtv and motv which give you full screen, overlay, realtime playback.
kdetv is known to work (but not here).
lavrec, lavplay : the mjpegtools

TODO

I'm working on merging lavrec and lavplay to be able to display a high-res MJPEG capture in real time.

Sources

MJPEG project : driver-zoran

tvtime's page about zoran boards