AUTHOR: Jim Mischel <jim@mischel.com>

DATE: 2003-09-11

LICENSE: GNU Free Documentation License Version 1.2

SYNOPSIS: Getting high-resolution console modes using SVGATextMode.

DESCRIPTION:
The default console modes supplied in the Linux kernel access only a small
fraction of the console modes that most video hardware can handle.  The
SVGATextMode utility gives you access to the full range of console modes
that your hardware can support.  If you've been wanting a console with
50 lines of 132 characters, this is the place to look.

PREREQUISITES:
None known.

HINT:

0. IMPORTANT NOTE
-----------------
It is possible to damage your hardware (specifically, your monitor and your
video card) using the program described in this hint (SVGATextMode).  Be very
careful when specifying your video card's and monitor's capabilities.  Be sure
to read the documentation that comes with the SVGATextMode program, especially
the README.FIRST file, and the notes at the top of TextConfig.

The author of this hint, and the authors and maintainers of SVGATextMode
cannot be held responsible for any damage caused to your hardware.


I. Introduction
---------------
The default console mode set by the Linux kernel is 25 lines of 80 characters.
That's fine if you're not doing much at the console, or if you use a console
window from X where you can make the window as big as you like.  But if you're
doing a lot of work at the console, 80x25 just isn't big enough!  80x25 is an
EGA mode selected by the kernel because all common PC hardware supports it.
But most video cards and monitors these days are capable of much higher
resolutions simply by reprogramming the registers on your VGA card.  What
would you say to 50 lines of 132 characters each?


II. Text mode or graphics mode?
-------------------------------
The Linux kernel itself provides two different ways to specify text modes
larger than 80x25.  The first is the video mode selection support that is
documented in the svga.txt file found in the kernel source's Documentation
directory.  With this support, you can specify any of the standard and
extended VGA text modes, and also (if you're fortunate) some custom modes.
The problem is that the kernel's automatic detection of video cards is not
terribly reliable.

Current Linux kernel versions also include framebuffer support, which will
give you a high-resolution console provided you enable framebuffer support
in your kernel configuration.  Although it's a nice feature, using framebuffer
puts your video card into graphics mode, resulting in very slow scrolling.  On
an older, slower computer, a graphics mode console is unbearable.

In either case, kernel support does not include a way to change text modes
on the fly.


III. SVGATextMode
-----------------
SVGATextMode is a program that supports a wide range of video cards and chip
sets.  You specify your video card and the capabilities of your monitor in an
X-like configuration file, and then run the program telling it what text mode
to display.  SVGATextMode talks directly to the hardware, rather than to the
BIOS, to set the video mode.  Specifying your video card and monitor
capabilities helps prevent SVGATextMode from trying to change into a mode that
will damage the video card or the monitor.

The configuration file also contains descriptions of many different text modes
that you can try.  Some you probably won't be able to use due to hardware
limitations, and others are just plain ugly.  But you should be able to find
several high-resolution modes that will improve on the standard 80x25 and
other modes supported directly by the kernel.


IV. Download and installation
------------------------------
Source for the current version of SVGATextMode (version 1.10) is available at
ftp.ibiblio.org/pub/Linux/utils/console/SVGATEXTMODE-1.10-src.tar.gz.  Download
that file and extract it to your build directory.  It was created using an
older version of gcc, and might not compile as is with more current gcc 
versions.  If you're using gcc version 3.2 or later, or if you get build errors,
download and apply the patch SVGATextMode-1.10.patch that is included with this
hint.

To build the program, change to the directory that contains the extracted source.
If you must apply the patch, then enter this command:

patch -Np1 -i ../SVGATextMode-1.10.patch

Once the patch is applied (if necessary), you can build the SVGATextMode
program by entering the following commands:

make &&
make install &&
make man-install &&
cp TextConfig /etc/TextConfig

SVGATextMode is installed in the /usr/sbin directory.


V. Configuration
----------------
After installation, open the /etc/TextConfig file in your favorite editor.

!! READ THE HINTS AND WARNINGS AT THE TOP OF THE FILE !!

The default setting for SVGATextMode is standard VGA, which is highly sub-
optimal for most modern Linux systems.  You'll want to change the configuration
settings in this file to match your video card and monitor.  Down about line
60 of the TextConfig file is this text:

Chipset "VGA"
Clocks 25.175 28.322

You want to comment those lines out by placing '#' characters at the beginning
of the lines.  Then, scroll down through the (long!) list of chip sets to
locate the one that matches your video card.  Uncomment the line, and the
"Clocks" or "Clockchip" line for your card.  For example, I un-commented
these two lines for my S3 Virge based video card:

Chipset		"S3"
ClockChip "S3Virge"

Many of the pre-configured cards have additional settings with which you may
want to experiment.

IMPORTANT:  You should be absolutely sure about the kind of video card you have,
and specify it properly here.  If you have any doubt, get out the documentation
for your card, or examine the card itself to see what chips are on it.

After you have configured the video card, you need to tell SVGATextMode your
monitor's allowable horizontal sync and vertical refresh timings.

Find these two lines in TextConfig:

#HorizSync 30-32
#VertRefresh 50-80

These are defaults that will work with almost all monitors.  But most monitors
are capable of much more than this.  Uncomment these two lines and look in the
manual to find the allowable values for your monitor.  It's possible that those
numbers will be printed on the back of the monitor, as well.  It's very
important that you enter the correct numbers for your monitor here.  Failure to
do this can cause SVGATextMode to send signals that will fry your monitor.

Once you've made these changes, save the file and return to your console prompt.


VI. Testing
-----------
Note that not all modes modes will work with all cards.  It's possible to 
scramble your display such that you can't make head or tails of it.  
Fortunately, the default mode is 80x25, which should work with all displays, 
so just typing SVGATextMode (blindly, if you have to) should restore your 
screen.  If you have changed the default text mode in TextConfig, then you'll 
need to type

SVGATextMode 80x25

in order to get things back to normal.  If you have the savetextmode and
textmode programs, you can type savetextmode to save the current mode before
testing SVGATextMode.  If your screen becomes scrambled, just type textmode
(blindly, possibly) to restore the screen.

It's a good idea at this time to close any programs that have unsaved data.

At the command prompt, enter

SVGATextMode 80x25

or, try

SVGATextMode -o

The program should show you some status information and set the video mode.
You won't notice any change here, because that's the normal operating mode.  If
your screen is scrambled here, then you probably configured something wrong.
If you don't have textmode to restore the screen, you'll probably have to
reboot.

Select one of the text modes from the long list of pre-configured modes that
are at the end of /etc/TextConfig.  It's a good idea to try one of the
"standard" modes first.  For example, most SVGA cards should support
a 132x50 line screen.  Try

SVGATextMode 132x50x9

You may want to experiment with other modes, or with creating your own.


VII. Final Configuration
-------------------------
The default TextConfig file enables the "SyncDisks" option to flush the disk
cache before trying to reprogram the mode.  This is useful when testing, but
once you've determined that SVGATextMode is working, you can disable this
option and comment out the corresponding message in TextConfig.  You will also
want to comment out the lines (starting at about line 70) that echo a message
about configuration.


VIII. Going further
-------------------
SVGATextMode comes with a few other programs, and very good documentation.
Be sure to scan the files in the doc directory, and the man pages for more
information about using this fine program.

CHANGELOG:

[2002-09-16]
  * Initial hint
[2003-09-11]
  * Cleaned up a couple of typos
  * Converted to new hint format
