Commit a268422d authored by Ondrej Zajicek's avatar Ondrej Zajicek Committed by Linus Torvalds

[PATCH] fbdev driver for S3 Trio/Virge

Add a driver for S3 Trio / S3 Virge.  Driver is tested with most versions
of S3 Trio and with S3 Virge/DX, on i386.

(akpm: We kind-of have support for this hardware already, but...

virgefb.c
  - amiga/zorro specific,
  - broken (according to Kconfig),
  - uses obsolete/nonexistent interface (struct display_switch)
  - recent Adrian Bunk's patch removes this driver

S3triofb.c
  - ppc/openfirmware specific
  - minimal functionality
  - broken (according to Kconfig),
  - uses obsolete/nonexistent interface (struct display_switch)
)
Signed-off-by: default avatarOndrej Zajicek <santiago@crfreenet.org>
Cc: James Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 59ae6c6b
s3fb - fbdev driver for S3 Trio/Virge chips
===========================================
Supported Hardware
==================
S3 Trio32
S3 Trio64 (and variants V+, UV+, V2/DX, V2/GX)
S3 Virge (and variants VX, DX, GX and GX2+)
S3 Plato/PX (completely untested)
S3 Aurora64V+ (completely untested)
- only PCI bus supported
- only BIOS initialized VGA devices supported
- probably not working on big endian
I tested s3fb on Trio64 (plain, V+ and V2/DX) and Virge (plain, VX, DX),
all on i386.
Supported Features
==================
* 4 bpp pseudocolor modes (with 18bit palette, two variants)
* 8 bpp pseudocolor mode (with 18bit palette)
* 16 bpp truecolor modes (RGB 555 and RGB 565)
* 24 bpp truecolor mode (RGB 888) on (only on Virge VX)
* 32 bpp truecolor mode (RGB 888) on (not on Virge VX)
* text mode (activated by bpp = 0)
* interlaced mode variant (not available in text mode)
* doublescan mode variant (not available in text mode)
* panning in both directions
* suspend/resume support
* DPMS support
Text mode is supported even in higher resolutions, but there is limitation
to lower pixclocks (maximum between 50-60 MHz, depending on specific hardware).
This limitation is not enforced by driver. Text mode supports 8bit wide fonts
only (hardware limitation) and 16bit tall fonts (driver limitation).
There are two 4 bpp modes. First mode (selected if nonstd == 0) is mode with
packed pixels, high nibble first. Second mode (selected if nonstd == 1) is mode
with interleaved planes (1 byte interleave), MSB first. Both modes support
8bit wide fonts only (driver limitation).
Suspend/resume works on systems that initialize video card during resume and
if device is active (for example used by fbcon).
Missing Features
================
(alias TODO list)
* secondary (not initialized by BIOS) device support
* big endian support
* Zorro bus support
* MMIO support
* 24 bpp mode support on more cards
* support for fontwidths != 8 in 4 bpp modes
* support for fontheight != 16 in text mode
* composite and external sync (is anyone able to test this?)
* hardware cursor
* video overlay support
* vsync synchronization
* feature connector support
* acceleration support (8514-like 2D, Virge 3D, busmaster transfers)
* better values for some magic registers (performance issues)
Known bugs
==========
* cursor disable in text mode doesn't work
--
Ondrej Zajicek <santiago@crfreenet.org>
......@@ -85,6 +85,14 @@ config FB_CFB_IMAGEBLIT
blitting. This is used by drivers that don't provide their own
(accelerated) version.
config FB_SVGALIB
tristate
depends on FB
default n
---help---
Common utility functions useful to fbdev drivers of VGA-based
cards.
config FB_MACMODES
tristate
depends on FB
......@@ -1147,6 +1155,17 @@ config FB_S3TRIO
help
If you have a S3 Trio say Y. Say N for S3 Virge.
config FB_S3
tristate "S3 Trio/Virge support"
depends on FB && PCI
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
select FB_CFB_IMAGEBLIT
select FB_TILEBLITTING
select FB_SVGALIB
---help---
Driver for graphics boards with S3 Trio / S3 Virge chip.
config FB_SAVAGE
tristate "S3 Savage support"
depends on FB && PCI && EXPERIMENTAL
......
......@@ -17,6 +17,7 @@ obj-$(CONFIG_SYSFS) += backlight/
obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o
obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o
obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
obj-$(CONFIG_FB_SVGALIB) += svgalib.o
obj-$(CONFIG_FB_MACMODES) += macmodes.o
obj-$(CONFIG_FB_DDC) += fb_ddc.o
......@@ -54,6 +55,7 @@ obj-$(CONFIG_FB_S3TRIO) += S3triofb.o
obj-$(CONFIG_FB_FM2) += fm2fb.o
obj-$(CONFIG_FB_CYBLA) += cyblafb.o
obj-$(CONFIG_FB_TRIDENT) += tridentfb.o
obj-$(CONFIG_FB_S3) += s3fb.o vgastate.o
obj-$(CONFIG_FB_STI) += stifb.o
obj-$(CONFIG_FB_FFB) += ffb.o sbuslib.o
obj-$(CONFIG_FB_CG6) += cg6.o sbuslib.o
......
This diff is collapsed.
This diff is collapsed.
......@@ -49,6 +49,13 @@
#define FB_AUX_TEXT_S3_MMIO 2 /* S3 MMIO fasttext */
#define FB_AUX_TEXT_MGA_STEP16 3 /* MGA Millenium I: text, attr, 14 reserved bytes */
#define FB_AUX_TEXT_MGA_STEP8 4 /* other MGAs: text, attr, 6 reserved bytes */
#define FB_AUX_TEXT_SVGA_GROUP 8 /* 8-15: SVGA tileblit compatible modes */
#define FB_AUX_TEXT_SVGA_MASK 7 /* lower three bits says step */
#define FB_AUX_TEXT_SVGA_STEP2 8 /* SVGA text mode: text, attr */
#define FB_AUX_TEXT_SVGA_STEP4 9 /* SVGA text mode: text, attr, 2 reserved bytes */
#define FB_AUX_TEXT_SVGA_STEP8 10 /* SVGA text mode: text, attr, 6 reserved bytes */
#define FB_AUX_TEXT_SVGA_STEP16 11 /* SVGA text mode: text, attr, 14 reserved bytes */
#define FB_AUX_TEXT_SVGA_LAST 15 /* reserved up to 15 */
#define FB_AUX_VGA_PLANES_VGA4 0 /* 16 color planes (EGA/VGA) */
#define FB_AUX_VGA_PLANES_CFB4 1 /* CFB4 in planes (VGA) */
......
#ifndef _LINUX_SVGA_H
#define _LINUX_SVGA_H
#ifdef __KERNEL__
#include <linux/pci.h>
#include <video/vga.h>
/* Terminator for register set */
#define VGA_REGSET_END_VAL 0xFF
#define VGA_REGSET_END {VGA_REGSET_END_VAL, 0, 0}
struct vga_regset {
u8 regnum;
u8 lowbit;
u8 highbit;
};
/* ------------------------------------------------------------------------- */
#define SVGA_FORMAT_END_VAL 0xFFFF
#define SVGA_FORMAT_END {SVGA_FORMAT_END_VAL, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, 0, 0, 0, 0, 0, 0}
struct svga_fb_format {
/* var part */
u32 bits_per_pixel;
struct fb_bitfield red;
struct fb_bitfield green;
struct fb_bitfield blue;
struct fb_bitfield transp;
u32 nonstd;
/* fix part */
u32 type;
u32 type_aux;
u32 visual;
u32 xpanstep;
u32 xresstep;
};
struct svga_timing_regs {
const struct vga_regset *h_total_regs;
const struct vga_regset *h_display_regs;
const struct vga_regset *h_blank_start_regs;
const struct vga_regset *h_blank_end_regs;
const struct vga_regset *h_sync_start_regs;
const struct vga_regset *h_sync_end_regs;
const struct vga_regset *v_total_regs;
const struct vga_regset *v_display_regs;
const struct vga_regset *v_blank_start_regs;
const struct vga_regset *v_blank_end_regs;
const struct vga_regset *v_sync_start_regs;
const struct vga_regset *v_sync_end_regs;
};
struct svga_pll {
u16 m_min;
u16 m_max;
u16 n_min;
u16 n_max;
u16 r_min;
u16 r_max; /* r_max < 32 */
u32 f_vco_min;
u32 f_vco_max;
u32 f_base;
};
/* Write a value to the attribute register */
static inline void svga_wattr(u8 index, u8 data)
{
inb(0x3DA);
outb(index, 0x3C0);
outb(data, 0x3C0);
}
/* Write a value to a sequence register with a mask */
static inline void svga_wseq_mask(u8 index, u8 data, u8 mask)
{
vga_wseq(NULL, index, (data & mask) | (vga_rseq(NULL, index) & ~mask));
}
/* Write a value to a CRT register with a mask */
static inline void svga_wcrt_mask(u8 index, u8 data, u8 mask)
{
vga_wcrt(NULL, index, (data & mask) | (vga_rcrt(NULL, index) & ~mask));
}
static inline int svga_primary_device(struct pci_dev *dev)
{
u16 flags;
pci_read_config_word(dev, PCI_COMMAND, &flags);
return (flags & PCI_COMMAND_IO);
}
void svga_wcrt_multi(const struct vga_regset *regset, u32 value);
void svga_wseq_multi(const struct vga_regset *regset, u32 value);
void svga_set_default_gfx_regs(void);
void svga_set_default_atc_regs(void);
void svga_set_default_seq_regs(void);
void svga_set_default_crt_regs(void);
void svga_set_textmode_vga_regs(void);
void svga_settile(struct fb_info *info, struct fb_tilemap *map);
void svga_tilecopy(struct fb_info *info, struct fb_tilearea *area);
void svga_tilefill(struct fb_info *info, struct fb_tilerect *rect);
void svga_tileblit(struct fb_info *info, struct fb_tileblit *blit);
void svga_tilecursor(struct fb_info *info, struct fb_tilecursor *cursor);
int svga_compute_pll(const struct svga_pll *pll, u32 f_wanted, u16 *m, u16 *n, u16 *r, int node);
int svga_check_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, int node);
void svga_set_timings(const struct svga_timing_regs *tm, struct fb_var_screeninfo *var, u32 hmul, u32 hdiv, u32 vmul, u32 vdiv, u32 hborder, int node);
int svga_match_format(const struct svga_fb_format *frm, struct fb_var_screeninfo *var, struct fb_fix_screeninfo *fix);
#endif /* __KERNEL__ */
#endif /* _LINUX_SVGA_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment