Commit 0d80a818 authored by James Simmons's avatar James Simmons

Synced to Linus tree,

parents 572f2a49 9f880dd8
......@@ -2846,6 +2846,7 @@ S: 76131 Karlsruhe
S: Germany
N: James Simmons
E: jsimmons@infradead.org
E: jsimmons@users.sf.net
D: Frame buffer device maintainer
D: input layer developement
......
Intel 810/815 Framebuffer driver
Tony Daplas <adaplas@pol.net>
http://i810fb.sourceforge.net
March 17, 2002
First Released: July 2001
================================================================
A. Introduction
This is a framebuffer driver for various Intel 810/815 compatible
graphics devices. These would include:
Intel 810
Intel 810E
Intel 810-DC100
Intel 815 Internal graphics only, 100Mhz FSB
Intel 815 Internal graphics only
Intel 815 Internal graphics and AGP
B. Features
- Choice of using Discrete Video Timings, VESA Generalized Timing
Formula, or a framebuffer specific database to set the video mode
- Supports a variable range of horizontal and vertical resolution, and
vertical refresh rates if the VESA Generalized Timing Formula is
enabled.
- Supports color depths of 8, 16, 24 and 32 bits per pixel
- Supports pseudocolor, directcolor, or truecolor visuals
- Full and optimized hardware acceleration at 8, 16 and 24 bpp
- Robust video state save and restore
- MTRR support
- Utilizes user-entered monitor specifications to automatically
calculate required video mode parameters.
- Can concurrently run with xfree86 running with native i810 drivers
- Hardware Cursor Support
C. List of available options
a. "video=i810fb"
enables the i810 driver
Recommendation: required
b. "xres:<value>"
select horizontal resolution in pixels
Recommendation: user preference
(default = 640)
c. "yres:<value>"
select vertical resolution in scanlines. If Discrete Video Timings
is enabled, this will be ignored and computed as 3*xres/4.
Recommendation: user preference
(default = 480)
d. "vyres:<value>"
select virtual vertical resolution in scanlines. If (0) or none
is specified, this will be computed against maximum available memory.
Recommendation: do not set
(default = 480)
e. "vram:<value>"
select amount of system RAM in MB to allocate for the video memory
Recommendation: 1 - 4 MB.
(default = 4)
f. "bpp:<value>"
select desired pixel depth
Recommendation: 8
(default = 8)
g. "hsync1/hsync2:<value>"
select the minimum and maximum Horizontal Sync Frequency of the
monitor in KHz. If a using a fixed frequency monitor, hsync1 must
be equal to hsync2.
Recommendation: check monitor manual for correct values
default (29/30)
h. "vsync1/vsync2:<value>"
select the minimum and maximum Vertical Sync Frequency of the monitor
in Hz. You can also use this option to lock your monitor's refresh
rate.
Recommendation: check monitor manual for correct values
(default = 60/60)
IMPORTANT: If you need to clamp your timings, try to give some
leeway for computational errors (over/underflows). Example: if
using vsync1/vsync2 = 60/60, make sure hsync1/hsync2 has at least
a 1 unit difference, and vice versa.
i. "voffset:<value>"
select at what offset in MB of the logical memory to allocate the
framebuffer memory. The intent is to avoid the memory blocks
used by standard graphics applications (XFree86). The default
offset (16 MB for a 64MB aperture, 8 MB for a 32MB aperture) will
avoid XFree86's usage and allows up to 7MB/15MB of framebuffer
memory. Depending on your usage, adjust the value up or down,
(0 for maximum usage, 31/63 MB for the least amount). Note, an
arbitrary setting may conflict with XFree86.
Recommendation: do not set
(default = 8 or 16 MB)
j. "accel"
enable text acceleration. This can be enabled/reenabled anytime
by using 'fbset -accel true/false'.
Recommendation: enable
(default = not set)
k. "mtrr"
enable MTRR. This allows data transfers to the framebuffer memory
to occur in bursts which can significantly increase performance.
Not very helpful with the i810/i815 because of 'shared memory'.
Recommendation: do not set
(default = not set)
l. "extvga"
if specified, secondary/external VGA output will always be enabled.
Useful if the BIOS turns off the VGA port when no monitor is attached.
The external VGA monitor can then be attached without rebooting.
Recommendation: do not set
(default = not set)
m. "sync"
Forces the hardware engine to do a "sync" or wait for the hardware
to finish before starting another instruction. This will produce a
more stable setup, but will be slower.
Recommendation: do not set
(default = not set)
n. "dcolor"
Use directcolor visual instead of truecolor for pixel depths greater
than 8 bpp. Useful for color tuning, such as gamma control.
Recommendation: do not set
(default = not set)
D. Kernel booting
Separate each option/option-pair by commas (,) and the option from its value
with a colon (:) as in the following:
video=i810fb:option1,option2:value2
Sample Usage
------------
In /etc/lilo.conf, add the line:
append="video=i810fb:vram:2,xres:1024,yres:768,bpp:8,hsync1:30,hsync2:55, \
vsync1:50,vsync2:85,accel,mtrr"
This will initialize the framebuffer to 1024x768 at 8bpp. The framebuffer
will use 2 MB of System RAM. MTRR support will be enabled. The refresh rate
will be computed based on the hsync1/hsync2 and vsync1/vsync2 values.
IMPORTANT:
You must include hsync1, hsync2, vsync1 and vsync2 to enable video modes
better than 640x480 at 60Hz.
E. Module options
The module parameters are essentially similar to the kernel
parameters. The main difference is that you need to include a Boolean value
(1 for TRUE, and 0 for FALSE) for those options which don't need a value.
Example, to enable MTRR, include "mtrr=1".
Sample Usage
------------
Using the same setup as described above, load the module like this:
modprobe i810fb vram=2 xres=1024 bpp=8 hsync1=30 hsync2=55 vsync1=50 \
vsync2=85 accel=1 mtrr=1
Or just add the following to /etc/modules.conf
options i810fb vram=2 xres=1024 bpp=16 hsync1=30 hsync2=55 vsync1=50 \
vsync2=85 accel=1 mtrr=1
and just do a
modprobe i810fb
F. Setup
a. Do your usual method of configuring the kernel.
make menuconfig/xconfig/config
b. Under "Code Maturity Options", enable "Prompt for experimental/
incomplete code/drivers".
c. Enable agpgart support for the Intel 810/815 on-board graphics.
This is required. The option is under "Character Devices"
d. Under "Graphics Support", select "Intel 810/815" either statically
or as a module. Choose "use VESA GTF for video timings" if you
need to maximize the capability of your display. To be on the
safe side, you can leave this unselected.
e. If you want a framebuffer console, enable it under "Console
Drivers"
f. Compile your kernel.
g. Load the driver as described in section D and E.
Optional:
h. If you are going to run XFree86 with its native drivers, the
standard XFree86 4.1.0 and 4.2.0 drivers should work as is.
However, there's a bug in the XFree86 i810 drivers. It attempts
to use XAA even when switched to the console. This will crash
your server. I have a fix at this site:
http://i810fb.sourceforge.net.
You can either use the patch, or just replace
/usr/X11R6/lib/modules/drivers/i810_drv.o
with the one provided at the website.
i. Try the DirectFB (http://www.directfb.org) + the i810 gfxdriver
patch to see the chipset in action (or inaction :-).
G. Acknowledgment:
1. Geert Uytterhoeven - his excellent howto and the virtual
framebuffer driver code made this possible.
2. Jeff Hartmann for his agpgart code.
3. The X developers. Insights were provided just by reading the
XFree86 source code.
4. Intel(c). For this value-oriented chipset driver and for
providing documentation.
5. Matt Sottek. His inputs and ideas helped in making some
optimizations possible.
H. Home Page:
A more complete, and probably updated information is provided at
http://i810fb.sourceforge.net.
###########################
Tony
......@@ -644,7 +644,7 @@ S: Supported
FRAMEBUFFER LAYER
P: James Simmons, Geert Uytterhoeven
M: jsimmons@users.sf.net, geert@linux-m68k.org
M: jsimmons@infradead.org, geert@linux-m68k.org
L: linux-fbdev-devel@lists.sourceforge.net
W: http://www.linux-fbdev.org
S: Supported
......
......@@ -130,7 +130,7 @@ extern void console_map_init(void);
extern void prom_con_init(void);
#endif
#ifdef CONFIG_MDA_CONSOLE
extern void mda_console_init(void);
extern int mda_console_init(void);
#endif
#ifdef CONFIG_FRAMEBUFFER_CONSOLE
extern int fb_console_init(void);
......
......@@ -295,27 +295,21 @@ config FB_VGA16
vga16fb.o.
config FB_STI
bool "Generic STI frame buffer device support"
bool "HP STI frame buffer device support"
depends on FB && PARISC
default y
---help---
STI refers to the HP "Standard Text Interface" which is a set of
BIOS routines contained in a ROM chip in HP PA-RISC based machines.
Enabling this option will implement the linux framebuffer device and
an fbcon color text console using calls to the STI BIOS routines.
The HP framebuffer device is usually planar, uses a strange memory
layout, and changing the plane mask to create colored pixels
requires a call to the STI routines, so do not expect /dev/fb to
actually be useful. However, it is the best we have as far as
graphics on the HP chipsets due to lack of hardware level
documentation for the various on-board HP chipsets used in these
systems. It is sufficient for basic text console functions,
including fonts.
You should probably enable this option, unless you are having
trouble getting video when booting the kernel (make sure it isn't
just that you are running the console on the serial port, though).
Really old HP boxes may not have STI, and must use the PDC BIOS
console or the IODC BIOS.
Enabling this option will implement the linux framebuffer device
using calls to the STI BIOS routines for initialisation.
If you enable this option, you will get a planar framebuffer device
/dev/fb which will work on the most common HP graphic cards of the
NGLE family, including the artist chips (in the 7xx and Bxxx series),
HCRX, HCRX24, CRX, CRX24 and VisEG series.
It is safe to enable this option, so you should probably say "Y".
config FB_MAC
bool "Generic Macintosh display support"
......@@ -471,6 +465,44 @@ config FB_RIVA
module will be called rivafb.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
config FB_I810
tristate "Intel 810/815 support (EXPERIMENTAL)"
depends on FB && AGP && AGP_INTEL && EXPERIMENTAL && PCI
help
This driver supports the on-board graphics built in to the Intel 810
and 815 chipsets. Say Y if you have and plan to use such a board.
The driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want).
The module will be called i810fb.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
For more information, please read
<file:Documentation/fb/intel810.txt>
config FB_I810_GTF
bool "use VESA Generalized Timing Formula"
depends on FB_I810
help
If you say Y, then the VESA standard, Generalized Timing Formula
or GTF, will be used to calculate the required video timing values
per video mode. Since the GTF allows nondiscrete timings
(nondiscrete being a range of values as opposed to discrete being a
set of values), you'll be able to use any combination of horizontal
and vertical resolutions, and vertical refresh rates without having
to specify your own timing parameters. This is especially useful
to maximize the performance of an aging display, or if you just
have a display with nonstandard dimensions. A VESA compliant
monitor is recommended, but can still work with non-compliant ones.
If you need or want this, then select this option. The timings may
not be compliant with Intel's recommended values. Use at your own
risk.
If you say N, the driver will revert to discrete video timings
using a set recommended by Intel in their documentation.
If unsure, say N.
config FB_MATROX
tristate "Matrox acceleration"
depends on FB && PCI
......@@ -759,7 +791,7 @@ config FB_TRIDENT
The driver is also available as a module ( = code which can be
inserted and removed from the running kernel whenever you want). The
module will be called rivafb.o. If you want to compile it as a
module will be called tridentfb.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
config FB_PM3
......
......@@ -12,8 +12,7 @@ export-objs := fbmem.o fbcmap.o fbmon.o modedb.o softcursor.o cfbfillrect.o
obj-$(CONFIG_VT) += console/
# Add fbmon.o back into obj-$(CONFIG_FB) in 2.5.x
obj-$(CONFIG_FB) += fbmem.o fbcmap.o modedb.o softcursor.o
obj-$(CONFIG_FB) += fbmem.o fbmon.o fbcmap.o modedb.o softcursor.o
# Only include macmodes.o if we have FB support and are PPC
ifeq ($(CONFIG_FB),y)
obj-$(CONFIG_PPC) += macmodes.o
......@@ -27,13 +26,13 @@ obj-$(CONFIG_FB_APOLLO) += dnfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_Q40) += q40fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_ATARI) += atafb.o
obj-$(CONFIG_FB_ATY128) += aty128fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_RADEON) += radeonfb.o
obj-$(CONFIG_FB_RADEON) += radeonfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_NEOMAGIC) += neofb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblit.o
obj-$(CONFIG_FB_IGA) += igafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_CONTROL) += controlfb.o
obj-$(CONFIG_FB_PLATINUM) += platinumfb.o
obj-$(CONFIG_FB_VALKYRIE) += valkyriefb.o
obj-$(CONFIG_FB_CT65550) += chipsfb.o
obj-$(CONFIG_FB_CT65550) += chipsfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_ANAKIN) += anakinfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_CLPS711X) += clps711xfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_CYBER) += cyberfb.o
......@@ -42,7 +41,7 @@ obj-$(CONFIG_FB_SGIVW) += sgivwfb.o cfbfillrect.o cfbcopyarea.o cfbim
obj-$(CONFIG_FB_3DFX) += tdfxfb.o
obj-$(CONFIG_FB_MAC) += macfb.o macmodes.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_HP300) += hpfb.o cfbfillrect.o cfbimgblt.o
obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblit.o cfbcopyarea.o
obj-$(CONFIG_FB_OF) += offb.o cfbfillrect.o cfbimgblt.o cfbcopyarea.o
obj-$(CONFIG_FB_IMSTT) += imsttfb.o
obj-$(CONFIG_FB_RETINAZ3) += retz3fb.o
obj-$(CONFIG_FB_CLGEN) += clgenfb.o
......@@ -63,7 +62,7 @@ obj-$(CONFIG_FB_TCX) += tcxfb.o sbusfb.o
obj-$(CONFIG_FB_CGFOURTEEN) += cgfourteenfb.o sbusfb.o
obj-$(CONFIG_FB_P9100) += p9100fb.o sbusfb.o
obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
obj-$(CONFIG_FB_STI) += stifb.o console/sticore.o
obj-$(CONFIG_FB_STI) += stifb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_MAXINE) += maxinefb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
......@@ -74,6 +73,8 @@ obj-$(CONFIG_FB_RIVA) += riva/ cfbfillrect.o cfbcopyarea.o \
cfbimgblt.o vgastate.o
obj-$(CONFIG_FB_SIS) += sis/
obj-$(CONFIG_FB_ATY) += aty/ cfbimgblt.o
obj-$(CONFIG_FB_I810) += i810/ cfbfillrect.o cfbcopyarea.o \
cfbimgblt.o vgastate.o
obj-$(CONFIG_FB_SUN3) += sun3fb.o
obj-$(CONFIG_FB_HGA) += hgafb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
......@@ -82,7 +83,7 @@ obj-$(CONFIG_FB_VIRTUAL) += vfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt
obj-$(CONFIG_FB_HIT) += hitfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
obj-$(CONFIG_FB_E1355) += epson1355fb.o
obj-$(CONFIG_FB_PVR2) += pvr2fb.o
obj-$(CONFIG_FB_VOODOO1) += sstfb.o
obj-$(CONFIG_FB_VOODOO1) += sstfb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o
# Files generated that shall be removed upon make clean
clean-files := promcon_tbl.c
......
......@@ -70,7 +70,7 @@
#ifdef __powerpc__
#include <asm/prom.h>
#include <video/macmodes.h>
#include "../macmodes.h"
#endif
#ifdef __sparc__
#include <asm/pbm.h>
......@@ -84,9 +84,6 @@
#ifdef CONFIG_BOOTX_TEXT
#include <asm/btext.h>
#endif
#ifdef CONFIG_NVRAM
#include <linux/nvram.h>
#endif
#ifdef CONFIG_PMAC_BACKLIGHT
#include <asm/backlight.h>
#endif
......@@ -226,14 +223,9 @@ static char *mode_option __initdata = NULL;
#endif
#ifdef CONFIG_PPC
#ifdef CONFIG_NVRAM_NOT_DEFINED
static int default_vmode __initdata = VMODE_NVRAM;
static int default_cmode __initdata = CMODE_NVRAM;
#else
static int default_vmode __initdata = VMODE_CHOOSE;
static int default_cmode __initdata = CMODE_CHOOSE;
#endif
#endif
#ifdef CONFIG_ATARI
static unsigned int mach64_count __initdata = 0;
......@@ -984,6 +976,7 @@ static int atyfb_release(struct fb_info *info, int user)
var.yres_virtual =
var.yres;
}
fb_set_var(&var, -1, info);
}
}
}
......@@ -1246,8 +1239,8 @@ static void atyfb_save_palette(struct atyfb_par *par, int enter)
static void atyfb_palette(int enter)
{
struct fb_info *info;
struct atyfb_par *par;
struct fb_info *info;
int i;
for (i = 0; i < FB_MAX; i++) {
......@@ -1409,16 +1402,16 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par)
static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
{
struct fb_info *info;
struct atyfb_par *par = (struct atyfb_par *) info->fb.par;
struct atyfb_par *par;
int result;
result = PBOOK_SLEEP_OK;
for (info = first_display; info != NULL; info = par->next) {
struct fb_fix_screeninfo fix;
int nb;
nb = fb_display[fg_console].var.yres * info->fix.line_length;
par = (struct atyfb_par *) info->fb.par;
nb = info->var.yres * info->fix.line_length;
switch (when) {
case PBOOK_SLEEP_REQUEST:
......@@ -1436,7 +1429,7 @@ static int aty_sleep_notify(struct pmu_sleep_notifier *self, int when)
if (par->blitter_may_be_busy)
wait_for_idle(par);
/* Stop accel engine (stop bus mastering) */
if (par->accel_flags & FB_ACCELF_TEXT)
if (info->accel_flags & FB_ACCELF_TEXT)
aty_reset_engine(par);
/* Backup fb content */
......@@ -1841,14 +1834,6 @@ static int __init aty_init(struct fb_info *info, const char *name)
(&var, info, mode_option, 8))
var = default_var;
} else {
#ifdef CONFIG_NVRAM
if (default_vmode == VMODE_NVRAM) {
default_vmode = nvram_read_byte(NV_VMODE);
if (default_vmode <= 0
|| default_vmode > VMODE_MAX)
default_vmode = VMODE_CHOOSE;
}
#endif
if (default_vmode == VMODE_CHOOSE) {
if (M64_HAS(G3_PB_1024x768))
/* G3 PowerBook with 1024x768 LCD */
......@@ -1870,10 +1855,6 @@ static int __init aty_init(struct fb_info *info, const char *name)
if (default_vmode <= 0
|| default_vmode > VMODE_MAX)
default_vmode = VMODE_640_480_60;
#ifdef CONFIG_NVRAM
if (default_cmode == CMODE_NVRAM)
default_cmode = nvram_read_byte(NV_CMODE);
#endif
if (default_cmode < CMODE_8
|| default_cmode > CMODE_32)
default_cmode = CMODE_8;
......
......@@ -56,8 +56,6 @@
#include <asm/uaccess.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/selection.h>
#include <linux/console.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <asm/io.h>
......@@ -65,10 +63,7 @@
#ifdef CONFIG_ALL_PPC
#include <asm/prom.h>
#include <asm/pci-bridge.h>
#include <video/macmodes.h>
#ifdef CONFIG_NVRAM
#include <linux/nvram.h>
#endif
#include "macmodes.h"
#endif
#ifdef CONFIG_ADB_PMU
......@@ -285,7 +280,6 @@ struct aty128_constants {
struct aty128_crtc {
u32 gen_cntl;
u32 ext_cntl;
u32 h_total, h_sync_strt_wid;
u32 v_total, v_sync_strt_wid;
u32 pitch;
......@@ -326,10 +320,13 @@ struct aty128fb_par {
unsigned char *save_framebuffer;
int pm_reg;
int crt_on, lcd_on;
struct pci_dev *pdev;
struct fb_info *next;
#endif
unsigned char red[64]; /* see comments in aty128fb_setcolreg */
unsigned char green[64];
unsigned char blue[64];
u8 red[32]; /* see aty128fb_setcolreg */
u8 green[64];
u8 blue[32];
u32 pseudo_palette[16]; /* used for TRUECOLOR */
};
#ifdef CONFIG_PMAC_PBOOK
......@@ -337,6 +334,7 @@ int aty128_sleep_notify(struct pmu_sleep_notifier *self, int when);
static struct pmu_sleep_notifier aty128_sleep_notifier = {
aty128_sleep_notify, SLEEP_LEVEL_VIDEO,
};
static struct fb_info *aty128_fb = NULL;
#endif
#define round_div(n, d) ((n+(d/2))/d)
......@@ -1203,7 +1201,11 @@ aty128fb_set_par(struct fb_info *info)
{
struct aty128fb_par *par = info->par;
u32 config;
int err;
if ((err = aty128_decode_var(&info->var, par)) != 0)
return err;
if (par->blitter_may_be_busy)
wait_for_idle(par);
......@@ -1271,15 +1273,22 @@ static int
aty128_decode_var(struct fb_var_screeninfo *var, struct aty128fb_par *par)
{
int err;
struct aty128_crtc crtc;
struct aty128_pll pll;
struct aty128_ddafifo fifo_reg;
if ((err = aty128_var_to_crtc(var, &par->crtc, par)))
if ((err = aty128_var_to_crtc(var, &crtc, par)))
return err;
if ((err = aty128_var_to_pll(var->pixclock, &par->pll, par)))
if ((err = aty128_var_to_pll(var->pixclock, &pll, par)))
return err;
if ((err = aty128_ddafifo(&par->fifo_reg, &par->pll, par->crtc.depth, par)))
if ((err = aty128_ddafifo(&fifo_reg, &pll, crtc.depth, par)))
return err;
par->crtc = crtc;
par->pll = pll;
par->fifo_reg = fifo_reg;
par->accel_flags = var->accel_flags;
return 0;
......@@ -1312,12 +1321,13 @@ aty128_encode_var(struct fb_var_screeninfo *var,
static int
aty128fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct aty128fb_par *par = info->par;
struct aty128fb_par par;
int err;
if ((err = aty128_decode_var(var, par)) != 0)
par = *(struct aty128fb_par *)info->par;
if ((err = aty128_decode_var(var, &par)) != 0)
return err;
aty128_encode_var(var, par);
aty128_encode_var(var, &par);
return 0;
}
......@@ -1602,7 +1612,12 @@ aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif /* CONFIG_PMAC_BACKLIGHT */
#ifdef CONFIG_PMAC_PBOOK
par->pm_reg = pci_find_capability(pdev, PCI_CAP_ID_PM);
pmu_register_sleep_notifier(&aty128_sleep_notifier);
if (aty128_fb == NULL) {
/* XXX can only put one chip to sleep */
aty128_fb = info;
} else
printk(KERN_WARNING "aty128fb: can only sleep one Rage 128\n");
par->pdev = pdev;
#endif
printk(KERN_INFO "fb%d: %s frame buffer device on %s\n",
......@@ -1647,8 +1662,7 @@ aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
/* We have the resources. Now virtualize them */
size = sizeof(struct fb_info) + sizeof(struct aty128fb_par) +
sizeof(u32)*16;
size = sizeof(struct fb_info) + sizeof(struct aty128fb_par);
if (!(info = kmalloc(size, GFP_ATOMIC))) {
printk(KERN_ERR "aty128fb: can't alloc fb_info_aty128\n");
goto err_unmap_out;
......@@ -1656,9 +1670,7 @@ aty128_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
memset(info, 0, size);
par = (struct aty128fb_par *)(info + 1);
info->pseudo_palette = (void *) (par + 1);
memset(info, 0, sizeof(struct fb_info));
info->pseudo_palette = par->pseudo_palette;
info->par = par;
info->fix = aty128fb_fix;
......@@ -1758,6 +1770,10 @@ static void __devexit aty128_remove(struct pci_dev *pdev)
pci_resource_len(pdev, 1));
release_mem_region(pci_resource_start(pdev, 2),
pci_resource_len(pdev, 2));
#ifdef CONFIG_PMAC_PBOOK
if (info == aty128_fb)
aty128_fb = NULL;
#endif
kfree(info);
}
#endif /* CONFIG_PCI */
......@@ -2008,7 +2024,7 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
}
}
if (par->crtc.depth == 16) {
if (par->crtc.depth == 16 && regno > 0) {
/*
* With the 5-6-5 split of bits for RGB at 16 bits/pixel, we
* have 32 slots for R and B values but 64 slots for G values.
......@@ -2016,12 +2032,13 @@ aty128fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
* goes in a different slot, and we have to avoid disturbing
* the other fields in the slots we touch.
*/
par->red[regno] = red;
par->green[regno] = green;
par->blue[regno] = blue;
if (regno > 0 && regno < 32)
if (regno < 32) {
par->red[regno] = red;
par->blue[regno] = blue;
aty128_st_pal(regno * 8, red, par->green[regno*2],
blue, par);
}
red = par->red[regno/2];
blue = par->blue[regno/2];
regno <<= 2;
......@@ -2213,6 +2230,7 @@ aty128_set_suspend(struct aty128fb_par *par, int suspend)
{
u32 pmgt;
u16 pwr_command;
struct pci_dev *pdev = par->pdev;
if (!par->pm_reg)
return;
......@@ -2237,17 +2255,16 @@ aty128_set_suspend(struct aty128fb_par *par, int suspend)
aty_st_le32(BUS_CNTL1, 0x00000010);
aty_st_le32(MEM_POWER_MISC, 0x0c830000);
mdelay(100);
pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
/* Switch PCI power management to D2 */
pci_write_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL,
pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL,
(pwr_command & ~PCI_PM_CTRL_STATE_MASK) | 2);
pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
} else {
/* Switch back PCI power management to D0 */
mdelay(100);
pci_write_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, 0);
mdelay(100);
pci_read_config_word(par->pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL, 0);
pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
mdelay(100);
}
}
......@@ -2259,10 +2276,13 @@ aty128_set_suspend(struct aty128fb_par *par, int suspend)
int
aty128_sleep_notify(struct pmu_sleep_notifier *self, int when)
{
int result = PBOOK_SLEEP_OK, nb;
struct fb_info *info = info; /* FIXME!!! How do find which framebuffer */
struct aty128fb_par *par = info->par;
int nb;
struct fb_info *info = aty128_fb;
struct aty128fb_par *par;
if (info == NULL)
return PBOOK_SLEEP_OK;
par = info->par;
nb = info->var.yres * info->fix.line_length;
switch (when) {
......@@ -2311,17 +2331,23 @@ aty128_sleep_notify(struct pmu_sleep_notifier *self, int when)
aty128fb_blank(0, info);
break;
}
return result;
return PBOOK_SLEEP_OK;
}
#endif /* CONFIG_PMAC_PBOOK */
int __init aty128fb_init(void)
{
#ifdef CONFIG_PMAC_PBOOK
pmu_register_sleep_notifier(&aty128_sleep_notifier);
#endif
return pci_module_init(&aty128fb_driver);
}
static void __exit aty128fb_exit(void)
{
#ifdef CONFIG_PMAC_PBOOK
pmu_unregister_sleep_notifier(&aty128_sleep_notifier);
#endif
pci_unregister_driver(&aty128fb_driver);
}
......
......@@ -400,11 +400,6 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
}
}
#ifdef MODULE
int init_module(void) { return 0; };
void cleanup_module(void) {};
#endif
EXPORT_SYMBOL(cfb_copyarea);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
......@@ -443,11 +443,6 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
}
}
#ifdef MODULE
int init_module(void) { return 0; };
void cleanup_module(void) {};
#endif
EXPORT_SYMBOL(cfb_fillrect);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
......@@ -21,13 +21,13 @@
*
* FIXME
* The code for 24 bit is horrible. It copies byte by byte size instead of
* words like the other sizes. Needs to be optimized.
* longs like the other sizes. Needs to be optimized.
*
* Tony:
* Incorporate mask tables similar to fbcon-cfb*.c in 2.4 API. This speeds
* up the code significantly.
*
* Code for depths not multiples of BITS_PER_WORD is still kludgy, which is
* Code for depths not multiples of BITS_PER_LONG is still kludgy, which is
* still processed a bit at a time.
*
* Also need to add code to deal with cards endians that are different than
......@@ -48,11 +48,7 @@
#define DPRINTK(fmt, args...)
#endif
/* The following code can *not* handle a 64-bit long. */
#define WORD u32
#define BITS_PER_WORD 32
static WORD const cfb_tab8[] = {
static u32 cfb_tab8[] = {
#if defined(__BIG_ENDIAN)
0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
......@@ -68,7 +64,7 @@ static WORD const cfb_tab8[] = {
#endif
};
static WORD const cfb_tab16[] = {
static u32 cfb_tab16[] = {
#if defined(__BIG_ENDIAN)
0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
#elif defined(__LITTLE_ENDIAN)
......@@ -78,11 +74,11 @@ static WORD const cfb_tab16[] = {
#endif
};
static WORD const cfb_tab32[] = {
static u32 cfb_tab32[] = {
0x00000000, 0xffffffff
};
#if BITS_PER_WORD == 32
#if BITS_PER_LONG == 32
#define FB_WRITEL fb_writel
#define FB_READL fb_readl
#else
......@@ -91,7 +87,7 @@ static WORD const cfb_tab32[] = {
#endif
#if defined (__BIG_ENDIAN)
#define LEFT_POS(bpp) (BITS_PER_WORD - bpp)
#define LEFT_POS(bpp) (BITS_PER_LONG - bpp)
#define NEXT_POS(pos, bpp) ((pos) -= (bpp))
#define SHIFT_HIGH(val, bits) ((val) >> (bits))
#define SHIFT_LOW(val, bits) ((val) << (bits))
......@@ -103,25 +99,24 @@ static WORD const cfb_tab32[] = {
#endif
static inline void color_imageblit(struct fb_image *image, struct fb_info *p, u8 *dst1,
WORD start_index, WORD pitch_index)
unsigned long start_index, unsigned long pitch_index)
{
/* Draw the penguin */
int i, n;
WORD bitmask = SHIFT_LOW(~0UL, BITS_PER_WORD - p->var.bits_per_pixel);
unsigned long *dst, *dst2, color = 0, val, shift;
int i, n, bpp = p->var.bits_per_pixel;
unsigned long null_bits = BITS_PER_LONG - bpp;
u32 *palette = (u32 *) p->pseudo_palette;
WORD *dst, *dst2, color = 0, val, shift;
WORD null_bits = BITS_PER_WORD - p->var.bits_per_pixel;
u8 *src = image->data;
dst2 = (WORD *) dst1;
dst2 = (unsigned long *) dst1;
for (i = image->height; i--; ) {
n = image->width;
dst = (WORD *) dst1;
dst = (unsigned long *) dst1;
shift = 0;
val = 0;
if (start_index) {
WORD start_mask = ~(SHIFT_HIGH(~0UL, start_index));
unsigned long start_mask = ~(SHIFT_HIGH(~0UL, start_index));
val = FB_READL(dst) & start_mask;
shift = start_index;
......@@ -129,23 +124,24 @@ static inline void color_imageblit(struct fb_image *image, struct fb_info *p, u8
while (n--) {
if (p->fix.visual == FB_VISUAL_TRUECOLOR ||
p->fix.visual == FB_VISUAL_DIRECTCOLOR )
color = palette[*src] & bitmask;
color = palette[*src];
else
color = *src & bitmask;
color = *src;
color <<= LEFT_POS(bpp);
val |= SHIFT_HIGH(color, shift);
if (shift >= null_bits) {
FB_WRITEL(val, dst++);
if (shift == null_bits)
val = 0;
else
val = SHIFT_LOW(color, BITS_PER_WORD - shift);
val = SHIFT_LOW(color, BITS_PER_LONG - shift);
}
shift += p->var.bits_per_pixel;
shift &= (BITS_PER_WORD - 1);
shift += bpp;
shift &= (BITS_PER_LONG - 1);
src++;
}
if (shift) {
WORD end_mask = SHIFT_HIGH(~0UL, shift);
unsigned long end_mask = SHIFT_HIGH(~0UL, shift);
FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
}
......@@ -153,35 +149,35 @@ static inline void color_imageblit(struct fb_image *image, struct fb_info *p, u8
if (pitch_index) {
dst2 += p->fix.line_length;
dst1 = (char *) dst2;
(size_t) dst1 &= ~(sizeof(WORD) - 1);
(unsigned long) dst1 &= ~(sizeof(unsigned long) - 1);
start_index += pitch_index;
start_index &= BITS_PER_WORD - 1;
start_index &= BITS_PER_LONG - 1;
}
}
}
static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8 *dst1,
WORD fgcolor, WORD bgcolor,
WORD start_index, WORD pitch_index)
unsigned long fgcolor, unsigned long bgcolor,
unsigned long start_index, unsigned long pitch_index)
{
WORD i, j, l = 8;
WORD shift, color, bpp = p->var.bits_per_pixel;
WORD *dst, *dst2, val, pitch = p->fix.line_length;
WORD null_bits = BITS_PER_WORD - bpp;
unsigned long i, j, l = 8;
unsigned long shift, color, bpp = p->var.bits_per_pixel;
unsigned long *dst, *dst2, val, pitch = p->fix.line_length;
unsigned long null_bits = BITS_PER_LONG - bpp;
u8 *src = image->data;
dst2 = (WORD *) dst1;
dst2 = (unsigned long *) dst1;
for (i = image->height; i--; ) {
shift = 0;
val = 0;
j = image->width;
dst = (WORD *) dst1;
dst = (unsigned long *) dst1;
/* write leading bits */
if (start_index) {
WORD start_mask = ~(SHIFT_HIGH(~0UL, start_index));
unsigned long start_mask = ~(SHIFT_HIGH(~0UL, start_index));
val = FB_READL(dst) & start_mask;
shift = start_index;
......@@ -192,6 +188,7 @@ static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8
color = fgcolor;
else
color = bgcolor;
color <<= LEFT_POS(bpp);
val |= SHIFT_HIGH(color, shift);
/* Did the bitshift spill bits to the next long? */
......@@ -200,15 +197,15 @@ static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8
if (shift == null_bits)
val = 0;
else
val = SHIFT_LOW(color, BITS_PER_WORD - shift);
val = SHIFT_LOW(color, BITS_PER_LONG - shift);
}
shift += bpp;
shift &= (BITS_PER_WORD - 1);
shift &= (BITS_PER_LONG - 1);
if (!l) { l = 8; src++; };
}
/* write trailing bits */
if (shift) {
WORD end_mask = SHIFT_HIGH(~0UL, shift);
unsigned long end_mask = SHIFT_HIGH(~0UL, shift);
FB_WRITEL((FB_READL(dst) & end_mask) | val, dst);
}
......@@ -217,24 +214,24 @@ static inline void slow_imageblit(struct fb_image *image, struct fb_info *p, u8
if (pitch_index) {
dst2 += pitch;
dst1 = (char *) dst2;
(size_t) dst1 &= ~(sizeof(WORD) - 1);
(unsigned long) dst1 &= ~(sizeof(unsigned long) - 1);
start_index += pitch_index;
start_index &= BITS_PER_WORD - 1;
start_index &= BITS_PER_LONG - 1;
}
}
}
static inline void fast_imageblit(struct fb_image *image, struct fb_info *p, u8 *dst1,
WORD fgcolor, WORD bgcolor)
unsigned long fgcolor, unsigned long bgcolor)
{
int i, j, k, l = 8, n;
WORD bit_mask, end_mask, eorx;
WORD fgx = fgcolor, bgx = bgcolor, pad, bpp = p->var.bits_per_pixel;
WORD tmp = (1 << bpp) - 1;
WORD ppw = BITS_PER_WORD/bpp, ppos;
WORD *dst;
unsigned long bit_mask, end_mask, eorx;
unsigned long fgx = fgcolor, bgx = bgcolor, pad, bpp = p->var.bits_per_pixel;
unsigned long tmp = (1 << bpp) - 1;
unsigned long ppw = BITS_PER_LONG/bpp, ppos;
unsigned long *dst;
u32 *tab = NULL;
char *src = image->data;
......@@ -267,7 +264,7 @@ static inline void fast_imageblit(struct fb_image *image, struct fb_info *p, u8
k = image->width/ppw;
for (i = image->height; i--; ) {
dst = (WORD *) dst1;
dst = (unsigned long *) dst1;
for (j = k; j--; ) {
l -= ppw;
......@@ -295,8 +292,8 @@ static inline void fast_imageblit(struct fb_image *image, struct fb_info *p, u8
void cfb_imageblit(struct fb_info *p, struct fb_image *image)
{
int x2, y2, vxres, vyres;
WORD fgcolor, bgcolor, start_index, bitstart, pitch_index = 0;
WORD bpl = sizeof(WORD), bpp = p->var.bits_per_pixel;
unsigned long fgcolor, bgcolor, start_index, bitstart, pitch_index = 0;
unsigned long bpl = sizeof(unsigned long), bpp = p->var.bits_per_pixel;
u8 *dst1;
vxres = p->var.xres_virtual;
......@@ -319,7 +316,7 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
image->height = y2 - image->dy;
bitstart = (image->dy * p->fix.line_length * 8) + (image->dx * bpp);
start_index = bitstart & (BITS_PER_WORD - 1);
start_index = bitstart & (BITS_PER_LONG - 1);
pitch_index = (p->fix.line_length & (bpl - 1)) * 8;
bitstart /= 8;
......@@ -336,7 +333,7 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
bgcolor = image->bg_color;
}
if (BITS_PER_WORD % bpp == 0 && !start_index && !pitch_index &&
if (BITS_PER_LONG % bpp == 0 && !start_index && !pitch_index &&
bpp >= 8 && bpp <= 32 && (image->width & 7) == 0)
fast_imageblit(image, p, dst1, fgcolor, bgcolor);
else
......@@ -346,11 +343,6 @@ void cfb_imageblit(struct fb_info *p, struct fb_image *image)
color_imageblit(image, p, dst1, start_index, pitch_index);
}
#ifdef MODULE
int init_module(void) { return 0; };
void cleanup_module(void) {};
#endif
EXPORT_SYMBOL(cfb_imageblit);
MODULE_AUTHOR("James Simmons <jsimmons@users.sf.net>");
......
This diff is collapsed.
......@@ -66,13 +66,30 @@ config SGI_NEWPORT_CONSOLE
# bool 'IODC console' CONFIG_IODC_CONSOLE
config STI_CONSOLE
bool "STI console"
bool "STI text console"
depends on PARISC
default y
help
The STI console is the builtin display/keyboard on HP-PARISC
machines. Say Y here to build support for it into your kernel.
The alternative is to use your primary serial port as a console.
config DUMMY_CONSOLE_COLUMNS
int "Initial number of STI console screen columns" if STI_CONSOLE
depends on STI_CONSOLE || FB_STI
default "160"
help
The default value is 160, which should fit a 1280x1024 monitor.
Select 80 if you use a 640x480 resolution by default.
config DUMMY_CONSOLE_ROWS
int "Initial number of STI console screen rows" if STI_CONSOLE
depends on STI_CONSOLE || FB_STI
default "64"
help
The default value is 64, which should fit a 1280x1024 monitor.
Select 25 if you use a 640x480 resolution by default.
config PROM_CONSOLE
bool "PROM console"
depends on SPARC32 || SPARC64
......@@ -120,19 +137,6 @@ config FBCON_ADVANCED
If unsure, say N.
# Guess what we need
config FBCON_STI
tristate
depends on !FBCON_ADVANCED && FRAMEBUFFER_CONSOLE && FB_STI
default y
config FONTWIDTH8_ONLY
bool "Support only 8 pixels wide fonts"
depends on FRAMEBUFFER_CONSOLE
help
Answer Y here will make the kernel provide only the 8x8 fonts (these
are the less readable).
If unsure, say N.
config FONT_SUN8x16
bool "Sparc console 8x16 font"
......@@ -142,7 +146,7 @@ config FONT_SUN8x16
config FONT_SUN12x22
bool "Sparc console 12x22 font (not supported by all drivers)"
depends on FRAMEBUFFER_CONSOLE && !FONTWIDTH8_ONLY && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64)
depends on FRAMEBUFFER_CONSOLE && (!SPARC32 && !SPARC64 && FONTS || SPARC32 || SPARC64)
help
This is the high resolution console font for Sun machines with very
big letters (like the letters used in the SPARC PROM). If the
......@@ -191,7 +195,7 @@ config FONT_8x16
config FONT_6x11
bool "Mac console 6x11 font (not supported by all drivers)" if FONTS
depends on FRAMEBUFFER_CONSOLE && !FONTWIDTH8_ONLY
depends on FRAMEBUFFER_CONSOLE
default y if !SPARC32 && !SPARC64 && !FONTS && MAC
help
Small console font with Macintosh-style high-half glyphs. Some Mac
......
......@@ -10,30 +10,16 @@ export-objs := fbcon.o fonts.o
# Font handling
font-objs := fonts.o
ifeq ($(CONFIG_FONT_SUN8x16),y)
font-objs += font_sun8x16.o
endif
ifeq ($(CONFIG_FONT_SUN12x22),y)
font-objs += font_sun12x22.o
endif
ifeq ($(CONFIG_FONT_8x8),y)
font-objs += font_8x8.o
endif
ifeq ($(CONFIG_FONT_8x16),y)
font-objs += font_8x16.o
endif
ifeq ($(CONFIG_FONT_6x11),y)
font-objs += font_6x11.o
endif
ifeq ($(CONFIG_FONT_PEARL_8x8),y)
font-objs += font_pearl_8x8.o
endif
ifeq ($(CONFIG_FONT_ACORN_8x8),y)
font-objs += font_acorn_8x8.o
endif
ifeq ($(CONFIG_FONT_MINI_4x6),y)
font-objs += font_mini_4x6.o
endif
font-objs-$(CONFIG_FONT_SUN8x16) += font_sun8x16.o
font-objs-$(CONFIG_FONT_SUN12x22) += font_sun12x22.o
font-objs-$(CONFIG_FONT_8x8) += font_8x8.o
font-objs-$(CONFIG_FONT_8x16) += font_8x16.o
font-objs-$(CONFIG_FONT_6x11) += font_6x11.o
font-objs-$(CONFIG_FONT_PEARL_8x8) += font_pearl_8x8.o
font-objs-$(CONFIG_FONT_ACORN_8x8) += font_acorn_8x8.o
font-objs-$(CONFIG_FONT_MINI_4x6) += font_mini_4x6.o
font-objs += $(font-objs-y)
# Each configuration option enables a list of files.
......@@ -45,9 +31,7 @@ obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
obj-$(CONFIG_MDA_CONSOLE) += mdacon.o
obj-$(CONFIG_FRAMEBUFFER_CONSOLE) += fbcon.o font.o
# Generic Low Level Drivers
obj-$(CONFIG_FBCON_STI) += fbcon-sti.o
obj-$(CONFIG_FB_STI) += sticore.o
# Files generated that shall be removed upon make clean
clean-files := promcon_tbl.c
......
......@@ -20,8 +20,10 @@
#define DUMMY_COLUMNS ORIG_VIDEO_COLS
#define DUMMY_ROWS ORIG_VIDEO_LINES
#elif defined(__hppa__)
#define DUMMY_COLUMNS 80 /* fixme ! (mine uses 160x64 at 1280x1024) */
#define DUMMY_ROWS 25
/* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */
#include <linux/config.h>
#define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS
#define DUMMY_ROWS CONFIG_DUMMY_CONSOLE_ROWS
#else
#define DUMMY_COLUMNS 80
#define DUMMY_ROWS 25
......
/*
* linux/drivers/video/fbcon-sti.c -- Low level frame buffer
* operations for generic HP video boards using STI (standard
* text interface) firmware
*
* Based on linux/drivers/video/fbcon-artist.c
* Created 5 Apr 1997 by Geert Uytterhoeven
* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details. */
#include <linux/module.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/string.h>
#include <linux/fb.h>
#include <linux/delay.h>
#include <asm/gsc.h> /* for gsc_read/write */
#include <asm/types.h>
#include <video/fbcon.h>
#include <video/fbcon-mfb.h>
#include "../sticore.h"
static inline u32
ram2log(void * addr)
{
return (unsigned long) addr;
}
/* All those functions need better names. */
static void
memcpy_fromhp_tohp(void *dest, void *src, int count)
{
unsigned long d = ram2log(dest);
unsigned long s = ram2log(src);
count += 3;
count &= ~3; /* XXX */
while(count) {
count --;
gsc_writel(~gsc_readl(s), d);
d += 32*4;
s += 32*4;
}
}
static void
memset_tohp(void *dest, u32 word, int count)
{
unsigned long d = ram2log(dest);
count += 3;
count &= ~3;
while(count) {
count--;
gsc_writel(word, d);
d += 32;
}
}
static u8
readb_hp(void *src)
{
unsigned long s = ram2log(src);
return ~gsc_readb(s);
}
static void
writeb_hp(u8 b, void *dst)
{
unsigned long d = ram2log(dst);
if((d&0xf0000000) != 0xf0000000) {
printk("writeb_hp %02x %p (%08lx) (%p)\n",
b, dst, d, __builtin_return_address(0));
return;
}
gsc_writeb(b, d);
}
static void
fbcon_sti_setup(struct display *p)
{
/* in kernel 2.5 the value of sadly line_length disapeared */
if (p->var.xres_virtual /*line_length*/)
p->next_line = p->var.xres_virtual>>3;
else
p->next_line = 2048; /* default STI value */
p->next_plane = 0;
}
static void
fbcon_sti_bmove(struct display *p, int sy, int sx,
int dy, int dx,
int height, int width)
{
#if 0 /* Unfortunately, still broken */
sti_bmove(default_sti /* FIXME */, sy, sx, dy, dx, height, width);
#else
u8 *src, *dest;
u_int rows;
if (sx == 0 && dx == 0 && width == p->next_line) {
src = p->fb_info->screen_base+sy*fontheight(p)*width;
dest = p->fb_info->screen_base+dy*fontheight(p)*width;
memcpy_fromhp_tohp(dest, src, height*fontheight(p)*width);
} else if (dy <= sy) {
src = p->fb_info->screen_base+sy*fontheight(p)*p->next_line+sx;
dest = p->fb_info->screen_base+dy*fontheight(p)*p->next_line+dx;
for (rows = height*fontheight(p); rows--;) {
memcpy_fromhp_tohp(dest, src, width);
src += p->next_line;
dest += p->next_line;
}
} else {
src = p->fb_info->screen_base+((sy+height)*fontheight(p)-1)*p->next_line+sx;
dest = p->fb_info->screen_base+((dy+height)*fontheight(p)-1)*p->next_line+dx;
for (rows = height*fontheight(p); rows--;) {
memcpy_fromhp_tohp(dest, src, width);
src -= p->next_line;
dest -= p->next_line;
}
}
#endif
}
static void
fbcon_sti_clear(struct vc_data *conp,
struct display *p, int sy, int sx,
int height, int width)
{
u8 *dest;
u_int rows;
int inverse = conp ? attr_reverse(p,conp->vc_video_erase_char) : 0;
dest = p->fb_info->screen_base+sy*fontheight(p)*p->next_line+sx;
if (sx == 0 && width == p->next_line) {
if (inverse)
memset_tohp(dest, ~0, height*fontheight(p)*width);
else
memset_tohp(dest, 0, height*fontheight(p)*width);
} else
for (rows = height*fontheight(p); rows--; dest += p->next_line)
if (inverse)
memset_tohp(dest, 0xffffffff, width);
else
memset_tohp(dest, 0x00000000, width);
}
static void fbcon_sti_putc(struct vc_data *conp,
struct display *p, int c,
int yy, int xx)
{
u8 *dest, *cdat;
u_int rows, bold, revs, underl;
u8 d;
dest = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx;
cdat = p->fontdata+(c&p->charmask)*fontheight(p);
bold = attr_bold(p,c);
revs = attr_reverse(p,c);
underl = attr_underline(p,c);
for (rows = fontheight(p); rows--; dest += p->next_line) {
d = *cdat++;
if (underl && !rows)
d = 0xff;
else if (bold)
d |= d>>1;
if (revs)
d = ~d;
writeb_hp (d, dest);
}
}
static void fbcon_sti_putcs(struct vc_data *conp,
struct display *p,
const unsigned short *s,
int count, int yy, int xx)
{
u8 *dest, *dest0, *cdat;
u_int rows, bold, revs, underl;
u8 d;
u16 c;
if(((unsigned)xx > 200) || ((unsigned) yy > 200)) {
printk("refusing to putcs %p %p %p %d %d %d (%p)\n",
conp, p, s, count, yy, xx, __builtin_return_address(0));
return;
}
dest0 = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx;
if(((u32)dest0&0xf0000000)!=0xf0000000) {
printk("refusing to putcs %p %p %p %d %d %d (%p) %p = %p + %d * %d * %ld + %d\n",
conp, p, s, count, yy, xx, __builtin_return_address(0),
dest0, p->fb_info->screen_base, yy, fontheight(p), p->next_line,
xx);
return;
}
c = scr_readw(s);
bold = attr_bold(p, c);
revs = attr_reverse(p, c);
underl = attr_underline(p, c);
while (count--) {
c = scr_readw(s++) & p->charmask;
dest = dest0++;
cdat = p->fontdata+c*fontheight(p);
for (rows = fontheight(p); rows--; dest += p->next_line) {
d = *cdat++;
if (0 && underl && !rows)
d = 0xff;
else if (0 && bold)
d |= d>>1;
if (revs)
d = ~d;
writeb_hp (d, dest);
}
}
}
static void fbcon_sti_revc(struct display *p,
int xx, int yy)
{
u8 *dest, d;
u_int rows;
dest = p->fb_info->screen_base+yy*fontheight(p)*p->next_line+xx;
for (rows = fontheight(p); rows--; dest += p->next_line) {
d = readb_hp(dest);
writeb_hp (~d, dest);
}
}
static void
fbcon_sti_clear_margins(struct vc_data *conp,
struct display *p,
int bottom_only)
{
u8 *dest;
int height, bottom;
int inverse = conp ? attr_reverse(p,conp->vc_video_erase_char) : 0;
/* XXX Need to handle right margin? */
height = p->var.yres - conp->vc_rows * fontheight(p);
if (!height)
return;
bottom = conp->vc_rows + p->yscroll;
if (bottom >= p->vrows)
bottom -= p->vrows;
dest = p->fb_info->screen_base + bottom * fontheight(p) * p->next_line;
if (inverse)
memset_tohp(dest, 0xffffffff, height * p->next_line);
else
memset_tohp(dest, 0x00000000, height * p->next_line);
}
/*
* `switch' for the low level operations
*/
struct display_switch fbcon_sti = {
.setup = fbcon_sti_setup,
.bmove = fbcon_sti_bmove,
.clear = fbcon_sti_clear,
.putc = fbcon_sti_putc,
.putcs = fbcon_sti_putcs,
.revc = fbcon_sti_revc,
.clear_margins =fbcon_sti_clear_margins,
.fontwidthmask =FONTWIDTH(8)
};
MODULE_LICENSE("GPL");
This diff is collapsed.
......@@ -51,28 +51,11 @@ extern struct display fb_display[MAX_NR_CONSOLES];
extern char con2fb_map[MAX_NR_CONSOLES];
extern void set_con2fb_map(int unit, int newidx);
#define fontheight(p) ((p)->_fontheight)
#ifdef CONFIG_FONTWIDTH8_ONLY
/* fontwidth w is supported by dispsw */
#define FONTWIDTH(w) (1 << ((8) - 1))
/* fontwidths w1-w2 inclusive are supported by dispsw */
#define FONTWIDTHRANGE(w1,w2) FONTWIDTH(8)
#define fontwidth(p) (8)
#else
/* fontwidth w is supported by dispsw */
#define FONTWIDTH(w) (1 << ((w) - 1))
/* fontwidths w1-w2 inclusive are supported by dispsw */
#define FONTWIDTHRANGE(w1,w2) (FONTWIDTH(w2+1) - FONTWIDTH(w1))
#define fontwidth(p) ((p)->_fontwidth)
#endif
/*
* Attribute Decoding
*/
......
......@@ -4,7 +4,7 @@
/* */
/**********************************************/
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX (11*256)
......
......@@ -4,7 +4,7 @@
/* */
/**********************************************/
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 4096
......
......@@ -4,7 +4,7 @@
/* */
/**********************************************/
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 2048
......
/* Acorn-like font definition, with PC graphics characters */
#include <linux/config.h>
#include "font.h"
#include <linux/font.h>
static unsigned char acorndata_8x8[] = {
/* 00 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* ^@ */
......
......@@ -39,7 +39,7 @@ __END__;
MSBit to LSBit = left to right.
*/
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 1536
......
......@@ -9,7 +9,7 @@
/* */
/**********************************************/
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 2048
......
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 11264
......
#include "font.h"
#include <linux/font.h>
#define FONTDATAMAX 4096
......
......@@ -74,7 +74,7 @@ static char *mda_type_name;
/* console information */
static int mda_first_vc = 13;
static int mda_first_vc = 1;
static int mda_last_vc = 16;
static struct vc_data *mda_display_fg = NULL;
......@@ -604,28 +604,22 @@ const struct consw mda_con = {
.con_invert_region = mdacon_invert_region,
};
void __init mda_console_init(void)
int __init mda_console_init(void)
{
if (mda_first_vc > mda_last_vc)
return;
return 1;
take_over_console(&mda_con, mda_first_vc-1, mda_last_vc-1, 0);
}
#ifdef MODULE
MODULE_LICENSE("GPL");
int init_module(void)
{
mda_console_init();
return 0;
}
void cleanup_module(void)
void __exit mda_console_exit(void)
{
give_up_console(&mda_con);
}
#endif
module_init(mda_console_init);
module_exit(mda_console_exit);
MODULE_LICENSE("GPL");
......@@ -29,7 +29,7 @@
#define INCLUDE_LINUX_LOGO_DATA
#include <asm/linux_logo.h>
#include "font.h"
#include <linux/font.h>
#define LOGO_W 80
#define LOGO_H 80
......
#define STI_REGION_MAX 8
#define STI_DEV_NAME_LENGTH 32
struct sti_rom_font {
u16 first_char;
u16 last_char;
u8 width;
u8 height;
u8 font_type;
u8 bytes_per_char;
u32 next_font;
u8 underline_height;
u8 underline_pos;
u8 res008[2];
};
struct sti_rom {
u8 type[4];
u8 res004;
u8 num_mons;
u8 revno[2];
u8 graphics_id[8];
u32 font_start;
u32 statesize;
u32 last_addr;
u32 region_list;
u16 reentsize;
u16 maxtime;
u32 mon_tbl_addr;
u32 user_data_addr;
u32 sti_mem_req;
u32 user_data_size;
u16 power;
u8 bus_support;
u8 ext_bus_support;
u8 alt_code_type;
u8 ext_dd_struct[3];
u32 cfb_addr;
u32 init_graph;
u32 state_mgmt;
u32 font_unpmv;
u32 block_move;
u32 self_test;
u32 excep_hdlr;
u32 inq_conf;
u32 set_cm_entry;
u32 dma_ctrl;
u8 res040[7 * 4];
u32 init_graph_m68k;
u32 flow_ctrl;
u32 user_timing;
u32 process_mgr;
u32 sti_util;
u32 end_addr;
u32 res0b8;
u32 res0bc;
};
struct sti_cooked_font {
struct sti_rom_font *raw;
struct sti_cooked_font *next_font;
};
struct sti_cooked_rom {
struct sti_rom *raw;
struct sti_cooked_font *font_start;
u32 *region_list;
};
struct sti_glob_cfg_ext {
u8 curr_mon;
u8 friendly_boot;
s16 power;
s32 freq_ref;
s32 *sti_mem_addr;
s32 *future_ptr;
};
struct sti_glob_cfg {
s32 text_planes;
s16 onscreen_x;
s16 onscreen_y;
s16 offscreen_x;
s16 offscreen_y;
s16 total_x;
s16 total_y;
u32 region_ptrs[STI_REGION_MAX];
s32 reent_lvl;
s32 *save_addr;
struct sti_glob_cfg_ext *ext_ptr;
};
struct sti_init_flags {
u32 wait : 1;
u32 reset : 1;
u32 text : 1;
u32 nontext : 1;
u32 clear : 1;
u32 cmap_blk : 1;
u32 enable_be_timer : 1;
u32 enable_be_int : 1;
u32 no_chg_tx : 1;
u32 no_chg_ntx : 1;
u32 no_chg_bet : 1;
u32 no_chg_bei : 1;
u32 init_cmap_tx : 1;
u32 cmt_chg : 1;
u32 retain_ie : 1;
u32 pad : 17;
s32 *future_ptr;
};
struct sti_init_inptr_ext {
u8 config_mon_type;
u8 pad[1];
u16 inflight_data;
s32 *future_ptr;
};
struct sti_init_inptr {
s32 text_planes;
struct sti_init_inptr_ext *ext_ptr;
};
struct sti_init_outptr {
s32 errno;
s32 text_planes;
s32 *future_ptr;
};
struct sti_conf_flags {
u32 wait : 1;
u32 pad : 31;
s32 *future_ptr;
};
struct sti_conf_inptr {
s32 *future_ptr;
};
struct sti_conf_outptr_ext {
u32 crt_config[3];
u32 crt_hdw[3];
s32 *future_ptr;
};
struct sti_conf_outptr {
s32 errno;
s16 onscreen_x;
s16 onscreen_y;
s16 offscreen_x;
s16 offscreen_y;
s16 total_x;
s16 total_y;
s32 bits_per_pixel;
s32 bits_used;
s32 planes;
u8 dev_name[STI_DEV_NAME_LENGTH];
u32 attributes;
struct sti_conf_outptr_ext *ext_ptr;
};
struct sti_font_inptr {
u32 font_start_addr;
s16 index;
u8 fg_color;
u8 bg_color;
s16 dest_x;
s16 dest_y;
s32 *future_ptr;
};
struct sti_font_flags {
u32 wait : 1;
u32 non_text : 1;
u32 pad : 30;
s32 *future_ptr;
};
struct sti_font_outptr {
s32 errno;
s32 *future_ptr;
};
struct sti_blkmv_flags {
u32 wait : 1;
u32 color : 1;
u32 clear : 1;
u32 non_text : 1;
u32 pad : 28;
s32 *future_ptr;
};
struct sti_blkmv_inptr {
u8 fg_color;
u8 bg_color;
s16 src_x;
s16 src_y;
s16 dest_x;
s16 dest_y;
s16 width;
s16 height;
s32 *future_ptr;
};
struct sti_blkmv_outptr {
s32 errno;
s32 *future_ptr;
};
struct sti_struct {
spinlock_t lock;
struct sti_cooked_rom *rom;
unsigned long font_unpmv;
unsigned long block_move;
unsigned long init_graph;
unsigned long inq_conf;
struct sti_glob_cfg *glob_cfg;
struct sti_rom_font *font;
s32 text_planes;
char **mon_strings;
u32 *regions;
u8 *pci_regions;
};
#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
({ \
real32_call( func, (unsigned long)STI_PTR(flags), \
STI_PTR(inptr), STI_PTR(outptr), \
glob_cfg); \
})
/* The latency of the STI functions cannot really be reduced by setting
* this to 0; STI doesn't seem to be designed to allow calling a different
* function (or the same function with different arguments) after a
* function exited with 1 as return value.
*
* As all of the functions below could be called from interrupt context,
* we have to spin_lock_irqsave around the do { ret = bla(); } while(ret==1)
* block. Really bad latency there.
*
* Probably the best solution to all this is have the generic code manage
* the screen buffer and a kernel thread to call STI occasionally.
*
* Luckily, the frame buffer guys have the same problem so we can just wait
* for them to fix it and steal their solution. prumpf
*
* Actually, another long-term viable solution is to completely do STI
* support in userspace - that way we avoid the potential license issues
* of using proprietary fonts, too. */
#define STI_WAIT 1
#define STI_PTR(p) ( (typeof(p)) virt_to_phys(p))
#define PTR_STI(p) ( (typeof(p)) phys_to_virt((unsigned long)p) )
#define sti_onscreen_x(sti) (PTR_STI(sti->glob_cfg)->onscreen_x)
#define sti_onscreen_y(sti) (PTR_STI(sti->glob_cfg)->onscreen_y)
#define sti_font_x(sti) (PTR_STI(sti->font)->width)
#define sti_font_y(sti) (PTR_STI(sti->font)->height)
extern struct sti_struct * sti_init_roms(void);
void sti_init_graph(struct sti_struct *sti);
void sti_inq_conf(struct sti_struct *sti);
void sti_putc(struct sti_struct *sti, int c, int y, int x);
void sti_set(struct sti_struct *sti, int src_y, int src_x,
int height, int width, u8 color);
void sti_clear(struct sti_struct *sti, int src_y, int src_x,
int height, int width);
void sti_bmove(struct sti_struct *sti, int src_y, int src_x,
int dst_y, int dst_x, int height, int width);
/* XXX: this probably should not be here, but we rely on STI being
initialized early and independently of stifb at the moment, so
there's no other way for stifb to find it. */
extern struct sti_struct default_sti;
This diff is collapsed.
This diff is collapsed.
......@@ -22,6 +22,10 @@
* control.c: Console support for PowerMac "control" display adaptor.
* Copyright (C) 1996 Paul Mackerras
*
* Updated to 2.5 framebuffer API by Ben Herrenschmidt
* <benh@kernel.crashing.org>, Paul Mackerras <paulus@samba.org>,
* and James Simmons <jsimmons@infradead.org>.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive for
* more details.
......@@ -50,12 +54,7 @@
#include <asm/pgtable.h>
#include <asm/btext.h>
#include <video/fbcon.h>
#include <video/fbcon-cfb8.h>
#include <video/fbcon-cfb16.h>
#include <video/fbcon-cfb32.h>
#include <video/macmodes.h>
#include "macmodes.h"
#include "controlfb.h"
struct fb_par_control {
......@@ -97,7 +96,6 @@ static inline int VAR_MATCH(struct fb_var_screeninfo *x, struct fb_var_screeninf
struct fb_info_control {
struct fb_info info;
struct display display; /* Will disappear */
struct fb_par_control par;
u32 pseudo_palette[17];
......@@ -119,14 +117,14 @@ struct fb_info_control {
};
/* control register access macro */
#define CNTRL_REG(INFO,REG) (&(((INFO)->control_regs-> ## REG).r))
#define CNTRL_REG(INFO,REG) (&(((INFO)->control_regs->REG).r))
/******************** Prototypes for exported functions ********************/
/*
* struct fb_ops
*/
static int controlfb_pan_display(struct fb_var_screeninfo *var, int con,
static int controlfb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info);
static int controlfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
......@@ -171,11 +169,8 @@ static int default_cmode __initdata = CMODE_NVRAM;
static struct fb_ops controlfb_ops = {
.owner = THIS_MODULE,
.fb_set_var = gen_set_var,
.fb_check_var = controlfb_check_var,
.fb_set_par = controlfb_set_par,
.fb_get_cmap = gen_get_cmap,
.fb_set_cmap = gen_set_cmap,
.fb_setcolreg = controlfb_setcolreg,
.fb_pan_display = controlfb_pan_display,
.fb_blank = controlfb_blank,
......@@ -265,8 +260,8 @@ static inline void set_screen_start(int xoffset, int yoffset,
}
static int controlfb_pan_display(struct fb_var_screeninfo *var, int con,
struct fb_info *info)
static int controlfb_pan_display(struct fb_var_screeninfo *var,
struct fb_info *info)
{
unsigned int xoffset, hstep;
struct fb_info_control *p = (struct fb_info_control *)info;
......@@ -483,7 +478,7 @@ static int __init init_control(struct fb_info_control *p)
/* Apply default var */
p->info.var = var;
var.activate = FB_ACTIVATE_NOW;
rc = gen_set_var(&var, -1, &p->info);
rc = fb_set_var(&var, &p->info);
if (rc && (vmode != VMODE_640_480_60 || cmode != CMODE_8))
goto try_again;
......@@ -491,7 +486,7 @@ static int __init init_control(struct fb_info_control *p)
if (register_framebuffer(&p->info) < 0)
return -ENXIO;
printk(KERN_INFO "fb%d: control display adapter\n", GET_FB_IDX(p->info.node));
printk(KERN_INFO "fb%d: control display adapter\n", minor(p->info.node));
return 0;
}
......@@ -1015,22 +1010,12 @@ static void control_par_to_var(struct fb_par_control *par, struct fb_var_screeni
static void __init control_init_info(struct fb_info *info, struct fb_info_control *p)
{
/* Fill fb_info */
strcpy(info->modename, "control");
info->currcon = -1;
info->par = &p->par;
info->node = NODEV;
info->fbops = &controlfb_ops;
info->disp = &p->display;
info->pseudo_palette = p->pseudo_palette;
info->flags = FBINFO_FLAG_DEFAULT;
strncpy (info->fontname, fontname, sizeof (info->fontname));
info->fontname[sizeof (info->fontname) - 1] = 0;
info->changevar = NULL;
info->display_fg = NULL;
info->screen_base = (char *) p->frame_buffer + CTRLFB_OFF;
info->changevar = NULL;
info->switch_con = gen_switch;
info->updatevar = gen_update_var;
fb_alloc_cmap(&info->cmap, 256, 0);
......
This diff is collapsed.
This diff is collapsed.
#
# Makefile for the Intel 810/815 framebuffer driver
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now in the main makefile...
obj-$(CONFIG_FB_I810) += i810fb.o
i810fb-objs := i810_main.o i810_accel.o
ifdef CONFIG_FB_I810_GTF
i810fb-objs += i810_gtf.o
else
i810fb-objs += i810_dvt.o
endif
include $(TOPDIR)/Rules.make
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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