summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winischhofer <thomas@winischhofer.net>2004-08-04 15:46:34 +0000
committerThomas Winischhofer <thomas@winischhofer.net>2004-08-04 15:46:34 +0000
commitc22f737fd67ca47b8a51cbe6bfa74ffad1d7ebd8 (patch)
tree75651dd747fb4cd33bb57846d5b5f9dbef5147dc
parentc7bcee0dc08d56af4b9e42a184686ef1710bfc10 (diff)
SiS driver:
- Adapt to new RENDER hooks (will be used if X.org version is > 6.7.0.0) - Use drmCommandWrite instead of compat-layer if drmWriteCommend exists - Unify driver after changes for dlloader
-rw-r--r--src/sis.h12
-rw-r--r--src/sis300_accel.c21
-rw-r--r--src/sis310_accel.c107
-rw-r--r--src/sis_accel.c19
-rw-r--r--src/sis_dac.c53
-rw-r--r--src/sis_dri.c25
-rw-r--r--src/sis_driver.c11
7 files changed, 177 insertions, 71 deletions
diff --git a/src/sis.h b/src/sis.h
index 1fa3e7e..87a6b6c 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -39,8 +39,8 @@
#define UNLOCK_ALWAYS
#define SISDRIVERVERSIONYEAR 4
-#define SISDRIVERVERSIONMONTH 7
-#define SISDRIVERVERSIONDAY 27
+#define SISDRIVERVERSIONMONTH 8
+#define SISDRIVERVERSIONDAY 4
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | \
@@ -77,8 +77,12 @@
#define SISMYSERVERNAME "XFree86"
#endif
-#ifdef XF86DRI
+#undef SISHAVEDRMWRITE
#undef SISNEWDRI
+#ifdef XF86DRI
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,3,0)
+#define SISHAVEDRMWRITE
+#endif
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,14,0)
#define SISNEWDRI
#endif
@@ -89,7 +93,7 @@
#include "dri.h"
#include "GL/glxint.h"
#include "sis_dri.h"
-#endif
+#endif /* XF86DRI */
#if 1
#define SISDUALHEAD /* Include Dual Head code */
diff --git a/src/sis300_accel.c b/src/sis300_accel.c
index 8280350..79f1f56 100644
--- a/src/sis300_accel.c
+++ b/src/sis300_accel.c
@@ -1,5 +1,5 @@
/* $XFree86$ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.4 2004/07/26 22:40:56 twini Exp $ */
+/* $XdotOrg$ */
/*
* 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
*
@@ -139,6 +139,9 @@ static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
static void SiSRestoreAccelState(ScrnInfoPtr pScrn);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
static void
SiSInitializeAccelerator(ScrnInfoPtr pScrn)
{
@@ -389,7 +392,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(XAAGetCopyROP(rop))
+ SiSSetupROP(SiSGetCopyROP(rop))
}
if(xdir > 0) {
SiSSetupCMDFlag(X_INC)
@@ -459,7 +462,7 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
/* SiSSetupCMDFlag(PATFG) - is zero */
}
@@ -617,7 +620,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE)
}
@@ -707,7 +710,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupStyleLow(*pattern)
SiSSetupStyleHigh(*(pattern+4))
SiSSetupStylePeriod(length-1);
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupPATFG(fg)
SiSSetupCMDFlag(LINE | LINE_STYLE)
if(bg != -1) {
@@ -768,7 +771,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupMONOPAT(patx,paty)
SiSSetupPATFG(fg)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATMONO)
if(bg != -1) {
SiSSetupPATBG(bg)
@@ -902,7 +905,7 @@ SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupSRCXY(0,0)
SiSSetupSRCFG(fg)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT)
@@ -954,7 +957,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(XAAGetCopyROP(rop))
+ SiSSetupROP(SiSGetCopyROP(rop))
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -1120,7 +1123,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAAGetCopyROP(rop));
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
diff --git a/src/sis310_accel.c b/src/sis310_accel.c
index 1474a32..5b95203 100644
--- a/src/sis310_accel.c
+++ b/src/sis310_accel.c
@@ -1,5 +1,5 @@
/* $XFree86$ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.4 2004/07/26 22:40:56 twini Exp $ */
+/* $XdotOrg$ */
/*
* 2D Acceleration for SiS 315 and 330 series
*
@@ -84,10 +84,17 @@
#define INCL_RENDER /* Use/Don't use RENDER extension acceleration */
#ifdef INCL_RENDER
-#ifdef RENDER
-#include "mipict.h"
-#include "dixstruct.h"
-#endif
+# ifdef RENDER
+# include "mipict.h"
+# include "dixstruct.h"
+# undef SISNEWRENDER
+# ifdef XORG_VERSION_CURRENT
+# include "xorgVersion.h"
+# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+# define SISNEWRENDER
+# endif
+# endif
+# endif
#endif
/* Accelerator functions */
@@ -169,27 +176,40 @@ static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#endif
#ifdef INCL_RENDER
#ifdef RENDER
-extern Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
+static Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
- CARD16 blue, CARD16 alpha,
- int alphaType, CARD8 *alphaPtr,
+ CARD16 blue, CARD16 alpha,
+#ifdef SISNEWRENDER
+ CARD32 alphaType, CARD32 dstType,
+#else
+ int alphaType,
+#endif
+ CARD8 *alphaPtr,
int alphaPitch, int width,
int height, int flags);
-extern Bool SiSSetupForCPUToScreenTexture( ScrnInfoPtr pScrn,
- int op, int texType, CARD8 *texPtr,
+static Bool SiSSetupForCPUToScreenTexture( ScrnInfoPtr pScrn,
+ int op,
+#ifdef SISNEWRENDER
+ CARD32 texType, CARD32 dstType,
+#else
+ int texType,
+#endif
+ CARD8 *texPtr,
int texPitch, int width,
int height, int flags);
-extern void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
+static void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int dstx, int dsty,
int srcx, int srcy,
int width, int height);
-extern CARD32 SiSAlphaTextureFormats[2];
-extern CARD32 SiSTextureFormats[2];
-CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 };
-CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+static CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 };
+static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+#ifdef SISNEWRENDER
+static CARD32 SiSDstTextureFormats16[2] = { PICT_r5g6b5 , 0 };
+static CARD32 SiSDstTextureFormats32[2] = { PICT_x8r8g8b8, 0 };
+#endif
#endif
#endif
@@ -197,6 +217,9 @@ CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
static void SiSRestoreAccelState(ScrnInfoPtr pScrn);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
CARD32 dummybuf;
static void
@@ -416,15 +439,28 @@ SiS315AccelInit(ScreenPtr pScreen)
if(pSiS->RenderAccelArray) {
pSiS->AccelLinearScratch = NULL;
+#ifdef SISNEWRENDER
+ infoPtr->SetupForCPUToScreenAlphaTexture2 = SiSSetupForCPUToScreenAlphaTexture;
+ infoPtr->CPUToScreenAlphaTextureDstFormats = (pScrn->bitsPerPixel == 16) ?
+ SiSDstTextureFormats16 : SiSDstTextureFormats32;
+#else
infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture;
+#endif
infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture;
infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats;
infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE;
+#ifdef SISNEWRENDER
+ infoPtr->SetupForCPUToScreenTexture2 = SiSSetupForCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureDstFormats = (pScrn->bitsPerPixel == 16) ?
+ SiSDstTextureFormats16 : SiSDstTextureFormats32;
+#else
infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
- infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
+#endif
+ infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
}
}
@@ -554,7 +590,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(XAAGetCopyROP(rop))
+ SiSSetupROP(SiSGetCopyROP(rop))
/* Set command - not needed, both 0 */
/* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
}
@@ -677,14 +713,14 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color,
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 1);
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG)
SiSSyncWP
#else
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth)
#endif
}
@@ -822,7 +858,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSCheckQueue(16 * 3);
SiSSetupLineCountPeriod(1, 1)
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE)
SiSSyncWP
#else
@@ -830,7 +866,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth)
#endif
}
@@ -942,7 +978,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(fg)
#endif
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(LINE | LINE_STYLE)
@@ -1022,7 +1058,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupMONOPAT(patx,paty)
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
#ifdef SISVRAMQ
SiSSetupCMDFlag(PATMONO)
@@ -1181,7 +1217,7 @@ SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
patadr += 16; /* = 64 due to (CARD32 *) */
}
- SiSSetupROP(XAAGetPatternROP(rop))
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATPATREG)
@@ -1240,7 +1276,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupROP(XAAGetCopyROP(rop));
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO);
@@ -1251,7 +1287,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
SiSSyncWP
#else
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAAGetCopyROP(rop));
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1352,7 +1388,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#endif
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAAGetCopyROP(rop));
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
#ifndef SISVRAMQ
@@ -1480,7 +1516,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor)
#endif
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(XAAGetCopyROP(rop))
+ SiSSetupROP(SiSGetCopyROP(rop))
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -1694,7 +1730,12 @@ Bool
SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
CARD16 blue, CARD16 alpha,
- int alphaType, CARD8 *alphaPtr,
+#ifdef SISNEWRENDER
+ CARD32 alphaType, CARD32 dstType,
+#else
+ int alphaType,
+#endif
+ CARD8 *alphaPtr,
int alphaPitch, int width,
int height, int flags)
{
@@ -1788,7 +1829,13 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
Bool
SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
- int op, int texType, CARD8 *texPtr,
+ int op,
+#ifdef SISNEWRENDER
+ CARD32 texType, CARD32 dstType,
+#else
+ int texType,
+#endif
+ CARD8 *texPtr,
int texPitch, int width,
int height, int flags)
{
diff --git a/src/sis_accel.c b/src/sis_accel.c
index 094c081..e7f00c5 100644
--- a/src/sis_accel.c
+++ b/src/sis_accel.c
@@ -1,5 +1,5 @@
/* $XFree86$ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.3 2004/06/17 13:20:13 twini Exp $ */
+/* $XdotOrg$ */
/*
* 2D acceleration for SiS5597/5598 and 6326
*
@@ -94,6 +94,9 @@ static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
Bool
SiSAccelInit(ScreenPtr pScreen)
{
@@ -272,7 +275,7 @@ SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
sisBLTSync;
sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset);
- sisSETROP(XAAGetCopyROP(rop));
+ sisSETROP(SiSGetCopyROP(rop));
pSiS->Xdirection = xdir;
pSiS->Ydirection = ydir;
}
@@ -329,8 +332,8 @@ SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop,
SISPtr pSiS = SISPTR(pScrn);
sisBLTSync;
- sisSETBGROPCOL(XAAGetCopyROP(rop), color);
- sisSETFGROPCOL(XAAGetCopyROP(rop), color);
+ sisSETBGROPCOL(SiSGetCopyROP(rop), color);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), color);
sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset);
}
@@ -436,8 +439,8 @@ static void SiSSetupForSolidLine(ScrnInfoPtr pScrn,
SISPtr pSiS = SISPTR(pScrn);
sisBLTSync;
- sisSETBGROPCOL(XAAGetCopyROP(rop), 0);
- sisSETFGROPCOL(XAAGetCopyROP(rop), color);
+ sisSETBGROPCOL(SiSGetCopyROP(rop), 0);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), color);
}
static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
@@ -539,11 +542,11 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
sisSETROPBG(0xAA); /* dst = dst (=noop) */
pSiS->CommandReg |= sisSRCFG;
} else {
- sisSETBGROPCOL(XAAGetPatternROP(rop), bg);
+ sisSETBGROPCOL(SiSGetPatternROP(rop), bg);
pSiS->CommandReg |= sisSRCFG | sisPATBG;
}
- sisSETFGROPCOL(XAAGetCopyROP(rop), fg);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), fg);
sisSETDSTPITCH(pSiS->scrnOffset);
}
diff --git a/src/sis_dac.c b/src/sis_dac.c
index 6149046..d027e8c 100644
--- a/src/sis_dac.c
+++ b/src/sis_dac.c
@@ -93,6 +93,9 @@ static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indicies, LOCO *colors, VisualPtr pVisual);
static void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr);
+unsigned char SiSGetCopyROP(int rop);
+unsigned char SiSGetPatternROP(int rop);
+
static const unsigned short ch700xidx[] = {
0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,
0x1b,0x1c,0x1d,0x1e,0x1f, /* 0x0e, - Don't save the power register */
@@ -2000,3 +2003,53 @@ SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index)
inSISIDXREG(SISCR, 0xE3, data);
return(data);
}
+
+unsigned char SiSGetCopyROP(int rop)
+{
+ const unsigned char sisALUConv[] =
+ {
+ 0x00, /* dest = 0; 0, GXclear, 0 */
+ 0x88, /* dest &= src; DSa, GXand, 0x1 */
+ 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */
+ 0xCC, /* dest = src; S, GXcopy, 0x3 */
+ 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */
+ 0xAA, /* dest = dest; D, GXnoop, 0x5 */
+ 0x66, /* dest = ^src; DSx, GXxor, 0x6 */
+ 0xEE, /* dest |= src; DSo, GXor, 0x7 */
+ 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */
+ 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */
+ 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
+ 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */
+ 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */
+ 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */
+ 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */
+ 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
+ };
+
+ return(sisALUConv[rop]);
+}
+
+unsigned char SiSGetPatternROP(int rop)
+{
+ const unsigned char sisPatALUConv[] =
+ {
+ 0x00, /* dest = 0; 0, GXclear, 0 */
+ 0xA0, /* dest &= src; DPa, GXand, 0x1 */
+ 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */
+ 0xF0, /* dest = src; P, GXcopy, 0x3 */
+ 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */
+ 0xAA, /* dest = dest; D, GXnoop, 0x5 */
+ 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */
+ 0xFA, /* dest |= src; DPo, GXor, 0x7 */
+ 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */
+ 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */
+ 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */
+ 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */
+ 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */
+ 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */
+ 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */
+ 0xFF, /* dest = 0xFF; 1, GXset, 0xF */
+ };
+
+ return(sisPatALUConv[rop]);
+}
diff --git a/src/sis_dri.c b/src/sis_dri.c
index 91eedd3..bb28f3b 100644
--- a/src/sis_dri.c
+++ b/src/sis_dri.c
@@ -49,27 +49,22 @@
#include "sis.h"
-#undef SISHAVECOMPATLAYER
+#ifndef SISHAVEDRMWRITE
+# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+extern Bool drmSiSAgpInit(int driSubFD, int offset, int size);
+# else
+# include "xf86drmCompat.h"
+# endif
+#endif
+
#ifdef XORG_VERSION_CURRENT
-#define SISHAVECOMPATLAYER
#define SISHAVECREATEBUSID
#else
-# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,4,99,7,0)
-# define SISHAVECOMPATLAYER
-# endif
# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,4,99,99,0)
# undef SISHAVECREATEBUSID /* Waiting, waiting, waiting... */
# endif
#endif
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
-extern Bool drmSiSAgpInit(int driSubFD, int offset, int size);
-#else
-# ifdef SISHAVECOMPATLAYER
-# include "xf86drmCompat.h"
-# endif
-#endif
-
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
#include "sis_common.h"
#endif
@@ -542,7 +537,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->AGPVtxBufOffset = pSIS->agpVtxBufAddr - pSIS->agpAddr;
pSISDRI->AGPVtxBufSize = pSIS->agpVtxBufSize;
-#ifdef SISHAVECOMPATLAYER
+#ifndef SISHAVEDRMWRITE
drmSiSAgpInit(pSIS->drmSubFD, AGP_VTXBUF_SIZE,(pSIS->agpSize - AGP_VTXBUF_SIZE));
#else
{
@@ -564,7 +559,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
-#ifdef SISHAVECOMPATLAYER
+#ifndef SISHAVEDRMWRITE
drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(pSIS->agpSize - AGP_CMDBUF_SIZE));
#else
{
diff --git a/src/sis_driver.c b/src/sis_driver.c
index bb39f9d..65d9908 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -1,5 +1,5 @@
/* $XFree86$ */
-/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.10 2004/07/26 22:40:56 twini Exp $ */
+/* $XdotOrg$ */
/*
* SiS driver main code
*
@@ -178,8 +178,6 @@ static PciChipsets SISPciChipsets[] = {
};
static const char *xaaSymbols[] = {
- "XAAGetCopyROP",
- "XAAGetPatternROP",
"XAACreateInfoRec",
"XAADestroyInfoRec",
"XAAHelpPatternROP",
@@ -268,12 +266,15 @@ static const char *drmSymbols[] = {
"drmAgpRelease",
"drmCtlInstHandler",
"drmGetInterruptFromBusID",
+#ifndef SISHAVEDRMWRITE
"drmSiSAgpInit",
+#else
+ "drmCommandWrite",
+#endif
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
"drmGetVersion",
"drmFreeVersion",
- "drmCommandWrite",
-#endif
+#endif
NULL
};