<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Computing Frame Sizes</TITLE>
</HEAD>
<BODY BGCOLOR="#efefef" TEXT="black" LINK="blue" VLINK="#551A8B" ALINK="red">

<A HREF="VideoModes.html"><EM>XFree86 Video Timings HOWTO</EM></A>
 <b>:</b> <EM>Computing Frame Sizes</EM><BR>
<b>Previous:</b> <A HREF="VideoModes7.html"><EM>Memory Requirements</EM></A><BR>
<b>Next:</b> <A HREF="VideoModes9.html"><EM>Black Magic and Sync Pulses</EM></A>


<HR NOSHADE>
  <H2><A NAME="12"></A>8. Computing Frame Sizes<A NAME="frame"></A></H2>

<p>Warning: this method was developed for multisync monitors.  It will probably
work with fixed-frequency monitors as well, but no guarantees! </p>
<p>Start by dividing DCF by your highest available HSF to get a horizontal
frame length. </p>
<p>For example; suppose you have a Sigma Legend SVGA with a 65MHz dot clock, and
your monitor has a 55KHz horizontal scan frequency.  The quantity (DCF / HSF)
is then 1181 (65MHz = 65000KHz; 65000/55 = 1181). </p>
<p>Now for our first bit of black magic.  You need to round this figure to the
nearest multiple of 8.  This has to do with the VGA hardware controller used by
SVGA and S3 cards; it uses an 8-bit register, left-shifted 3 bits, for what's
really an 11-bit quantity.  Other card types such as ATI 8514/A may not have
this requirement, but we don't know and the correction can't hurt.  So round
the usable horizontal frame length figure down to 1176. </p>
<p>This figure (DCF / HSF rounded to a multiple of 8) is the minimum HFL you can
use.  You can get longer HFLs (and thus, possibly, more horizontal dots on the
screen) by setting the sync pulse to produce a lower HSF.  But you'll pay with
a slower and more visible flicker rate. </p>
<p>As a rule of thumb, 80% of the horizontal frame length is available for
horizontal resolution, the visible part of the horizontal scan line (this
allows, roughly, for borders and sweepback time -- that is, the time required
for the beam to move from the right screen edge to the left edge of the next
raster line).  In this example, that's 944 ticks. </p>
<p>Now, to get the normal 4:3 screen aspect ratio, set your vertical resolution
to 3/4ths of the horizontal resolution you just calculated.   For this
example, that's 708 ticks.  To get your actual VFL, multiply that by 1.05
to get 743 ticks. </p>
<p>The 4:3 is not technically magic; nothing prevents you from using a
non-Golden-Section ratio if that will get the best use out of your
screen real estate.  It does make figuring frame height and frame
width from the diagonal size convenient, you just multiply the
diagonal by by 0.8 to get width and 0.6 to get height.</p>
<p>So, HFL=1176 and VFL=743.  Dividing 65MHz by the product of the two gives
us a nice, healthy 74.4Hz refresh rate.  Excellent!  Better than VESA standard!
And you got 944x708 to boot, more than the 800 by 600 you were probably
expecting.  Not bad at all! </p>
<p>You can even improve the refresh rate further, to almost 76 Hz, by using the
fact that monitors can often sync horizontally at 2khz or so higher than rated,
and by lowering VFL somewhat (that is, taking less than 75% of 944 in the
example above).  But before you try this "overdriving" maneuver, if you do,
make <em>sure</em> that your monitor electron guns can sync up to 76 Hz
vertical.  (the popular NEC 4D, for instance, cannot.  It goes only up to 75 Hz
VSF).  (See 
<A HREF="VideoModes11.html#overd">Overdriving Your Monitor</A> for more general
discussion of this issue. )</p>
<p>So far, most of this is simple arithmetic and basic facts about raster
displays.  Hardly any black magic at all! </p>

 <HR NOSHADE>
<A HREF="VideoModes.html"><EM>XFree86 Video Timings HOWTO</EM></A>
 <b>:</b> <EM>Computing Frame Sizes</EM><BR>
<b>Previous:</b> <A HREF="VideoModes7.html"><EM>Memory Requirements</EM></A><BR>
<b>Next:</b> <A HREF="VideoModes9.html"><EM>Black Magic and Sync Pulses</EM></A>



</BODY>
</HTML>
