Some notes and ideas for integrating TV into XFree NV Driver

composite flag marks a dual view TV mode

crt-frequencies are checked against monitor description

modeline allows y adjusting of both TV and monitor, and x adjusting of
monitor. X adjusting of TV is done with "hskew" item.

Monitor section options:

HorizOverscan, VertOverscan, AspectRatio = Range [; Best [; Weight]]

Option "HorizOverscan" "8-13; 10; 100"
Option "VertOverscan"  "8-13; 9; 100"
Option "AspectRatio"   "90-110; 100; 200"
Option "TVStandard"    "PAL"
Option "TVOutput"      "AUTO" / "FBAS" / "SVHS" / "BOTH"

For each modeline, calculate best overscan values. Print in log.
If verbose, print all possible considered overscan values.
Drop modeline if no overscan can be found.

For Chrontel, find closest predefined mode.

Macrovision is always off.

Cannot set flicker, color, brightness for each modeline ... only globally. 

---

Alternative (Hack):

Use vscale as index into options. Then options in the form

option "1:Size" "Large"
option "1:HOffset" "10"
option "*:Macrovision" "Off"
option "2:FlickerFilter" "50"
option "*:FlickerFilter" "100"

allow control for tv modelines, until modelines can get the options
themselves.

----

Better: Need a generic way to (a) parse and (b) store private
information for each modeline (parameters as well as tv chip
registers, for example).

There is already a private field in XF86VidModeModeLine, though this
is no longer transfered by news servers!!

Example in XF86Config:

Mode
  DotClock 30.0
  HTimings ...
  VTimings ...
  Option "TV" "Dualview,NoMacroVision"
  Option "HOverscanComp" "10.0"
  Option "VOverscanComp" "12.0"
  Option "HOffset" "10"
  Option "VOffset" "-20"
  Option "Brightness" "90.0"
  Option "FlickerFilter" "5"
EndMode

----

Communicate to running X server via 'Private' pointer in XVidMode extension. 
But: This is no longer transfered by new servers! (Xext/xf86vmode.c)

Use fake SetModeLine with special flag followed by getmodeline
to access database.

Points to record:
  4byte    magic "nvtv"
  struct   settings (change settings, independent of vt chip)  
  int      type (brooktree, chrontel, ...)
  union    chipregs, modedescription

PrivFlags:
  NV_PRIV_TVMODE
  NV_PRIV_DUALVIEW
  NV_PRIV_WIDESCREEN
  NV_PRIV_TEST_IMAGE
  NV_PRIV_SETTINGS
  NV_PRIV_BYPASS
  NV_PRIV_CHIPREGS
  NV_DESC_SIZE
  NV_DESC_OVERSCAN

When returned (XF86VidModeGetModeLine):
  always 4byte magic and empty record, even in non-tv modes
  in tv-modes: TVMODE set, DUALVIEW if appropriate, rest cleared

When set: (XF86VidModeSwitchToMode)
  TVMODE   if this is a TV mode
  DUALVIEW if dualview should be enabled
  DESC_*   if should switch to new mode by desc of type
  CHIPREGS if chipregs are supplied to set directly
  BYPASS   if chipregs shouldn't be modified by settings
  SETTINGS if settings are supplied.
  TEST_IMG if testimage (color bars) should be displayed; even in non TVMODE.

So:

* to change mode,      use TVMODE | DESC_*
* to change settings,  use TVMODE | SETTINGS
* to program directly, use TVMODE | CHIPREG | BYPASS

Model:

  mode -> chipregs -> settings -> actual reg values
 
This assumes database is integrated in driver. Since at least the
Chrontel database must be present, this makes sense.
