matroxfb - Framebuffer driver for Matrox devices

This is a driver for a graphic framebuffer for Matrox devices onAlpha, Intel and PPC boxes.

Advantages:

  • It provides a nice large console (128 cols + 48 lines with 1024x768)without using tiny, unreadable fonts.

  • You can run XF{68,86}_FBDev or XFree86 fbdev driver on top of /dev/fb0

  • Most important: boot logo :-)

Disadvantages:

  • graphic mode is slower than text mode... but you should not noticeif you use same resolution as you used in textmode.

How to use it?

Switching modes is done using the video=matroxfb:vesa:... boot parameteror usingfbset program.

If you want, for example, enable a resolution of 1280x1024x24bpp you shouldpass to the kernel this command line: “video=matroxfb:vesa:0x1BB”.

You should compile in both vgacon (to boot if you remove you Matrox frombox) and matroxfb (for graphics mode). You should not compile-in vesafbunless you have primary display on non-Matrox VBE2.0 device (seevesafb - Generic graphic framebuffer driver for details).

Currently supported video modes are (through vesa:... interface, PowerMachas [as addon] compatibility code):

Graphic modes

bpp

640x400

640x480

768x576

800x600

960x720

4

0x12

0x102

8

0x100

0x101

0x180

0x103

0x188

15

0x110

0x181

0x113

0x189

16

0x111

0x182

0x114

0x18A

24

0x1B2

0x184

0x1B5

0x18C

32

0x112

0x183

0x115

0x18B

Graphic modes (continued)

bpp

1024x768

1152x864

1280x1024

1408x1056

1600x1200

4

0x104

0x106

8

0x105

0x190

0x107

0x198

0x11C

15

0x116

0x191

0x119

0x199

0x11D

16

0x117

0x192

0x11A

0x19A

0x11E

24

0x1B8

0x194

0x1BB

0x19C

0x1BF

32

0x118

0x193

0x11B

0x19B

Text modes

text

640x400

640x480

1056x344

1056x400

1056x480

8x8

0x1C0

0x108

0x10A

0x10B

0x10C

8x16

2, 3, 7

0x109

You can enter these number either hexadecimal (leading0x) or decimal(0x100 = 256). You can also use value + 512 to achieve compatibilitywith your old number passed to vesafb.

Non-listed number can be achieved by more complicated command-line, forexample 1600x1200x32bpp can be specified byvideo=matroxfb:vesa:0x11C,depth:32.

X11

XF{68,86}_FBDev should work just fine, but it is non-accelerated. On non-intelarchitectures there are some glitches for 24bpp videomodes. 8, 16 and 32bppworks fine.

Running another (accelerated) X-Server like XF86_SVGA works too. But (at least)XFree servers have big troubles in multihead configurations (even on firsthead, not even talking about second). Running XFree86 4.x accelerated mgadriver is possible, but you must not enable DRI - if you do, resolution andcolor depth of your X desktop must match resolution and color depths of yourvirtual consoles, otherwise X will corrupt accelerator settings.

SVGALib

Driver contains SVGALib compatibility code. It is turned on by choosing textualmode for console. You can do it at boot time by using videomode2,3,7,0x108-0x10C or 0x1C0. At runtime,fbset -depth 0 does this work.Unfortunately, after SVGALib application exits, screen contents is corrupted.Switching to another console and back fixes it. I hope that it is SVGALib’sproblem and not mine, but I’m not sure.

Configuration

You can pass kernel command line options to matroxfb withvideo=matroxfb:option1,option2:value2,option3 (multiple options should beseparated by comma, values are separated from options by:).Accepted options:

mem:X

size of memory (X can be in megabytes, kilobytes or bytes)You can only decrease value determined by driver because ofit always probe for memory. Default is to use whole detectedmemory usable for on-screen display (i.e. max. 8 MB).

disabled

do not load driver; you can use alsooff, butdisabledis here too.

enabled

load driver, if you havevideo=matroxfb:disabled in LILOconfiguration, you can override it by this (you cannot overrideoff). It is default.

noaccel

do not use acceleration engine. It does not work on Alphas.

accel

use acceleration engine. It is default.

nopan

create initial consoles with vyres = yres, thus disabling virtualscrolling.

pan

create initial consoles as tall as possible (vyres = memory/vxres).It is default.

nopciretry

disable PCI retries. It is needed for some broken chipsets,it is autodetected for intel’s 82437. In this case device doesnot comply to PCI 2.1 specs (it will not guarantee that everytransaction terminate with success or retry in 32 PCLK).

pciretry

enable PCI retries. It is default, except for intel’s 82437.

novga

disables VGA I/O ports. It is default if BIOS did not enabledevice. You should not use this option, some boards then do notrestart without power off.

vga

preserve state of VGA I/O ports. It is default. Driver does notenable VGA I/O if BIOS did not it (it is not safe to enable it inmost cases).

nobios

disables BIOS ROM. It is default if BIOS did not enable BIOSitself. You should not use this option, some boards then do notrestart without power off.

bios

preserve state of BIOS ROM. It is default. Driver does not enableBIOS if BIOS was not enabled before.

noinit

tells driver, that devices were already initialized. You should useit if you have G100 and/or if driver cannot detect memory, you seestrange pattern on screen and so on. Devices not enabled by BIOSare still initialized. It is default.

init

driver initializes every device it knows about.

memtype

specifies memory type, implies ‘init’. This is valid only for G200and G400 and has following meaning:

G200:
  • 0 -> 2x128Kx32 chips, 2MB onboard, probably sgram

  • 1 -> 2x128Kx32 chips, 4MB onboard, probably sgram

  • 2 -> 2x256Kx32 chips, 4MB onboard, probably sgram

  • 3 -> 2x256Kx32 chips, 8MB onboard, probably sgram

  • 4 -> 2x512Kx16 chips, 8/16MB onboard, probably sdram only

  • 5 -> same as above

  • 6 -> 4x128Kx32 chips, 4MB onboard, probably sgram

  • 7 -> 4x128Kx32 chips, 8MB onboard, probably sgram

G400:
  • 0 -> 2x512Kx16 SDRAM, 16/32MB

  • 2x512Kx32 SGRAM, 16/32MB

  • 1 -> 2x256Kx32 SGRAM, 8/16MB

  • 2 -> 4x128Kx32 SGRAM, 8/16MB

  • 3 -> 4x512Kx32 SDRAM, 32MB

  • 4 -> 4x256Kx32 SGRAM, 16/32MB

  • 5 -> 2x1Mx32 SDRAM, 32MB

  • 6 -> reserved

  • 7 -> reserved

You should use sdram or sgram parameter in addition to memtypeparameter.

nomtrr

disables write combining on frame buffer. This slows down driverbut there is reported minor incompatibility between GUS DMA andXFree under high loads if write combining is enabled (sounddropouts).

mtrr

enables write combining on frame buffer. It speeds up videoaccesses much. It is default. You must have MTRR support enabledin kernel and your CPU must have MTRR (f.e. Pentium II have them).

sgram

tells to driver that you have Gxx0 with SGRAM memory. It has noeffect withoutinit.

sdram

tells to driver that you have Gxx0 with SDRAM memory.It is a default.

inv24

change timings parameters for 24bpp modes on Millennium andMillennium II. Specify this if you see strange color shadowsaround characters.

noinv24

use standard timings. It is the default.

inverse

invert colors on screen (for LCD displays)

noinverse

show true colors on screen. It is default.

dev:X

bind driver to device X. Driver numbers device from 0 up to N,where device 0 is firstknown device found, 1 second and so on.lspci lists devices in this order.Default isevery known device.

nohwcursor

disables hardware cursor (use software cursor instead).

hwcursor

enables hardware cursor. It is default. If you are usingnon-accelerated mode (noaccel orfbset -accel false), softwarecursor is used (except for text mode).

noblink

disables cursor blinking. Cursor in text mode always blinks (hwlimitation).

blink

enables cursor blinking. It is default.

nofastfont

disables fastfont feature. It is default.

fastfont:X

enables fastfont feature. X specifies size of memory reserved forfont data, it must be >= (fontwidth*fontheight*chars_in_font)/8.It is faster on Gx00 series, but slower on older cards.

grayscale

enable grayscale summing. It works in PSEUDOCOLOR modes (text,4bpp, 8bpp). In DIRECTCOLOR modes it is limited to charactersdisplayed through putc/putcs. Direct accesses to framebuffercan paint colors.

nograyscale

disable grayscale summing. It is default.

cross4MB

enables that pixel line can cross 4MB boundary. It is default fornon-Millennium.

nocross4MB

pixel line must not cross 4MB boundary. It is default forMillennium I or II, because of these devices have hardwarelimitations which do not allow this. But this option isincompatible with some (if not all yet released) versions ofXF86_FBDev.

dfp

enables digital flat panel interface. This option is incompatiblewith secondary (TV) output - if DFP is active, TV output must beinactive and vice versa. DFP always uses same timing as primary(monitor) output.

dfp:X

use settings X for digital flat panel interface. X is number from0 to 0xFF, and meaning of each individual bit is described inG400 manual, in description of DAC register 0x1F. For normaloperation you should set all bits to zero, except lowest bit. Thislowest bit selects who is source of display clocks, whether G400,or panel. Default value is now read back from hardware - so youshould specify this value only if you are also usinginitparameter.

outputs:XYZ

set mapping between CRTC and outputs. Each letter can have valueof 0 (for no CRTC), 1 (CRTC1) or 2 (CRTC2), and first lettercorresponds to primary analog output, second letter to thesecondary analog output and third letter to the DVI output.Default setting is 100 for cards below G400 or G400 without DFP,101 for G400 with DFP, and 111 for G450 and G550. You can setmapping only on first card, use matroxset for setting up otherdevices.

vesa:X

selects startup videomode. X is number from 0 to 0x1FF, see tableabove for detailed explanation. Default is 640x480x8bpp if driverhas 8bpp support. Otherwise first available of 640x350x4bpp,640x480x15bpp, 640x480x24bpp, 640x480x32bpp or 80x25 text(80x25 text is always available).

If you are not satisfied with videomode selected byvesa option, youcan modify it with these options:

xres:X

horizontal resolution, in pixels. Default is derived fromvesaoption.

yres:X

vertical resolution, in pixel lines. Default is derived fromvesaoption.

upper:X

top boundary: lines between end of VSYNC pulse and start of firstpixel line of picture. Default is derived fromvesa option.

lower:X

bottom boundary: lines between end of picture and start of VSYNCpulse. Default is derived fromvesa option.

vslen:X

length of VSYNC pulse, in lines. Default is derived fromvesaoption.

left:X

left boundary: pixels between end of HSYNC pulse and first pixel.Default is derived fromvesa option.

right:X

right boundary: pixels between end of picture and start of HSYNCpulse. Default is derived fromvesa option.

hslen:X

length of HSYNC pulse, in pixels. Default is derived fromvesaoption.

pixclock:X

dotclocks, in ps (picoseconds). Default is derived fromvesaoption and fromfh andfv options.

sync:X

sync. pulse - bit 0 inverts HSYNC polarity, bit 1 VSYNC polarity.If bit 3 (value 0x08) is set, composite sync instead of HSYNC isgenerated. If bit 5 (value 0x20) is set, sync on green is turnedon. Do not forget that if you want sync on green, you also probablywant composite sync.Default depends onvesa.

depth:X

Bits per pixel: 0=text, 4,8,15,16,24 or 32. Default depends onvesa.

If you know capabilities of your monitor, you can specify some (or all) ofmaxclk,fh andfv. In this case,pixclock is computed so thatpixclock <= maxclk, real_fh <= fh and real_fv <= fv.

maxclk:X

maximum dotclock. X can be specified in MHz, kHz or Hz. Default isdon`t care.

fh:X

maximum horizontal synchronization frequency. X can be specifiedin kHz or Hz. Default isdon’t care.

fv:X

maximum vertical frequency. X must be specified in Hz. Default is70 for modes derived fromvesa with yres <= 400, 60Hz foryres > 400.

Limitations

There are known and unknown bugs, features and misfeatures.Currently there are following known bugs:

  • SVGALib does not restore screen on exit

  • generic fbcon-cfbX procedures do not work on Alphas. Due to this,noaccel (and cfb4 accel) driver does not work on Alpha. So everyonewith access to/dev/fb* on Alpha can hang machine (you should restrictaccess to/dev/fb* - everyone with access to this device can destroyyour monitor, believe me...).

  • 24bpp does not support correctly XF-FBDev on big-endian architectures.

  • interlaced text mode is not supported; it looks like hardware limitation,but I’m not sure.

  • Gxx0 SGRAM/SDRAM is not autodetected.

  • maybe more...

And following misfeatures:

  • SVGALib does not restore screen on exit.

  • pixclock for text modes is limited by hardware to

    • 83 MHz on G200

    • 66 MHz on Millennium I

    • 60 MHz on Millennium II

    Because I have no access to other devices, I do not know specificfrequencies for them. So driver does not check this and allows you toset frequency higher that this. It causes sparks, black holes and otherpretty effects on screen. Device was not destroyed during tests. :-)

  • my Millennium G200 oscillator has frequency range from 35 MHz to 380 MHz(and it works with 8bpp on about 320 MHz dotclocks (and changed mclk)).But Matrox says on product sheet that VCO limit is 50-250 MHz, so I believethem (maybe that chip overheats, but it has a very big cooler (G100 hasnone), so it should work).

  • special mixed video/graphics videomodes of Mystique and Gx00 - 2G8V16 andG16V16 are not supported

  • color keying is not supported

  • feature connector of Mystique and Gx00 is set to VGA mode (it is disabledby BIOS)

  • DDC (monitor detection) is supported through dualhead driver

  • some check for input values are not so strict how it should be (you canspecify vslen=4000 and so on).

  • maybe more...

And following features:

  • 4bpp is available only on Millennium I and Millennium II. It is hardwarelimitation.

  • selection between 1:5:5:5 and 5:6:5 16bpp videomode is done by -rgbaoption of fbset: “fbset -depth 16 -rgba 5,5,5” selects 1:5:5:5, anythingelse selects 5:6:5 mode.

  • text mode uses 6 bit VGA palette instead of 8 bit (one of 262144 colorsinstead of one of 16M colors). It is due to hardware limitation ofMillennium I/II and SVGALib compatibility.

Benchmarks

It is time to redraw whole screen 1000 times in 1024x768, 60Hz. It istime for draw 6144000 characters on screen through /dev/vcsa(for 32bpp it is about 3GB of data (exactly 3000 MB); for 8x16 font in16 seconds, i.e. 187 MBps).Times were obtained from one older version of driver, now they are about 3%faster, it is kernel-space only time on P-II/350 MHz, Millennium I in 33 MHzPCI slot, G200 in AGP 2x slot. I did not test vgacon:

NOACCEL      8x16                 12x22      Millennium I  G200   Millennium I  G2008bpp    16.42         9.54   12.33         9.1316bpp   21.00        15.70   19.11        15.0224bpp   36.66        36.66   35.00        35.0032bpp   35.00        30.00   33.85        28.66ACCEL, nofastfont      8x16                 12x22                6x11      Millennium I  G200   Millennium I  G200   Millennium I  G2008bpp     7.79         7.24   13.55         7.78   30.00        21.0116bpp    9.13         7.78   16.16         7.78   30.00        21.0124bpp   14.17        10.72   18.69        10.24   34.99        21.0132bpp   16.15      16.16   18.73        13.09   34.99        21.01ACCEL, fastfont      8x16                 12x22                6x11      Millennium I  G200   Millennium I  G200   Millennium I  G2008bpp     8.41         6.01    6.54         4.37   16.00        10.5116bpp    9.54         9.12    8.76         6.17   17.52        14.0124bpp   15.00        12.36   11.67        10.00   22.01        18.3232bpp   16.18        18.29*  12.71        12.74   24.44        21.00TEXT      8x16      Millennium I  G200TEXT     3.29         1.50* Yes, it is slower than Millennium I.

Dualhead G400

Driver supports dualhead G400 with some limitations:
  • secondary head shares videomemory with primary head. It is not problemif you have 32MB of videoram, but if you have only 16MB, you may haveto think twice before choosing videomode (for example twice 1880x1440x32bppis not possible).

  • due to hardware limitation, secondary head can use only 16 and 32bppvideomodes.

  • secondary head is not accelerated. There were bad problems with acceleratedXFree when secondary head used to use acceleration.

  • secondary head always powerups in640x480@60-32 videomode. You have to usefbset to change this mode.

  • secondary head always powerups in monitor mode. You have to use fbmatroxsetto change it to TV mode. Also, you must select at least 525 lines forNTSC output and 625 lines for PAL output.

  • kernel is not fully multihead ready. So some things are impossible to do.

  • if you compiled it as module, you must insert i2c-matroxfb, matroxfb_mavenand matroxfb_crtc2 into kernel.

Dualhead G450

Driver supports dualhead G450 with some limitations:
  • secondary head shares videomemory with primary head. It is not problemif you have 32MB of videoram, but if you have only 16MB, you may haveto think twice before choosing videomode.

  • due to hardware limitation, secondary head can use only 16 and 32bppvideomodes.

  • secondary head is not accelerated.

  • secondary head always powerups in640x480@60-32 videomode. You have to usefbset to change this mode.

  • TV output is not supported

  • kernel is not fully multihead ready, so some things are impossible to do.

  • if you compiled it as module, you must insert matroxfb_g450 and matroxfb_crtc2into kernel.

Petr Vandrovec <vandrove@vc.cvut.cz>