/shark/trunk/drivers/fb/vesa.h |
---|
0,0 → 1,93 |
#include "ll/sys/cdefs.h" |
typedef struct { /* Questa struttura ci serve per definire */ |
BYTE red, green, blue; /* la nostra palette. */ |
} TYPE_PALETTE; |
typedef TYPE_PALETTE palette[256]; |
/* |
Tipo VbeInfoBlock: in esso sono contenute tutte le caratteristiche del |
display grafico a nostra disposizione. |
*/ |
typedef struct { |
unsigned char VbeSignature[4]; /* Deve essere 'VBE2' */ |
unsigned short int VbeVersion; /* Versione del driver */ |
unsigned short int OemNameOffset; /* Nome della scheda grafica */ |
unsigned short int OemNameSegment; |
unsigned char Capabilities[4]; /* Caratt. display grafico */ |
unsigned short int SupportedModesOffset; /* Puntatore alla lista dei modi */ |
unsigned short int SupportedModesSegment; /* supportati */ |
unsigned short int TotalMemory; /* Memoria a bordo della scheda*/ |
unsigned short int OemSoftwareRev; /* Livello revisione VBE */ |
unsigned short int OemVendorNameOffset; /* Nome del produttore */ |
unsigned short int OemVendorNameSegment; |
unsigned short int OemProductNameOffset; /* Nome del prodotto */ |
unsigned short int OemProductNameSegment; |
unsigned short int OemProductRevOffset; /* Livello revisione display */ |
unsigned short int OemProductRevSegment; |
unsigned char reserved[222]; /* Riservato */ |
unsigned char OemData[256]; |
} VbeInfoBlock; |
/* |
Tipo ModeInfoBlock: in esso sono contenute tutte le caratteristiche |
del modo grafico che vogliamo attivare. |
*/ |
typedef struct { |
unsigned short int ModeAttributes; /* Specifiche del modo */ |
unsigned char WinAAttributes; /* Caratt. della window A */ |
unsigned char WinBAttributes; /* Caratt. della window B */ |
unsigned short int WinGranularity; /* GranularitÂ… -> window */ |
unsigned short int WinSize; /* Dimensione -> window */ |
unsigned short int WinASegment; /* Indirizzo window A */ |
unsigned short int WinBSegment; /* Indirizzo window B */ |
void (*WPF) (signed long int page); /* Indirizzo funzione */ |
unsigned short int BytesPerScanLine; |
unsigned short int XResolution; /* Larghezza in pixel */ |
unsigned short int YResolution; /* Altezza in pixel */ |
unsigned char XCharSize; /* Larghezza carattere */ |
unsigned char YCharSize; /* Altezza carattere */ |
unsigned char NumberOfPlanes; /* Numero dei planes disponibili*/ |
unsigned char BitsPerPixel; /* Num. bit per ogni pixel */ |
unsigned char NumberOfBanks; /* Num. dei banchi presenti*/ |
unsigned char MemoryModel; /* Tipo di memoria utilizzato*/ |
unsigned char BankSize; /* Dimensione di ogni banco*/ |
unsigned char NumberOfImagePages; /* Num. -1 di schermate */ |
unsigned char Reserved; /* Riservato */ |
unsigned char RedMaskSize; /* Maschera per rosso */ |
unsigned char RedFieldPosition; /* Posizione bit rosso */ |
unsigned char GreenMaskSize; /* Maschera per verde */ |
unsigned char GreenFieldPosition; /* Posizione bit verde */ |
unsigned char BlueMaskSize; /* Maschera per blu */ |
unsigned char BlueFieldPosition; /* Posizione bit blu */ |
unsigned char RsvdMaskSize; |
unsigned char RsvdFieldPosition; |
unsigned char DirectColorModeInfo; /* Caratt. colori modo diretto*/ |
unsigned long int PhysBasePtr; /* Linear Frame Buffer */ |
unsigned long int OffScreenMemoryOffset; /* Offset mem. "fuori schermo"*/ |
unsigned long int OffScreenMemSize; /* Mem. disponibile "" ""*/ |
unsigned char Reserved2 [206]; /* Riservato */ |
} ModeInfoBlock; |
/****************************************************************************/ |
/* PROTOTYPES */ |
/****************************************************************************/ |
int vbe_getinfo(void); |
int vbe_check_id(void); |
void vbe_showinfo(void); |
DWORD vbe_getmodeinfo(ModeInfoBlock *ModeInfo, WORD Vbe_Mode); |
int vbe_setmode (WORD Vbe_Mode); |
WORD vbe_getbpr(ModeInfoBlock *ModeInfo); |
DWORD vbe_getflb(void); |
int vbe_setbank(ModeInfoBlock *ModeInfo, BYTE bank); |
void vbe_showmodeinfo (ModeInfoBlock *ModeInfo); |
int vbe_checkmode(WORD mode); |
DWORD vbe_getmem(void); |
/shark/trunk/drivers/fb/vesafb.c |
---|
30,6 → 30,10 |
#define dac_reg (0x3c8) |
#define dac_val (0x3c9) |
#include <vesa.h> |
#define INIT_MODE 0x4101 |
/* --------------------------------------------------------------------- */ |
static struct fb_var_screeninfo vesafb_defined __initdata = { |
216,14 → 220,51 |
return 0; |
} |
extern VbeInfoBlock VbeInfo; |
extern int vbe_getifo(void); |
extern void vm86_init(void); |
int __init vesafb_init(void) |
{ |
ModeInfoBlock ModeInfo; |
int video_cmap_len; |
int i; |
vm86_init(); |
if (vbe_getinfo()) |
return -EIO; |
printk(KERN_INFO "VBE Extension Found.\n"); |
screen_info.lfb_base = vbe_getmodeinfo(&ModeInfo,INIT_MODE); |
screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB; |
if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) |
return -ENXIO; |
screen_info.lfb_depth = ModeInfo.BitsPerPixel; |
screen_info.lfb_width = ModeInfo.XResolution; |
screen_info.lfb_height = ModeInfo.YResolution; |
screen_info.lfb_linelength = ModeInfo.BytesPerScanLine; |
screen_info.lfb_size = VbeInfo.TotalMemory; |
screen_info.pages = ModeInfo.NumberOfImagePages; |
screen_info.vesapm_seg = 0; |
screen_info.vesapm_off = 0; |
screen_info.red_pos = ModeInfo.RedFieldPosition; |
screen_info.red_size = ModeInfo.RedMaskSize; |
screen_info.green_pos = ModeInfo.GreenFieldPosition; |
screen_info.green_size = ModeInfo.GreenMaskSize; |
screen_info.blue_pos = ModeInfo.BlueFieldPosition; |
screen_info.blue_size = ModeInfo.BlueMaskSize; |
screen_info.rsvd_pos = ModeInfo.RsvdFieldPosition; |
screen_info.rsvd_size = ModeInfo.RsvdMaskSize; |
vbe_setmode(INIT_MODE); |
vesafb_fix.smem_start = screen_info.lfb_base; |
vesafb_defined.bits_per_pixel = screen_info.lfb_depth; |
if (15 == vesafb_defined.bits_per_pixel) |
231,7 → 272,7 |
vesafb_defined.xres = screen_info.lfb_width; |
vesafb_defined.yres = screen_info.lfb_height; |
vesafb_fix.line_length = screen_info.lfb_linelength; |
vesafb_fix.smem_len = screen_info.lfb_size * 65536; |
vesafb_fix.smem_len = screen_info.lfb_size; |
vesafb_fix.visual = (vesafb_defined.bits_per_pixel == 8) ? |
FB_VISUAL_PSEUDOCOLOR : FB_VISUAL_TRUECOLOR; |
285,6 → 326,7 |
for (i = pmi_base[3]/2; pmi_base[i] != 0xffff; i++) |
printk("%x ",pmi_base[i]); |
printk("\n"); |
if (pmi_base[i] != 0xffff) { |
/* |
* memory areas not supported (yet?) |
/shark/trunk/drivers/fb/gdvesa.c |
---|
0,0 → 1,248 |
#include <ll/i386/hw-data.h> |
#include <ll/i386/mem.h> |
#include <ll/i386/string.h> |
#include <ll/i386/x-dos.h> |
#include <ll/i386/x-dosmem.h> |
#include <ll/i386/cons.h> |
#include <ll/sys/ll/ll-func.h> |
#include "vesa.h" |
VbeInfoBlock VbeInfo; /* VBE 2.0 Informations */ |
DWORD vbe_screen; /* Frame Linear Buffer Address */ |
char VideoModeNames [96][40] = { |
"100 - 640x400 256 colors", "101 - 640x480 256 colors", "102 - 800x600 16 colors", |
"103 - 800x600 256 colors", "104 - 1024x768 16 colors", "105 - 1024x768 256 colors", |
"106 - 1280x1024 16 colors", "107 - 1280x1024 256 colors", "108 - 80x60 Text Mode", |
"109 - 132x25 Text Mode", "10A - 132x43 Text Mode", "10B - 132x50 Text Mode", |
"10C - 132x60 Text Mode", "10D - 320x200 32,768 colors", "10E - 320x200 65,536 colors", |
"10F - 320x200 16m colors", "110 - 640x480 32,768 colors", "111 - 640x480 65,536 colors", |
"112 - 640x480 16m colors", "113 - 800x600 32,768 colors", "114 - 800x600 65,536 colors", |
"115 - 800x600 16m colors", "116 - 1024x768 32,768 colors", "117 - 1024x768 65,536 colors", |
"118 - 1024x768 16m colors", "119 - 1280x1024 32,768 colors", "11A - 1280x1024 65,536 colors", |
"11B - 1280x1024 16m colors", "11C - 640x350 256 colors", "11D - 640x350 32,768 colors", |
"11E - 640x400 32,768 colors", "11F - 640x350 65,536 colors", "120 - 640x400 65,536 colors", |
"121 - 640x350 16m colors", "122 - 640x400 16m colors", "123 - 1600x1200 16 colors", |
"124 - 1600x1200 256 colors", "125 - 1600x1200 32,768 colors", "126 - 1600x1200 65,536 colors", |
"127 - 1600x1200 16m colors", "128 - 640x480 16m colors(*)", "129 - 800x600 16m colors(*)", |
"12A - 1024x768 16m colors(*)", "12B - 1280x1024 16m colors(*)", "12C - 1600x1200 16m colors(*)", |
"12D - 320x240 32,768 colors", "12E - 320x400 32,768 colors", "12F - 360x200 32,768 colors", |
"130 - 360x240 32,768 colors", "131 - 360x400 32,768 colors", "132 - 320x240 65,536 colors", |
"133 - 320x400 65,536 colors", "134 - 360x200 65,536 colors", "135 - 360x240 65,536 colors", |
"136 - 360x400 65,536 colors", "137 - 320x240 16m colors", "138 - 320x400 16m colors", |
"139 - name n/a", "13A - name n/a", "13B - name n/a", |
"13C - name n/a", "13D - name n/a", "13E - name n/a", |
"13F - name n/a", "140 - name n/a", "141 - name n/a", |
"142 - 640x350 16m colors(*)", "143 - 640x400 16m colors(*)", "144 - name n/a", |
"145 - name n/a", "146 - name n/a", "147 - name n/a", |
"148 - name n/a", "149 - name n/a", "14A - name n/a", |
"14B - name n/a", "14C - name n/a", "14D - name n/a", |
"14E - name n/a", "14F - name n/a", "150 - 640x350 16 colors", |
"151 - 640x400 16 colors", "152 - 640x480 16 colors", "153 - 320x200 256 colors", |
"154 - 320x240 256 colors", "155 - 320x400 256 colors", "156 - 360x200 256 colors", |
"157 - 360x240 256 colors", "158 - 360x400 256 colors", "159 - name n/a", |
"15A - name n/a", "15B - name n/a", "15C - name n/a", |
"15D - name n/a", "15E - name n/a", "15F - name n/a" |
}; |
int vbe_check_status (WORD vbe_function_result) |
{ |
if (vbe_function_result != 0x004f) { |
switch (vbe_function_result) { |
case 0x014f : return -1; /* VBE Generic error */ |
case 0x024f : return -2; /* Hardware incompatibility error */ |
case 0x034f : return -3; /* Unvalid function requested */ |
default : return -4; /* Unknown error */ |
} |
} |
return 1; |
} |
int vbe_getinfo(void) |
{ |
X_REGS16 inregs, outregs; /* registri normali */ |
X_SREGS16 sregs; /* registri estesi */ |
LIN_ADDR DOSaddr; |
DWORD linearaddr; |
#ifndef VM86 |
BYTE p1, p2; |
#endif |
/* Allochiamo mem per il nostro blocco */ |
if ((DOSaddr = DOS_alloc(sizeof(VbeInfoBlock))) == 0) { |
/* set_text_mode ();*/ |
return -1; |
} else { |
/* linearaddr = appl2linear(DOSaddr);*/ |
linearaddr = (DWORD) DOSaddr; |
/* 0x00 = Get Vbe2.0 Info */ |
inregs.x.ax = 0x4f00; |
/* Indirizzo reale del nostro blocco */ |
inregs.x.di = linearaddr & 0x000F; |
sregs.es = ((linearaddr & 0xFFFF0) >> 4); |
sregs.ds = ((linearaddr & 0xFFFF0) >> 4); |
/* Settiamo il VbeSignature correttamente */ |
VbeInfo.VbeSignature[0] = 'V'; |
VbeInfo.VbeSignature[1] = 'B'; |
VbeInfo.VbeSignature[2] = 'E'; |
VbeInfo.VbeSignature[3] = '2'; |
memcpy((void *)linearaddr, &VbeInfo, sizeof(VbeInfo)); |
#ifndef VM86 |
p1 = inp(0x21); |
p2 = inp(0xA1); |
outp(0x21,0xFF); |
outp(0xA1,0xFF); |
X_callBIOS(0x10, &inregs, &outregs, &sregs); |
outp(0x21,p1); |
outp(0xA1,p2); |
#else |
vm86_callBIOS(0x10, &inregs, &outregs, &sregs); |
#endif |
if (vbe_check_status(outregs.x.ax) < 0) |
return -1; |
memcpy(&VbeInfo, (void *)linearaddr, sizeof(VbeInfo)); |
return 0; |
} |
} |
void vbe_showmodes(void) |
{ |
short int modec; |
WORD list; |
LIN_ADDR VideoModeaddr; |
list=0; |
VideoModeaddr = (LIN_ADDR)((VbeInfo.SupportedModesSegment<<4) + VbeInfo.SupportedModesOffset); |
cprintf ("\nList of modes supported:\n"); |
do { |
memcpy(&modec, VideoModeaddr, 2); |
VideoModeaddr += 2; |
if (modec != -1) cprintf (" %s ", VideoModeNames[modec - 0x100]); |
list++; |
if (list % 2 == 0) cprintf ("\n"); |
} while ((modec != -1) && (list < 40)); |
cprintf ("\nToal modes supported: %d", list); |
} |
DWORD vbe_getmodeinfo(ModeInfoBlock *ModeInfo, WORD Vbe_Mode) |
{ |
X_REGS16 inregs, outregs; |
X_SREGS16 sregs; |
LIN_ADDR dosaddr; |
#ifndef VM86 |
BYTE p1, p2; |
#endif |
if ((dosaddr = DOS_alloc(sizeof(ModeInfoBlock))) == 0) { |
return(-1); |
} |
/* 0x01 = Get Vbe Mode Info */ |
inregs.x.ax = 0x4f01; |
inregs.x.cx = Vbe_Mode; |
inregs.x.di = (DWORD)dosaddr & 0x000F; |
sregs.es = (((DWORD)dosaddr & 0xFFFF0) >> 4); |
sregs.ds = (((DWORD)dosaddr & 0xFFFF0) >> 4); |
#ifndef VM86 |
p1 = inp(0x21); |
p2 = inp(0xA1); |
outp(0x21,0xFF); |
outp(0xA1,0xFF); |
X_callBIOS(0x10, &inregs, &outregs, &sregs); |
outp(0x21,p1); |
outp(0xA1,p2); |
#else |
vm86_callBIOS(0x10, &inregs, &outregs, &sregs); |
#endif |
if (vbe_check_status (outregs.x.ax) < 0) { |
return -1; |
} |
memcpy(ModeInfo, dosaddr, sizeof(ModeInfoBlock)); |
vbe_screen = ModeInfo->PhysBasePtr; |
if(vbe_screen == -1) { |
return -1; |
} |
return vbe_screen; |
} |
DWORD vbe_getflb(void) |
{ |
return vbe_screen; |
} |
int vbe_setmode (WORD Vbe_Mode) |
{ |
X_REGS16 inregs, outregs; |
X_SREGS16 sregs; |
#ifndef VM86 |
BYTE p1, p2; |
#endif |
memset (&inregs, 0, sizeof(inregs)); |
/* Set Vesa Vbe mode */ |
inregs.x.ax = 0x4f02; |
inregs.x.bx = Vbe_Mode; |
#ifndef VM86 |
p1 = inp(0x21); |
p2 = inp(0xA1); |
outp(0x21,0xFF); |
outp(0xA1,0xFF); |
X_callBIOS(0x10, &inregs, &outregs, &sregs); |
outp(0x21,p1); |
outp(0xA1,p2); |
#else |
vm86_callBIOS(0x10, &inregs, &outregs, &sregs); |
#endif |
return 1; //vbe_check_status (outregs.x.ax); |
} |
WORD vbe_getbpr(ModeInfoBlock *ModeInfo) |
{ |
return ModeInfo->BytesPerScanLine; |
} |
int vbe_setbank(ModeInfoBlock *ModeInfo, BYTE bank) |
{ |
X_REGS16 inregs, outregs; |
X_SREGS16 sregs; |
#ifndef VM86 |
BYTE p1, p2; |
#endif |
memset (&inregs, 0, sizeof(inregs)); |
memset (&sregs, 0, sizeof(sregs)); |
/* Set Window */ |
inregs.x.ax = 0x4f05; |
inregs.h.bh = 0x00; |
inregs.h.bl = 0x00; |
inregs.x.dx = (64 / ModeInfo->WinGranularity) * bank; |
#ifndef VM86 |
p1 = inp(0x21); |
p2 = inp(0xA1); |
outp(0x21,0xFF); |
outp(0xA1,0xFF); |
X_callBIOS(0x10, &inregs, &outregs, &sregs); |
outp(0x21,p1); |
outp(0xA1,p2); |
#else |
vm86_callBIOS(0x10, &inregs, &outregs, &sregs); |
#endif |
return vbe_check_status (outregs.x.ax); |
} |
DWORD vbe_getmem(void) |
{ |
return (VbeInfo.TotalMemory<<6) * 1024; |
} |
/shark/trunk/drivers/fb/riva/fbdev.c |
---|
63,7 → 63,7 |
* |
* ------------------------------------------------------------------------- */ |
#define RIVAFBDEBUG |
#undef RIVAFBDEBUG |
#ifdef RIVAFBDEBUG |
#define DPRINTK(fmt, args...) printk(KERN_DEBUG "%s: " fmt, __FUNCTION__ , ## args) |
#else |
1886,7 → 1886,7 |
RIVAFB_VERSION, |
info->fix.id, |
info->fix.smem_len / (1024 * 1024), |
info->fix.smem_start); |
(int)info->fix.smem_start); |
return 0; |
err_out_iounmap_fb: |
/shark/trunk/drivers/fb/fbmem.c |
---|
1153,6 → 1153,7 |
{ |
int fbidx = iminor(inode); |
struct fb_info *info; |
struct fb_fillrect rect; |
int res = 0; |
if (fbidx >= FB_MAX) |
1174,6 → 1175,15 |
info->fbops->fb_set_par(info); |
fb_pan_display(info, &info->var); |
rect.dx = 0; |
rect.dy = 0; |
rect.width = info->var.xres; |
rect.height = info->var.yres; |
rect.color = 0; |
rect.rop = ROP_COPY; |
cfb_fillrect(info,&rect); |
if (info->var.bits_per_pixel >= 8) { |
fb_prepare_logo(info); |
/shark/trunk/drivers/fb/makefile |
---|
11,12 → 11,12 |
OBJS_PATH = $(BASE)/drivers/fb |
OBJS = fbmem.o fbcmap.o cfbfillrect.o softcursor.o cfbcopyarea.o cfbimgblt.o\ |
modedb.o vga16fb.o vgastate.o vesafb.o radeonfb.o shark_fb26.o\ |
modedb.o vga16fb.o vgastate.o vesafb.o radeonfb.o shark_fb26.o gdvesa.o\ |
logo.o logo_bmp.o ./riva/fbdev.o ./riva/nv_driver.o ./riva/riva_hw.o |
OTHERINCL += -I$(BASE)/drivers/linuxc26/include |
OTHERINCL += -I$(BASE)/drivers/linuxc26/include -I. |
C_OPT += -D__KERNEL__ -D__i386__ -DCONFIG_FB_RIVA -DCONFIG_LOGO |
C_OPT += -D__KERNEL__ -D__i386__ -DCONFIG_FB_VESA -DCONFIG_LOGO |
include $(BASE)/config/lib.mk |