summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c')
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c205
1 files changed, 110 insertions, 95 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c b/xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c
index 57016e5f6..61ed10738 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.9 2000/02/25 21:03:06 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.11 2000/06/13 02:28:33 dawes Exp $ */
/*
* includes
*/
@@ -110,22 +110,23 @@ int Cursor_size=0;
*/
/*
- * int v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
+ * int verite_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
*
* Used to initialize the ramdac. Palette-bypass is dis-/enabled with respect
* to the color depth, the cursor is disabled by default. If needed (i.e. if
- * the corresponding field in the v_board_t struct is set), the clock doubling
+ * the corresponding field in the verite_board_t struct is set), the clock doubling
* is turned on.
*/
int
-v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
+verite_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
{
renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
vu16 iob=pRendition->board.io_base+RAMDACBASEADDR;
+ vu8 cmd0,cmd1,cmd2;
vu8 cmd3_data=0;
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_initdac called\n");
+ ErrorF ("Rendition: Debug verite_initdac called\n");
#endif
if (doubleclock)
@@ -139,46 +140,60 @@ v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
return -1;
case 8:
- v_out8(iob+BT485_COMMAND_REG_0, BT485_CR0_EXTENDED_REG_ACCESS |
- BT485_CR0_8_BIT_DAC);
- v_out8(iob+BT485_COMMAND_REG_1, BT485_CR1_8BPP |
- BT485_CR1_PIXEL_PORT_AB);
- v_out8(iob+BT485_COMMAND_REG_2, BT485_PIXEL_INPUT_GATE |
- BT485_DISABLE_CURSOR);
- break;
+ cmd0 = BT485_CR0_EXTENDED_REG_ACCESS |
+ BT485_CR0_8_BIT_DAC;
+
+ cmd1 = BT485_CR1_8BPP |
+ BT485_CR1_PIXEL_PORT_AB;
+
+ cmd2 = BT485_PIXEL_INPUT_GATE |
+ BT485_DISABLE_CURSOR;
- case 15:
- v_out8(iob+BT485_COMMAND_REG_0, BT485_CR0_EXTENDED_REG_ACCESS |
- BT485_CR0_8_BIT_DAC);
- v_out8(iob+BT485_COMMAND_REG_1, BT485_CR1_16BPP |
- BT485_CR1_BYPASS_CLUT |
- BT485_CR1_555_16BPP |
- BT485_CR1_2_TO_1_16BPP |
- BT485_CR1_PIXEL_PORT_AB);
- v_out8(iob+BT485_COMMAND_REG_2, BT485_PIXEL_INPUT_GATE |
- BT485_DISABLE_CURSOR);
+ verite_out8(iob+BT485_COMMAND_REG_0, cmd0);
+ verite_out8(iob+BT485_COMMAND_REG_1, cmd1);
+ verite_out8(iob+BT485_COMMAND_REG_2, cmd2);
break;
case 16:
- v_out8(iob+BT485_COMMAND_REG_0, BT485_CR0_EXTENDED_REG_ACCESS |
- BT485_CR0_8_BIT_DAC);
- v_out8(iob+BT485_COMMAND_REG_1, BT485_CR1_16BPP |
- BT485_CR1_BYPASS_CLUT |
- BT485_CR1_565_16BPP |
- BT485_CR1_2_TO_1_16BPP |
- BT485_CR1_PIXEL_PORT_AB);
- v_out8(iob+BT485_COMMAND_REG_2, BT485_PIXEL_INPUT_GATE |
- BT485_DISABLE_CURSOR);
+ cmd0 = BT485_CR0_EXTENDED_REG_ACCESS |
+ BT485_CR0_8_BIT_DAC;
+
+ cmd1 = BT485_CR1_16BPP |
+ BT485_CR1_2_TO_1_16BPP |
+ BT485_CR1_PIXEL_PORT_AB;
+
+ cmd2 = BT485_PIXEL_INPUT_GATE |
+ BT485_DISABLE_CURSOR;
+
+ if (pScreenInfo->defaultVisual == TrueColor)
+ cmd1 |= BT485_CR1_BYPASS_CLUT;
+
+ if (pScreenInfo->weight.green == 5)
+ cmd1 |= BT485_CR1_555_16BPP;
+ else
+ cmd1 |= BT485_CR1_565_16BPP;
+
+ verite_out8(iob+BT485_COMMAND_REG_0,cmd0);
+ verite_out8(iob+BT485_COMMAND_REG_1,cmd1);
+ verite_out8(iob+BT485_COMMAND_REG_2,cmd2);
break;
case 32:
- v_out8(iob+BT485_COMMAND_REG_0, BT485_CR0_EXTENDED_REG_ACCESS |
- BT485_CR0_8_BIT_DAC);
- v_out8(iob+BT485_COMMAND_REG_1, BT485_CR1_24BPP |
- BT485_CR1_BYPASS_CLUT |
- BT485_CR1_PIXEL_PORT_AB);
- v_out8(iob+BT485_COMMAND_REG_2, BT485_PIXEL_INPUT_GATE |
- BT485_DISABLE_CURSOR);
+ cmd0 = BT485_CR0_EXTENDED_REG_ACCESS |
+ BT485_CR0_8_BIT_DAC;
+
+ cmd1 = BT485_CR1_24BPP |
+ BT485_CR1_PIXEL_PORT_AB;
+
+ cmd2 = BT485_PIXEL_INPUT_GATE |
+ BT485_DISABLE_CURSOR;
+
+ if (pScreenInfo->defaultVisual == TrueColor)
+ cmd1 |= BT485_CR1_BYPASS_CLUT;
+
+ verite_out8(iob+BT485_COMMAND_REG_0,cmd0);
+ verite_out8(iob+BT485_COMMAND_REG_1,cmd1);
+ verite_out8(iob+BT485_COMMAND_REG_2,cmd2);
break;
default:
@@ -188,12 +203,12 @@ v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
break;
}
- v_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
- v_out8(iob+BT485_STATUS_REG, cmd3_data);
+ verite_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
+ verite_out8(iob+BT485_STATUS_REG, cmd3_data);
/*
Bt485_write_masked(iob, BT485_COMMAND_REG_0, 0x7f, 0x00);
*/
- v_out8(iob+BT485_PIXEL_MASK, 0xff);
+ verite_out8(iob+BT485_PIXEL_MASK, 0xff);
return 0;
}
@@ -201,7 +216,7 @@ v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
/*
- * void v_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
+ * void verite_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
*
* Used to enable the hardware cursor. Size indicates, whether to use no cursor
* at all, a 32x32 or a 64x64 cursor. The type selects a two-color, three-color
@@ -209,7 +224,7 @@ v_initdac(ScrnInfoPtr pScreenInfo, vu8 bpp, vu8 doubleclock)
*
*/
void
-v_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
+verite_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
{
renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
@@ -220,7 +235,7 @@ v_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
vu16 iob=pRendition->board.io_base+RAMDACBASEADDR;
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_enablecursor called type=0x%x\n",type);
+ ErrorF ("Rendition: Debug verite_enablecursor called type=0x%x\n",type);
#endif
#if 0
@@ -239,7 +254,7 @@ v_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
Cursor_size=(size ? 64 : 32);
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_enablecursor Exit\n");
+ ErrorF ("Rendition: Debug verite_enablecursor Exit\n");
#endif
}
@@ -248,14 +263,14 @@ v_enablecursor(ScrnInfoPtr pScreenInfo, int type, int size)
/*
- * void v_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
+ * void verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
*
* Moves the cursor to the specified location. To hide the cursor, call
* this routine with x=0x0 and y=0x0.
*
*/
void
-v_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
+verite_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
{
renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
vu16 iob=pRendition->board.io_base+RAMDACBASEADDR;
@@ -263,52 +278,52 @@ v_movecursor(ScrnInfoPtr pScreenInfo, vu16 x, vu16 y, vu8 xo, vu8 yo)
x+=Cursor_size-xo;
y+=Cursor_size-yo;
- v_out8(iob+BT485_CURS_X_LOW, x&0xff);
- v_out8(iob+BT485_CURS_X_HIGH, (x>>8)&0x0f);
- v_out8(iob+BT485_CURS_Y_LOW, y&0xff);
- v_out8(iob+BT485_CURS_Y_HIGH, (y>>8)&0x0f);
+ verite_out8(iob+BT485_CURS_X_LOW, x&0xff);
+ verite_out8(iob+BT485_CURS_X_HIGH, (x>>8)&0x0f);
+ verite_out8(iob+BT485_CURS_Y_LOW, y&0xff);
+ verite_out8(iob+BT485_CURS_Y_HIGH, (y>>8)&0x0f);
}
/*
- * void v_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 bg, vu32 fg)
+ * void verite_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 bg, vu32 fg)
*
* Sets the color of the cursor -- should be revised for use with 3 colors!
*
*/
void
-v_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 fg, vu32 bg)
+verite_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 fg, vu32 bg)
{
renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
vu16 iob=pRendition->board.io_base+RAMDACBASEADDR;
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_setcursorcolor called FG=0x%x BG=0x%x\n",
+ ErrorF ("Rendition: Debug verite_setcursorcolor called FG=0x%x BG=0x%x\n",
fg,bg);
#endif
- v_out8(iob+BT485_CURS_WR_ADDR, 0x00);
+ verite_out8(iob+BT485_CURS_WR_ADDR, 0x00);
/* load the cursor color 0 */
- v_out8(iob+BT485_CURS_DATA, 0x00);
- v_out8(iob+BT485_CURS_DATA, 0x00);
- v_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
/* load the cursor color 1 */
- v_out8(iob+BT485_CURS_DATA, (fg>>16)&0xff);
- v_out8(iob+BT485_CURS_DATA, (fg>>8)&0xff);
- v_out8(iob+BT485_CURS_DATA, fg&0xff);
+ verite_out8(iob+BT485_CURS_DATA, (fg>>16)&0xff);
+ verite_out8(iob+BT485_CURS_DATA, (fg>>8)&0xff);
+ verite_out8(iob+BT485_CURS_DATA, fg&0xff);
/* load the cursor color 2 */
- v_out8(iob+BT485_CURS_DATA, 0x00);
- v_out8(iob+BT485_CURS_DATA, 0x00);
- v_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
+ verite_out8(iob+BT485_CURS_DATA, 0x00);
/* load the cursor color 3 */
- v_out8(iob+BT485_CURS_DATA, (bg>>16)&0xff);
- v_out8(iob+BT485_CURS_DATA, (bg>>8)&0xff);
- v_out8(iob+BT485_CURS_DATA, bg&0xff);
+ verite_out8(iob+BT485_CURS_DATA, (bg>>16)&0xff);
+ verite_out8(iob+BT485_CURS_DATA, (bg>>8)&0xff);
+ verite_out8(iob+BT485_CURS_DATA, bg&0xff);
}
@@ -319,7 +334,7 @@ v_setcursorcolor(ScrnInfoPtr pScreenInfo, vu32 fg, vu32 bg)
*
*/
void
-v_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
+verite_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
{
int c, bytes, row;
vu8 *src = cursorimage;
@@ -329,15 +344,15 @@ v_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
vu8 memend; /* Added for byte-swap fix */
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_loadcursor called\n");
+ ErrorF ("Rendition: Debug verite_loadcursor called\n");
#endif
if (NULL == cursorimage)
return;
/* Following two lines added for the byte-swap fix */
- memend = v_in8(pRendition->board.io_base + MEMENDIAN);
- v_out8(pRendition->board.io_base + MEMENDIAN, MEMENDIAN_HW);
+ memend = verite_in8(pRendition->board.io_base + MEMENDIAN);
+ verite_out8(pRendition->board.io_base + MEMENDIAN, MEMENDIAN_HW);
size&=1;
if (size)
@@ -349,50 +364,50 @@ v_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
if (pRendition->board.chip == V1000_DEVICE) {
/* now load the cursor data into the cursor ram */
- tmp=v_in8(iob+BT485_COMMAND_REG_0)&0x7f;
- v_out8(iob+BT485_COMMAND_REG_0, tmp|0x80);
+ tmp=verite_in8(iob+BT485_COMMAND_REG_0)&0x7f;
+ verite_out8(iob+BT485_COMMAND_REG_0, tmp|0x80);
- v_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
+ verite_out8(iob+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
- tmp=v_in8(iob+BT485_STATUS_REG)&0xf8;
- v_out8(iob+BT485_STATUS_REG, tmp|(size<<2));
- v_out8(iob+BT485_WRITE_ADDR, 0x00);
+ tmp=verite_in8(iob+BT485_STATUS_REG)&0xf8;
+ verite_out8(iob+BT485_STATUS_REG, tmp|(size<<2));
+ verite_out8(iob+BT485_WRITE_ADDR, 0x00);
/* output cursor image */
src=cursorimage;
/* First plane data */
for (c=0; c<bytes; c++) {
- v_out8(iob+BT485_CURS_RAM_DATA, *src);
+ verite_out8(iob+BT485_CURS_RAM_DATA, *src);
src+=2;
}
/* Second plane data */
src=cursorimage+1;
for (c=0; c<bytes; c++) {
- v_out8(iob+BT485_CURS_RAM_DATA, *src);
+ verite_out8(iob+BT485_CURS_RAM_DATA, *src);
src+=2;
}
}
else {
/* V2x00 HW-Cursor, supports only 64x64x2 size */
- v_out32(iob+CURSORBASE, pRendition->board.hwcursor_membase);
+ verite_out32(iob+CURSORBASE, pRendition->board.hwcursor_membase);
/* First plane data */
for (row=0; row<64; row++)
for (c=0, src=cursorimage+1+16*row; c<8; c++, src+=2)
- v_write_memory8(pRendition->board.vmem_base, 16*(63-row)+c,
+ verite_write_memory8(pRendition->board.vmem_base, 16*(63-row)+c,
(c&1)?(*(src-2)):(*(src+2)));
/* Second plane data */
for (row=0; row<64; row++)
for (c=0, src=cursorimage+16*row; c<8; c++, src+=2)
- v_write_memory8(pRendition->board.vmem_base, 8+16*(63-row)+c,
+ verite_write_memory8(pRendition->board.vmem_base, 8+16*(63-row)+c,
(c&1)?(*(src-2)):(*(src+2)));
}
/* Following line added for the byte-swap fix */
- v_out8(pRendition->board.io_base + MEMENDIAN, memend);
+ verite_out8(pRendition->board.io_base + MEMENDIAN, memend);
}
@@ -400,7 +415,7 @@ v_loadcursor(ScrnInfoPtr pScreenInfo, vu8 size, vu8 *cursorimage)
/* NOTE: count is the actual number of colors decremented by 1 */
void
-v_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
+verite_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
LOCO *colors, VisualPtr pVisual)
{
renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
@@ -410,11 +425,11 @@ v_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
int c;
#ifdef DEBUG
- ErrorF ("Rendition: Debug v_setpalette called\n");
+ ErrorF ("Rendition: Debug verite_setpalette called\n");
#endif
while (1) {
- crtc_status=v_in32(iob+CRTCSTATUS);
+ crtc_status=verite_in32(iob+CRTCSTATUS);
if (crtc_status & CRTCSTATUS_VERT_SYNC)
break;
};
@@ -423,11 +438,11 @@ v_setpalette(ScrnInfoPtr pScreenInfo, int numColors, int *indices,
for (i = 0; i < numColors; i++) {
index = indices[i];
- v_out8(iob+BT485_WRITE_ADDR, index);
+ verite_out8(iob+BT485_WRITE_ADDR, index);
- v_out8(iob+BT485_RAMDAC_DATA, colors[index].red);
- v_out8(iob+BT485_RAMDAC_DATA, colors[index].green);
- v_out8(iob+BT485_RAMDAC_DATA, colors[index].blue);
+ verite_out8(iob+BT485_RAMDAC_DATA, colors[index].red);
+ verite_out8(iob+BT485_RAMDAC_DATA, colors[index].green);
+ verite_out8(iob+BT485_RAMDAC_DATA, colors[index].blue);
}
@@ -451,8 +466,8 @@ Bt485_write_masked(vu16 port, vu8 reg, vu8 mask, vu8 data)
{
vu8 tmp;
- tmp=v_in8(port+reg)&mask;
- v_out8(port+reg, tmp|data);
+ tmp=verite_in8(port+reg)&mask;
+ verite_out8(port+reg, tmp|data);
}
@@ -468,7 +483,7 @@ Bt485_write_cmd3_masked(vu16 port, vu8 mask, vu8 data)
/*
Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x80);
*/
- v_out8(port+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
+ verite_out8(port+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
Bt485_write_masked(port, BT485_STATUS_REG, mask, data);
/*
Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x00);
@@ -485,7 +500,7 @@ Bt485_write_cmd3_masked(vu16 port, vu8 mask, vu8 data)
static vu8
Bt485_read_masked(vu16 port, vu8 reg, vu8 mask)
{
- return v_in8(port+reg)&mask;
+ return verite_in8(port+reg)&mask;
}
@@ -501,7 +516,7 @@ Bt485_read_cmd3_masked(vu16 port, vu8 mask)
vu8 value;
Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x80);
- v_out8(port+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
+ verite_out8(port+BT485_WRITE_ADDR, BT485_COMMAND_REG_3);
value=Bt485_read_masked(port, BT485_STATUS_REG, mask);
Bt485_write_masked(port, BT485_COMMAND_REG_0, 0x7f, 0x00);