Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 74 → Rev 73

/shark/trunk/drivers/svga/r128io.h
File deleted
/shark/trunk/drivers/svga/r128.c
File deleted
/shark/trunk/drivers/svga/r128_reg.h
File deleted
/shark/trunk/drivers/svga/grx/glib.h
20,11 → 20,11
 
/**
------------
CVS : $Id: glib.h,v 1.2 2003-03-13 13:08:38 giacomo Exp $
CVS : $Id: glib.h,v 1.1 2003-02-28 11:23:40 pj Exp $
 
File: $File$
Revision: $Revision: 1.2 $
Last update: $Date: 2003-03-13 13:08:38 $
Revision: $Revision: 1.1 $
Last update: $Date: 2003-02-28 11:23:40 $
------------
 
**/
53,12 → 53,12
 
#include <ll/sys/types.h>
 
int grx_setbuffer(BYTE *vbuf,WORD w, WORD h);
int grx_setbuffer(unsigned char *vbuf,unsigned int w, unsigned int h);
 
void grx_plot(WORD x, WORD y, DWORD color);
DWORD grx_getpixel(WORD x, WORD y);
//void grx_getimage(WORD x1, WORD y1, WORD x2, WORD y2, BYTE *buf);
//void grx_putimage(WORD x1, WORD y1, WORD x2, WORD y2, BYTE *buf);
void grx_putimage(WORD x1, WORD y1, WORD x2, WORD y2, BYTE *buf);
void grx_box(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color);
void grx_rect(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color);
void grx_line(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color);
/shark/trunk/drivers/svga/grx/glib.c
5,28 → 5,10
 
#define fontaddr 0xffa6eL /* indirizzo set caratteri */
 
BYTE * flbaddr;
WORD bpr;
WORD height, width;
unsigned char * flbaddr;
unsigned int bpr;
unsigned int height, width;
 
inline void memsetw(void *dst, unsigned int c, unsigned long int memdiv2)
{
__asm__ __volatile__("push %%edi
push %%eax
push %%ecx
movl %2, %%edi
cld
rep
stosw
pop %%ecx
pop %%eax
pop %%edi"
:
: "c" (memdiv2), "a" (c), "b" (dst));
 
}
 
 
static void circlepixels(WORD x, WORD y, WORD sx, WORD sy, DWORD c)
{
grx_plot(sx + x, sy + y, c);
97,15 → 79,13
}
}
 
int grx_setbuffer(BYTE *vbuf, WORD w, WORD h)
int grx_setbuffer(unsigned char *vbuf, unsigned int w, unsigned int h)
{
 
//This functions are designed to work only whit 16 bpp
flbaddr = vbuf;
width = w;
height = h;
bpr = 2 * w;
bpr = 4 * w;
return 1;
125,14 → 105,14
 
void grx_box(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
{
BYTE * addr;
int dx, y;
unsigned char * addr;
WORD dx, y;
addr = flbaddr + (x1 << 1) + bpr * y1;
dx = (x2 - x1 + 1) << 1;
addr = flbaddr + (x1 << 2) + bpr * y1;
dx = (x2 - x1 + 1);
 
for (y = y1; y <= y2; y++) {
memsetw(addr,color,(dx>>1));
memset((unsigned long int *)(addr),(DWORD)(color),dx);
addr += bpr;
}
}
139,40 → 119,39
 
void grx_rect(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
{
BYTE * addr;
int dx, y;
unsigned char * addr;
WORD dx, y;
addr = flbaddr + (x1 << 1) + bpr * y1;
dx = (x2 - x1) << 1;
addr = flbaddr + (x1 << 2) + bpr * y1;
dx = (x2 - x1);
 
memsetw(addr,color,(dx>>1)+1);
memset((unsigned long int *)(addr),(DWORD)color,dx+2);
addr += bpr;
 
for (y = y1 + 1; y <= y2 - 1; y++) {
*(WORD *)(addr) = (WORD)(color);
*(WORD *)(addr + dx) = (WORD)(color);
*(unsigned long int *)addr = (DWORD)color;
*(unsigned long int *)(addr + (dx<<2)) = (DWORD)color;
addr += bpr;
}
memsetw(addr,color,(dx>>1)+1);
memset((unsigned long int *)(addr),(DWORD)(color),dx+2);
}
 
void grx_text(char *text, WORD x, WORD y, DWORD fg, DWORD bg)
{
BYTE * fp;
BYTE * addr;
unsigned char * fp, * addr;
int r, c, bits;
 
addr = flbaddr;
while (*text) {
fp = (BYTE *)(fontaddr + (8 * *(BYTE *)text));
fp = (unsigned char *)(fontaddr + (8 * *(BYTE *)text));
for (r=0; r<8; r++) {
bits = *(BYTE *)(fp++);
bits = *(unsigned char *)(fp++);
for (c=0; c<8; c++)
if (bits & (0x80>>c))
*(WORD *)(addr + (y + r) * bpr + ((x + c) << 1)) = (WORD)(fg);
*(unsigned long int *)(addr + (y + r) * bpr + ((x + c) << 2)) = (DWORD)fg;
else
*(WORD *)(addr + (y + r) * bpr + ((x + c) << 1)) = (WORD)(bg);
*(unsigned long int *)(addr + (y + r) * bpr + ((x + c) << 2)) = (DWORD)bg;
}
text++;
x += 8;
182,7 → 161,7
void grx_line(WORD x1, WORD y1, WORD x2, WORD y2, DWORD color)
{
register int t, distance;
BYTE * addr;
unsigned char * addr;
int xerr=0, yerr=0, deltax, deltay;
int incx, incy;
 
212,7 → 191,7
distance = deltay;
 
for (t=0; t<=distance+1; t++) { /* draw the line */
*(WORD *)(addr + y1 * bpr + (x1 << 1)) = (WORD)color;
*(unsigned long int *)(addr + y1 * bpr + (x1 << 2)) = (DWORD)color;
xerr += deltax;
yerr += deltay;
if (xerr > distance) {
228,7 → 207,7
 
void grx_plot(WORD x, WORD y, DWORD color)
{
*(WORD *)(flbaddr + y * bpr + (x << 1)) = (WORD)color;
*(unsigned long int *)(flbaddr + y * bpr + (x << 2)) = (DWORD)color;
}
 
DWORD grx_getpixel(WORD x, WORD y)
235,7 → 214,7
{
DWORD rv;
 
(DWORD)rv = *(WORD *)(flbaddr + y * bpr + (x << 1));
(DWORD)rv = *(unsigned long int *)(flbaddr + y * bpr + (x << 2));
return rv;
}
 
/shark/trunk/drivers/svga/vga.c
34,7 → 34,6
extern int init_vgapci(void);
extern int nv3_test(void);
extern int savage_test(void);
extern int r128_test(void);
 
/* If == 0 then nothing is defined by the user... */
int __svgalib_default_mode = 10;
824,16 → 823,6
graph_mem = GM; /* Exported variable. */
}
 
void __svgalib_emul_setpage(int page)
{
static int oldpage = -2;
 
if (page != oldpage)
{
oldpage = page;
}
}
 
static void map_vgaio(void)
{
__svgalib_inmisc=__svgalib_vga_inmisc;
983,10 → 972,9
 
/* SHARK: Supported Graphics Drivers
*
* NV3 (NVIDIA: GEFORCE/TNT/TNT2)
* SAVAGE (S3: VIRGE/SAVAGE
* R128 (ATI: RAGE 128/RADEON)
*
* NVIDIA
* SAVAGE
*
*/
CHIPSET = set_chipset;
1003,9 → 991,6
case SAVAGE:
savage_test();
break;
case R128:
r128_test();
break;
}
}
1014,40 → 999,6
 
}
 
int vga_getxdim(void)
{
return CI.xdim;
}
 
 
int vga_getydim(void)
{
return CI.ydim;
}
 
 
int vga_getcolors(void)
{
return CI.colors;
}
 
int vga_white(void)
{
switch (CI.colors) {
case 2:
case 16:
case 256:
return 15;
case 1 << 15:
return 32767;
case 1 << 16:
return 65535;
case 1 << 24:
return (1 << 24) - 1;
}
return CI.colors - 1;
}
 
void __svgalib_delay(void)
{
int i;
1395,20 → 1346,3
: "c" (memdiv2), "a" (src), "b" (dst));
 
}
 
inline void copy_videomem_16to16(void *src, void *dst, unsigned long int memdiv4)
{
__asm__ __volatile__("push %%esi
push %%edi
movl %1, %%esi
movl %2, %%edi
cld
rep
movsl
pop %%edi
pop %%esi"
:
: "c" (memdiv4), "a" (src), "b" (dst));
 
}
/shark/trunk/drivers/svga/vga.h
11,7 → 11,7
 
#include <sys/types.h>
#include <sys/time.h>
#include <drivers/grxsvga/glib.h>
#include "./grx/glib.h"
#include <kernel/log.h>
 
#ifdef __cplusplus
427,7 → 427,6
extern void vga_setcursorimage(int, int, int, int, unsigned char *);
 
inline void copy_videomem_32to16(void *src, void *dst, unsigned long int memdiv2);
inline void copy_videomem_16to16(void *src, void *dst, unsigned long int memdiv4);
 
extern int vga_setcrtcregs(unsigned char *);
extern int vga_getcrtcregs(unsigned char *);
/shark/trunk/drivers/svga/makefile
14,7 → 14,7
MODULES = timing.o vgaregs.o interface.o accel.o modetab.o interrupt.o\
vgapci.o vga_helper.o nv3.o vga.o vgadrv.o vgaio.o vgapal.o\
vgaclear.o vgadraw.o vgaaccel.o vgaline.o icd2061a.o\
./grx/glib.o vgammvgaio.o vgarelvgaio.o savage.o r128.o
./grx/glib.o vgammvgaio.o vgarelvgaio.o savage.o
RAMDAC = ramdac.o normal.o attdacs.o sierra.o vgamisc.o\
icw.o s3dacs.o IBMRGB52x.o ics_gendac.o