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

Version:                      0.2.0

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

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

Current development: git clone git://www.easy-vdr.de/git/frc

Gitweb: http://www.easy-vdr.de/git?p=frc.git/.git;a=summary

Wiki: http://frc.easy-vdr.de/

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.

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

   - xf86-video-intel compatible hardware. Tested with i915 and i945.
     Though all Intel GM chips i9xx should be fine. Hardware tested so
     far includes:

	o Asus Eee PC 701
	o Asus Pundit P1-P5945GC
	o Intel D945GCLF (Little Falls)
	o Intel D945GCLF2 (Little Falls 2)
	o Intel D945GSEJT (Johnstown)

Optional
--------

  - to build a full blown DVB recorder you may also want some DVB budget 
    card like TechnoTrent TT-S1401. 

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://www.spinics.net/lists/vdr/msg17317.html
and
http://www.vdr-portal.de/board/thread.php?threadid=78480

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

   VGA plug                                           SCART plug

     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

==============================================================================
relevant parts of xorg.conf sample configuration for Radeon type of the patch

Section "Monitor"
        Identifier  "Monitor0"
        Modeline    "720x576_50i"      13.875   720  744  808  888   576  580  585  625  -hsync -vsync interlace
        Modeline    "800x520_50i"      17.00    800  856  936 1088   520  548  553  625  -hsync -vsync interlace
        ModeLine    "1440x576_50i"     27.75   1440 1488 1609 1769   576  580  585  625  -hsync -vsync interlace

        Option      "PreferredMode"    "720x576_50i"
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "radeon"

#        Option      "SyncFields"                "True"
#        Option      "SF_SchedPrio"              "0"
        Option      "SF_Debug"                  "12000"

        Option      "ForceMinDotClock" "12MHz"
EndSection

Section "Screen"
        Identifier "Screen0"
        Monitor    "Monitor0"
        Device     "Card0"
        DefaultDepth    24
EndSection
==============================================================================
relevant parts of xorg.conf sample configuration for Intel type of the patch
- for VGA/SCART: unignore Monitor0, ignore Monitor2 (as shown in example)
- for DVI/HDMI: ignore Monitor0, unignore Monitor2

Section "Monitor"
        Identifier   "Monitor0"
        Modeline     "720x576_50i"      13.875   720  744  808  888   576  580  585  625  -hsync -vsync interlace
        Modeline     "800x520_50i"      17.00    800  856  936 1088   520  548  553  625  -hsync -vsync interlace
        ModeLine     "1440x576_50i"     27.75   1440 1488 1609 1769   576  580  585  625  -hsync -vsync interlace

        Option       "PreferredMode"    "1440x576_50i"
#        Option       "RightOf"          "Monitor1"
#        Option       "Ignore" "true"
EndSection

Section "Monitor"
        Identifier   "Monitor1"
        Modeline     "800x480"          29.58    800  816  896  992   480  481  484  497  -hsync +vsync

        Option       "PreferredMode"    "800x480"
        Option       "Ignore" "true"
EndSection

Section "Monitor"
        Identifier   "Monitor2"
        ModeLine     "1440x576_50i"     27.75   1440 1488 1612 1772   576  580  585  625  -hsync -vsync interlace
        Modeline     "1600x1200_50i"    65.92   1600 1696 1864 2131  1200 1203 1207 1238  -hsync +vsync interlace

        Option       "PreferredMode"    "1440x576_50i"
        Option       "Ignore" "true"
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "intel"

        Option      "monitor-VGA"               "Monitor0"
        Option      "monitor-LVDS"              "Monitor1"
        Option      "monitor-TMDS-1"            "Monitor2"

#        Option      "SyncFields"                "True"
#        Option      "SF_YScaleFineTune"         "0"
#        Option      "SF_YRGB_VPhase"            "0"
#        Option      "SF_UV_VPhase"              "0"
#        Option      "SF_SchedPrio"              "0"
        Option      "SF_Debug"                  "12000"

#       Option      "ModeDebug"                 "True"
EndSection

Section "Screen"
        Identifier "Screen0"
        Monitor    "Monitor0"
        Device     "Card0"
        DefaultDepth    24
        SubSection "Display"
            Virtual    3200 1200
        EndSubSection
EndSection
==============================================================================
relevant parts of setup.conf sample configuration for Radeon type of the patch
- all vertical scaling must be disabled
- sample setup tailored to a 4:3 TV

xineliboutput.DisplayAspect = automatic
xineliboutput.Frontend = sxfe
xineliboutput.Fullscreen = 1
xineliboutput.Video.AspectRatio = 0
xineliboutput.Video.Deinterlace = none
xineliboutput.Video.Driver = xv
xineliboutput.Video.Port = :0.0
xineliboutput.Video.Scale = 1
xineliboutput.Video.SwScale = 0
==============================================================================
relevant parts of setup.conf sample configuration for Intel type of the patch
- arbitrary scaling may take place
- sample setup tailored to a 4:3 TV

xineliboutput.DisplayAspect = 4:3
xineliboutput.Frontend = sxfe
xineliboutput.Fullscreen = 1
xineliboutput.Video.AspectRatio = 0
xineliboutput.Video.Deinterlace = none
xineliboutput.Video.Driver = xv
xineliboutput.Video.Port = :0.0
xineliboutput.Video.Scale = 1
xineliboutput.Video.SwScale = 0
==============================================================================
kernel parameters for linux console standard 640x480 screen resolution

standard video timing nowadays for linux vga console is 
720x400@70Hz 31kHz horiz. This video timing (before the Xserver comes up)
could be dangerous to a connected TV-set if not protected by special circuit.
That's why you explicitly must configure screen resolution to 
640x480@60Hz 31kHz horiz instead. 

so you add to the kernel parameters:

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

if you have recompiled your kernel with 'fb-drm-radeon-intel.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.
==============================================================================
kernel parameters for Intel console 720x576i or 800x520i screen resolution

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

video=intelfb:720x576-32@50i
or
video=intelfb: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.
==============================================================================

