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

Version:                      0.1.0

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

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

Current development: git clone git://vga2scart.gw90.de/git/vga2scart

Wiki: http://vga2scart.gw90.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.

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                                                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

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

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

	HorizSync    15-16
	VertRefresh  50-51
	Modeline  "720x576_50i"      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"

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

EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth    24
        SubSection "Display"
                Viewport   0 0
                Depth      24
                Modes      "720x576i"
        EndSubSection
EndSection
==============================================================================
relevant parts of xorg.conf sample configuration for Intel type of the patch

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

        HorizSync    15-16
        VertRefresh  50-51
        ModeLine     "1440x576_50i"     27.75   1440 1488 1609 1769   576  580  585  625  -hsync -vsync interlace
EndSection

Section "Device"
        Identifier  "Card0"
        Driver      "intel"
        VendorName  "Intel Corporation"
        BoardName   "82945G/GZ Integrated Graphics Controller"

        Option      "monitor-VGA"               "Monitor0"

       Option      "SyncFields"                "True"
#       Option      "SF_YScaleFineTune"         "1"
#       Option      "SF_YRGB_VPhase"            "0x77777777"
#       Option      "SF_UV_VPhase"              "0"
#       Option      "SF_SchedPrio"              "0"
#       Option      "SF_Debug"                  "True"

#       Option      "ModeDebug"                 "True"
EndSection

Section "Screen"
        Identifier "Screen0"
        Device     "Card0"
        Monitor    "Monitor0"
        DefaultDepth    24
        SubSection "Display"
            Viewport   0 0
            Depth      24
            Modes      "1440x576_50i"
        EndSubSection
EndSection
==============================================================================
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.
==============================================================================

