Generally a frame buffer display is organized as follows:
+---+---------------+---+---+
+---#################---+---+
| 1 # \fB| 2 # 3 | 4 |
+---#################---+---+
+---+---------------+---+---+
+---+---------------+---+---+
1 t left margin
2 t xres
3 t right margin
4 t horizontal sync len
5 t upper margin
6 t yres
7 t lower margin
8 t vertical sync len
The area bordered with `#' is the visible display area. Horizontal and
vertical frequencies can now easily be calculated, for this the sum of
horizontal or vertical values are important
htotal = left + xres + right + hslen
vtotal = upper + yres + lower + vslen
The length of one line can now be calculated with pixclock
line = pixclock * htotal
and we have the horizontal frequency
hfreq = 1E12 / line = 1E12 / (pixclock * htotal)
To get the vertical frequency vtotal must eventually adjusted. If the
display is laced, vtotal must be halved or if the display is a doublescan
one, vtotal must be doubled. Now we can calculate the length of one frame
if (lace) vtotal /= 2
if (double) vtotal *= 2
frame = vtotal * line
and we get also the vertical frequency
vfreq = 1E12 / frame = hfreq / vtotal