File: overview.txt

package info (click to toggle)
nvtv 0.4.7-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,328 kB
  • ctags: 4,303
  • sloc: ansic: 30,302; sh: 6,614; makefile: 159
file content (131 lines) | stat: -rw-r--r-- 6,601 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
This document wants to give a rough overview over the modules of the
source, so you can get an idea where to look if you want to make
changes.

How to produce TV-Out
~~~~~~~~~~~~~~~~~~~~~

The NVidia-card contains access to several I2C-Busses. These are slow
two-line busses used to communicate with peripherie. The TV-chip
is connected to one of those busses.

To access this chip, the program has to memory map the PCI-I/O-range
of the card into its address space. Then it can read and write
the card's registers, control the I2C-Bus and setup the registers
of the TV-chip. Finally, it has to change a few registers of the
card to enable or disable tv-out.

That's all there is to it.

Structure of the program
~~~~~~~~~~~~~~~~~~~~~~~~

There are three "layers" in nvtv: The "frontend" layer, where the user
interacts with the system, the "backend" layer, that encapsulates
different forms of access, and the "hardware" layer, where the video
hardware is accessed. The backend layer itself is split into to parts,
a card independent access part, and a card dependent part.

  
     Frontend           Backend (Access)    Backend (Card)       Hardware

                               ............+-------------+    +-------------+ 
                               .           | NVidia      |....| NVidia      | 
                       +---------------+ ..+-------------+    +-------------+ 
                       |  Direct/nvdev | .                                    
                    ...| (/dev/nv*)    | . +-------------+    +-------------+ 
 +---------------+  .  +---------------+ ..| Intel I810  |....| Intel I810  | 
 |  Main         |...  |  Direct/root  | . +-------------+    +-------------+ 
 | (Commandline) |  ...| (/dev/mem)    |..                                    
 +---------------+  .  +---------------+ . +-------------+    +-------------+ 
         |          .                    ..| 3DFX Voodoo |....| 3DFX Voodoo | 
         V          .                      +-------------+    +-------------+ 
 +----------------  .                                        
 |      GUI      |  .  +-----------------+---------------+    
 |     (GTK)     |.....|  Null           |               |   
 +---------------+  .  | (for testing)   |               |   
         |          .  +-----------------+---------------+   
         V          .                                        
 +---------------+  .  +-----------------+---------------+                   
 |  4 GUI parts  |  ...|  Client         |               |                   
 | (bt,cx,ch,ph) |  .  | (named pipe)    |               |                   
 +---------------+  .  +-----------------+---------------+                   
                    .                                        
 +----------------  .  +-----------------+---------------+    +-----------+ 
 |     Server    |.....|  XVidMode       |               |....| X Server  | 
 |  (named pipe) |     | (planned)       |               |    |           | 
 +---------------+     +-----------------+---------------+    +-----------+ 


There are four different backends at the moment. If the program is run
with root permissions, it can use /dev/mem to access the card.
Alternatively, even without root permissions, it can use the /dev/nv*
devices of the closed source NVidia kernel module for the access. 
However, this only works when the NVidia X driver is using the kernel
module, due to a bug in the kernel module. Both these backends are in
'back_direct.c' The third backend in 'back_none.c' is an empty 'stub'
backend, that however contains all four possible tv chips, used for
testing or calculating. The fourth backend in 'back_client.c' uses the
server, if it is available. For communication with each other, both
server and client use 'pipe.c'.

One of the front end is the server 'server.c', which is a standalone
program that just communicates with clients and passes the commands on
to one of the direct backends or the null backend. This frontend makes
up 'nvtvd'. The other two frontends are combined in 'nvtv'.  The
commandline interface is completely in 'main.c'. If nvtv is built with
GTK, the gui part is also available. The main gui routines are in
'gui.c' together with common subroutines. The encoder specific GUI for
the Brooktree, the Conexant, the Chrontel and the Philips encoder are
in 'gui_bt.c', 'gui_cx.c', 'gui_ch.c' and 'gui_ph.c', respectively. 
These are used depending on the tv chip detected/selected.

The last two backends use 'actions.c', which contains some X related
actions (changing the video mode, centering, selecting a window).

Besides these three layers, there is the data for the TV modes of all
four encoder types in 'data_bt.c', 'data_cx.c', 'data_ph.c' and
'data_ch.c'. This is where you can include your own modes, if you
want. For the Brooktree chip, the mode calculation for arbitrary
overscan compensation values takes place in 'calc_bt.c'.


The hardware layer is seperated because it is eventually meant to
become a part of the XFree server. All the files belonging to it start
with 'tv_', except the X I2C Bus routines in 'xf86i2c.c', which are
copied verbatim from the X server source. It has the following
structure:


   Hardware            TV Encoder               I2C Bus

                     
                     +---------------+ 
                  ...| Brooktree     |...
		  .  +---------------+  .
 		  .                     .
 +-------------+  .  +---------------+  .    +------------+
 | NVidia      |.....| Conexant      |...    | X I2C Bus  |
 +-------------+  .  +---------------+  .    |  routines  |
 		  .                     .    +------------+ 
 +-------------+  .  +---------------+  .          ^
 | Intel I810  |.....| Chrontel      |...          |
 +-------------+  .  +---------------+  .    +------------+
 		  .                     .....| I2C Bus    |
 +-------------+  .  +---------------+  .    |   access   |
 | 3DFX Voodoo |.....| Philips       |...    +------------+
 +-------------+  .  +---------------+             ^
 		  .                                |
 		  .  +---------------+    +-------------------+ 
 		  ...| Null          | 	  | Common            | 
 		  .  | (for testing) | 	  | (Detection, etc.) | 
                  .  +---------------+ 	  +-------------------+ 
 		  .                                .
		  ..................................

		     
Finally, there is 'libc_wrapper.c', which contains a few wrapper
routines from the XFree server, and 'xf86PciInfo.h', which is a 
slightly extended copy of the XFree server PCI id information.