summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2004-07-30 20:30:53 +0000
committerAdam Jackson <ajax@nwnk.net>2004-07-30 20:30:53 +0000
commita7d27d00febe51416a3f2d719982f6586ebe1bff (patch)
treeb25a71f743676c508ceababd89a1f2f62bd4879f
parent1b0fc4d16af312d67728dace2d30da4cf819c465 (diff)
framebuffer formats except cfb and the overlay modes should work, and r128 and radeon need to be loaded from the ati driver (both issues to be fixed soon). Tested on i740, s3virge, mach64, tdfx, vesa, and vga drivers. elfloader users shouldn't be affected.
-rw-r--r--src/nsc_gx1_accel.c52
-rw-r--r--src/nsc_gx2_accel.c49
2 files changed, 56 insertions, 45 deletions
diff --git a/src/nsc_gx1_accel.c b/src/nsc_gx1_accel.c
index 7359c0d..bb1d933 100644
--- a/src/nsc_gx1_accel.c
+++ b/src/nsc_gx1_accel.c
@@ -1,4 +1,5 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c,v 1.5 2003/02/11 13:36:41 alanh Exp $ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c,v 1.2 2004/04/23 19:40:15 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx1_accel.c,v 1.7 2003/12/07 22:40:38 alanh Exp $ */
/*
* $Workfile: nsc_gx1_accel.c $
* $Revision$
@@ -171,7 +172,6 @@ static int Geodesrcx;
static int Geodesrcy;
static int Geodewidth;
static int Geodeheight;
-static int Geodebpp;
static int GeodeCounter;
#if !defined(STB_X)
@@ -181,7 +181,9 @@ static unsigned short Geode_vector_mode = 0;
static unsigned short Geode_buffer_width = 0;
#endif
static unsigned int gu1_bpp = 0;
+#if SCR2SCREXP
static unsigned int gu1_xshift = 1;
+#endif
static unsigned int gu1_yshift = 1;
static unsigned short GeodebufferWidthPixels;
static unsigned int ImgBufOffset;
@@ -189,9 +191,11 @@ static unsigned short Geodebb0Base;
static unsigned short Geodebb1Base;
static XAAInfoRecPtr localRecPtr;
+#if SCR2SCREXP
#define CALC_FBOFFSET(_SrcX, _SrcY) \
(((unsigned int) (_SrcY) << gu1_yshift) |\
(((unsigned int) (_SrcX)) << gu1_xshift))
+#endif
#define GFX_WAIT_BUSY while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_BUSY) { ; }
#define GFX_WAIT_PENDING while(READ_REG16(GP_BLIT_STATUS) & BS_BLIT_PENDING) { ; }
@@ -270,9 +274,11 @@ void OPTGX1SubsequentBresenhamLine(ScrnInfoPtr pScreenInfo, int x1, int y1,
void OPTGX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
int x0, int y0, int x1, int y1,
int flags);
+#if 0 /* disabled due to bugs */
void OPTGX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo, int x, int y,
int len, int dir);
+#endif
void OPTGX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
int rop, unsigned int planemask,
int transparency_color, int bpp,
@@ -333,11 +339,11 @@ GX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned long)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP_PM(rop)));
}
}
@@ -408,11 +414,11 @@ GX1SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP_PM(rop)));
}
}
@@ -473,7 +479,7 @@ GX1Subsequent8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
* fg :Specifies the foreground color
* bg :Specifies the background color
* planemask :Specifies the value of masking from rop data
-
+ *
* Returns :none.
*
* Comments :none.
@@ -497,11 +503,11 @@ GX1SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP_PM(rop)));
}
}
@@ -572,7 +578,7 @@ GX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
{
GFX(set_solid_pattern(planemask));
/* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAACopyROP[rop]));
+ GFX(set_raster_operation(XAAGetCopyROP(rop)));
/* SAVE TRANSPARENCY FLAG */
GeodeTransparent = (transparency_color == -1) ? 0 : 1;
GeodeTransColor = transparency_color;
@@ -666,11 +672,10 @@ GX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
{
GFX(set_solid_pattern((unsigned int)planemask));
/* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAACopyROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop)));
/* SAVE TRANSPARENCY FLAG */
GeodeTransparent = (transparency_color == -1) ? 0 : 1;
GeodeTransColor = transparency_color;
- Geodebpp = bpp;
}
/*----------------------------------------------------------------------------
@@ -812,7 +817,7 @@ GX1SetupForSolidLine(ScrnInfoPtr pScreenInfo,
GFX(set_solid_pattern((unsigned int)color));
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
}
/*---------------------------------------------------------------------------
@@ -966,12 +971,12 @@ GX1SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
if (planemask == (unsigned int)-1) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned long)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP_PM(rop)));
}
}
@@ -985,7 +990,7 @@ GX1SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
GFX(set_mono_source(bg, fg, (bg == -1)));
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F]));
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
}
@@ -1044,14 +1049,14 @@ OPTGX1SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
planemask |= (planemask << 8);
}
- rop16 = XAAPatternROP[rop];
+ rop16 = XAAGetPatternROP(rop);
/* POLL UNTIL ABLE TO WRITE THE SOURCE COLOR */
GFX_WAIT_PENDING;
WRITE_REG32(GP_SRC_COLOR_0, (planemask << 16) | planemask);
} else {
- rop16 = XAAPatternROP_PM[rop];
+ rop16 = XAAGetPatternROP_PM(rop);
}
Geode_blt_mode = 0;
@@ -1161,7 +1166,7 @@ OPTGX1SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
int transparency_color)
{
int GFXusesDstData;
- unsigned short rop16 = XAACopyROP[rop];
+ unsigned short rop16 = XAAGetCopyROP(rop);
/* FORMAT 8 BPP COLOR */
/* GX requires 8BPP color data be duplicated into bits [15:8]. */
@@ -1369,7 +1374,6 @@ OPTGX1SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
int rop, unsigned int planemask,
int transparency_color, int bpp, int depth)
{
- Geodebpp = bpp;
OPTGX1SetupForScreenToScreenCopy(pScreenInfo,
0, 0, rop, planemask, transparency_color);
}
@@ -1484,7 +1488,7 @@ OPTGX1SetupForSolidLine(ScrnInfoPtr pScreenInfo,
color |= (color << 8);
}
- GeodeROP = XAAPatternROP[rop];
+ GeodeROP = XAAGetPatternROP(rop);
/* POLL UNTIL ABLE TO WRITE THE PATTERN COLOR */
GFX_WAIT_PENDING;
@@ -1606,6 +1610,7 @@ OPTGX1SubsequentSolidTwoPointLine(ScrnInfoPtr pScreenInfo,
WRITE_REG16(GP_VECTOR_MODE, (Geode_vector_mode | vec_flags));
}
+#if 0 /* disabled due to bugs - can't fallback to fillrectsolid */
/*---------------------------------------------------------------------------
* OPTGX1SubsequentHorVertLine
*
@@ -1633,6 +1638,7 @@ OPTGX1SubsequentHorVertLine(ScrnInfoPtr pScreenInfo,
len));
}
#endif
+#endif
/*----------------------------------------------------------------------------
* GX1AccelInit.
@@ -1667,7 +1673,9 @@ GX1AccelInit(ScreenPtr pScreen)
break;
}
+#if SCR2SCREXP
gu1_xshift = pScreenInfo->bitsPerPixel >> 4;
+#endif
switch (pGeode->Pitch) {
case 1024:
@@ -1735,8 +1743,10 @@ GX1AccelInit(ScreenPtr pScreen)
localRecPtr->SetupForSolidLine = OPTACCEL(GX1SetupForSolidLine);
localRecPtr->SubsequentSolidBresenhamLine =
OPTACCEL(GX1SubsequentBresenhamLine);
+#if !defined(OPT_ACCEL)
localRecPtr->SubsequentSolidHorVertLine =
OPTACCEL(GX1SubsequentHorVertLine);
+#endif
localRecPtr->SubsequentSolidTwoPointLine =
OPTACCEL(GX1SubsequentSolidTwoPointLine);
localRecPtr->SolidBresenhamLineErrorTermBits = 15;
diff --git a/src/nsc_gx2_accel.c b/src/nsc_gx2_accel.c
index d8730e4..a75303e 100644
--- a/src/nsc_gx2_accel.c
+++ b/src/nsc_gx2_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c,v 1.4 2003/02/21 16:51:09 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/nsc_gx2_accel.c,v 1.4tsi Exp $ */
/*
* $Workfile: nsc_gx2_accel.c $
* $Revision$
@@ -168,7 +168,6 @@ static int Geodesrcx;
static int Geodesrcy;
static int Geodewidth;
static int Geodeheight;
-static int Geodebpp;
static int GeodeCounter;
#if !defined(STB_X)
@@ -180,7 +179,9 @@ static unsigned int gu2_xshift = 1;
static unsigned int gu2_yshift = 1;
static unsigned int gu2_bpp = 1;
static unsigned int SetCPUToScreen = 0;
+#if IMGWRITE_SUPPORT
static unsigned int SetImageWriteRect = 0;
+#endif
static unsigned int ImgBufOffset;
#define GU2_WAIT_PENDING while(READ_GP32(MGP_BLT_STATUS) & MGP_BS_BLT_PENDING)
@@ -407,11 +408,11 @@ GX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
}
}
@@ -475,11 +476,11 @@ GX2SetupFor8x8PatternColorExpand(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
}
}
@@ -559,11 +560,11 @@ GX2SetupFor8x8PatternMonoExpand(ScrnInfoPtr pScreenInfo,
/* CHECK IF PLANEMASK IS NOT USED (ALL PLANES ENABLED) */
if (planemask == 0xFFFFFFFF) {
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
} else {
/* SELECT ROP THAT USES SOURCE DATA FOR PLANEMASK */
GFX(set_solid_source((unsigned int)planemask));
- GFX(set_raster_operation(XAAPatternROP_PM[rop]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop)));
}
}
@@ -629,7 +630,7 @@ GX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
{
GFX(set_solid_pattern(planemask));
/* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAACopyROP[rop]));
+ GFX(set_raster_operation(XAAGetCopyROP(rop)));
/* SAVE TRANSPARENCY FLAG */
GeodeTransparent = (transparency_color == -1) ? 0 : 1;
GeodeTransColor = transparency_color;
@@ -689,11 +690,10 @@ GX2SetupForImageWrite(ScrnInfoPtr pScreenInfo,
{
GFX(set_solid_pattern((unsigned int)planemask));
/* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAACopyROP[rop]));
+ GFX(set_raster_operation(XAAGetCopyROP(rop)));
/* SAVE TRANSPARENCY FLAG */
GeodeTransparent = (transparency_color == -1) ? 0 : 1;
GeodeTransColor = transparency_color;
- Geodebpp = bpp;
}
void
@@ -704,7 +704,9 @@ GX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
Geodedsty = y;
Geodewidth = w;
Geodeheight = h;
+#if IMGWRITE_SUPPORT
SetImageWriteRect = 1;
+#endif
}
@@ -736,11 +738,10 @@ GX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
{
GFX(set_solid_pattern((unsigned int)planemask));
/* SET RASTER OPERATION FOR USING PATTERN AS PLANE MASK */
- GFX(set_raster_operation(XAACopyROP[rop & 0x0F]));
+ GFX(set_raster_operation(XAAGetCopyROP(rop & 0x0F)));
/* SAVE TRANSPARENCY FLAG */
GeodeTransparent = (transparency_color == -1) ? 0 : 1;
GeodeTransColor = transparency_color;
- Geodebpp = bpp;
}
/*----------------------------------------------------------------------------
@@ -882,7 +883,7 @@ GX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
GFX(set_mono_source(bg, fg, (bg == -1)));
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F]));
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
}
@@ -926,7 +927,7 @@ GX2SetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
GFX(set_mono_source(bg, fg, (bg == -1)));
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAACopyROP_PM[rop & 0x0F]));
+ GFX(set_raster_operation(XAAGetCopyROP_PM(rop & 0x0F)));
DEBUGMSG(0, (0, X_NONE, "%x %x %x %x\n", fg, bg, rop, planemask));
}
@@ -981,7 +982,7 @@ GX2SetupForSolidLine(ScrnInfoPtr pScreenInfo,
GFX(set_solid_pattern((unsigned int)color));
/* USE NORMAL PATTERN ROPs IF ALL PLANES ARE ENABLED */
- GFX(set_raster_operation(XAAPatternROP[rop & 0x0F]));
+ GFX(set_raster_operation(XAAGetPatternROP(rop & 0x0F)));
}
/*---------------------------------------------------------------------------
@@ -1317,7 +1318,7 @@ OPTGX2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScreenInfo,
{
int trans = (bg == -1);
- GeodeROP = XAACopyROP_PM[rop];
+ GeodeROP = XAAGetCopyROP_PM(rop);
if ((GeodeROP & 0x55) ^ ((GeodeROP >> 1) & 0x55)) {
Geode_blt_mode = MGP_BM_DST_REQ;
@@ -1401,10 +1402,10 @@ OPTGX2SetupForFillRectSolid(ScrnInfoPtr pScreenInfo,
WRITE_GP32(MGP_STRIDE, pGeode->Pitch);
if (planemask == 0xFFFFFFFF) {
- GeodeROP = XAAPatternROP[rop];
+ GeodeROP = XAAGetPatternROP(rop);
} else {
WRITE_GP32(MGP_SRC_COLOR_FG, (unsigned long)planemask);
- GeodeROP = XAAPatternROP_PM[rop];
+ GeodeROP = XAAGetPatternROP(rop);
}
WRITE_GP32(MGP_RASTER_MODE, gu2_bpp | GeodeROP);
@@ -1481,7 +1482,7 @@ OPTGX2SetupForScreenToScreenCopy(ScrnInfoPtr pScreenInfo,
{
GeodePtr pGeode = GEODEPTR(pScreenInfo);
- GeodeROP = XAACopyROP_PM[rop];
+ GeodeROP = XAAGetCopyROP_PM(rop);
Geode_blt_mode = MGP_BM_SRC_FB;
@@ -1611,8 +1612,9 @@ OPTGX2SubsequentImageWriteRect(ScrnInfoPtr pScreenInfo,
Geodedsty = y;
Geodewidth = w;
Geodeheight = h;
-
+#if IMGWRITE_SUPPORT
SetImageWriteRect = 1;
+#endif
}
/*----------------------------------------------------------------------------
@@ -1638,7 +1640,6 @@ OPTGX2SetupForScanlineImageWrite(ScrnInfoPtr pScreenInfo,
int rop, unsigned int planemask,
int transparency_color, int bpp, int depth)
{
- Geodebpp = bpp;
OPTGX2SetupForScreenToScreenCopy(pScreenInfo,
0, 0, rop, planemask, transparency_color);
}
@@ -1933,9 +1934,9 @@ OPTGX2SetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
/* SET PATTERN FLAGS */
if (planemask == 0xFFFFFFFF) {
- GeodeROP = XAAPatternROP[rop & 0x0F];
+ GeodeROP = XAAGetPatternROP(rop & 0x0F);
} else {
- GeodeROP = XAAPatternROP_PM[rop & 0x0F];
+ GeodeROP = XAAGetPatternROP_PM(rop & 0x0F);
}
if (bg == -1)
GeodeROP |= MGP_RM_PAT_MONO | MGP_RM_PAT_TRANS;