vga-sync-fields - Soft-PLL providing RGB/PAL over VGA at variable frame rate
============================================================================

Version:                      0.0.1

Written by:                   Thomas Hilber <sparkie@lowbyte.de>

Latest version available at:  http://lowbyte.de/vga-sync-fields/

Distributed under GPL, see the file COPYING for license information.

WARNING
-------

As we directly control video timing driving the television, there exists
potential for damage through mistakes in hardware and software sending
an out-of-spec signal to the television. In particular old cathode ray 
tube TV-sets (CRTs) may not contain proper protection circuits. 

Consider yourself warned and proceed at your own risk.

Software provided here is experimental and far from complete. 
Don't use it on productive systems.
Documentation presented here must be vastly improved. 

Special Thanks
--------------

Special acknowledgements go to Roland Scheidegger for his great support.
Without his help the project would not be feasible with Radeon cards.  

Requirements
------------

  - mainboard with moderate processor power like Pentium III 800MHz 
    (probably even lower)
 
  - xf86-video-ati compatible hardware. Probably everything pre-avivo 
    (e.g. before r500 with the exception of rs690 which is a r300-style 
    3d core but 2d is avivo) will work.
    I explicitly tested compatibility with following boards/chipsets.
    All of them are working properly.

	o Radeon 7000 AGP
	o Radeon IGP-9100 (integrated)
	o Radeon 9200SE AGP
	o Radeon 9250 AGP
	o Radeon 9600SE AGP
	o Radeon X300SE PCIe

Optional
--------

  - to build a full blown DVB recorder you may also want some DVB budget 
    card like TechnoTrent TT-S1401. But currently there are still issues 
    with DVB cards. Don't expect these to run flawlessly with the patch.

Description
-----------

This is a patch collection with some additional tools allowing you to 
synchronize VGA video timing to an external signal source. This way 
you may overcome common problems on today's PC VGA compatible hardware
when being used as frontend for live TV.

You can interface softdecoders like xine or softdevice to 
Klaus Schmidinger's VDR (http://www.cadsoft.de/vdr/). With SCART
output quality equaling a fullfeatured (firmware-based decoder) card.

Now cheap standard PC hardware with low processor power and a budget card
(without decoder) is sufficient to build a low-cost high-quality SCART-output
video disk recorder under linux.

Some more information about the project is available at

http://linuxtv.org/pipermail/vdr/2008-July/017347.html
and
http://www.vdr-portal.de/board/thread.php?threadid=78480

The area down from here to the end of the document is merely some kind
of scratch pad. As time permits things will be reorganized for better
reading.

==============================================================================
circuit diagram of my favorite VGA-to-SCART adaptor:

   VGA                                                SCART

     1 -O------------------------------------------O- 15 R
     2 -O------------------------------------------O- 11 G
     3 -O------------------------------------------O-  7 B

     6 -O---------------------------------------+--O- 13 R Gnd
     7 -O---------------------------------------+--O-  9 G Gnd
     8 -O---------------------------------------+--O-  5 B Gnd
    10 -O---------------------------------------+--O- 17   Gnd
                                                +--O- 14   Gnd
                                                +--O- 18   Gnd
               ------
     9 -O-----|  75R |-----------------------------O- 16
               ------
-VS 14 -O-----------------------+
                                |
                             | /
               ------        |C
-HS 13 -O-----| 680R |-----B-|     BC 547 B
               ------        |E
                             | \
                                |       ------
                                +------| 680R |----O- 20 -CS
                                        ------
  shell-O------------------------------------------O- 21 shell

==============================================================================
important settings in xineliboutput (all vertical scaling must be disabled)

xineliboutput.Decoder.PesBuffers = 500
xineliboutput.DisplayAspect = automatic
xineliboutput.Frontend = sxfe
xineliboutput.Fullscreen = 1
xineliboutput.Modeline =
xineliboutput.Video.AutoCrop = 0
xineliboutput.Video.Deinterlace = none
xineliboutput.Video.Driver = xv
xineliboutput.Video.FieldOrder = 0
xineliboutput.Video.Overscan = 0
xineliboutput.Video.Port = 0.0
xineliboutput.Video.Scale = 1
==============================================================================
sample xorg.conf configuration 

Section "ServerLayout"
        Identifier     "X.org Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Mouse0" "CorePointer"
        InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
        RgbPath      "/etc/X11/rgb"
        ModulePath   "/usr/lib/xorg/modules"
        FontPath     "/usr/share/fonts/X11/misc"
        FontPath     "/usr/share/fonts/X11/cyrillic"
        FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
        FontPath     "/usr/share/fonts/X11/Type1"
        FontPath     "/usr/share/fonts/X11/100dpi"
        FontPath     "/usr/share/fonts/X11/75dpi"
        FontPath     "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
        Load  "GLcore"
        Load  "record"
        Load  "extmod"
        Load  "dri"
        Load  "xtrap"
        Load  "glx"
        Load  "dbe"
EndSection

Section "InputDevice"
        Identifier  "Keyboard0"
        Driver      "kbd"
EndSection

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "Device" "/dev/input/mice"
        Option      "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
        Identifier   "Monitor0"
        VendorName   "Monitor Vendor"
        ModelName    "Monitor Model"

        Modeline "720x576i" 13.875 720 744 808 888 576 580 585 625 -HSync -Vsync interlace
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "radeon"
        VendorName  "ATI Technologies Inc"
        BoardName   "Radeon 9100 IGP"
        Option      "ForceMinDotClock" "12MHz"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth    24
        SubSection "Display"
                Viewport   0 0
                Depth      24
                Modes      "720x576i"
        EndSubSection
EndSection
==============================================================================
kernel parameters for linux console standard 640x480 screen resolution

you explicitly must configure screen resolution to 640x480 which mostly is 
NOT the default. Otherwise the video timing of linux console (before the
Xserver comes up) could be dangerous to a connected TV-set.

vga=0x301
==============================================================================
kernel parameters for linux console 720x576i or 800x520i screen resolution

if you have recompiled your kernel with 'radeonfb.patch' (see INSTALL) you
optionally can use these kernel parameters instead of 'vga=0x301':

video=radeonfb:720x576-32@50i
or
video=radeonfb:800x520-32@50i

The one with '800x520' is preferred for a console because it shows no overscan.
Thus all parts of the screen are visible. You optionally can use this for
showing some splash image before VDR starts.
==============================================================================

