summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2005-09-11 21:43:53 +0000
committerAdam Jackson <ajax@nwnk.net>2005-09-11 21:43:53 +0000
commit5ebb70091380bd8392991f1a30e5a38121937ffe (patch)
tree20564f8a22c6489ee2e7e26d84173517f8bf7bde
parente16cd7d62d1664f6c709b18bb0e5209569d615bc (diff)
EXA support for i128. Solid and Copy only for now, and incompatible with
DGA. Also some drive-by static and const cleanups.
-rw-r--r--src/i128.h41
-rw-r--r--src/i128IBMDAC.c25
-rw-r--r--src/i128_driver.c78
-rw-r--r--src/i128accel.c61
-rw-r--r--src/i128dga.c24
-rw-r--r--src/i128exa.c689
-rw-r--r--src/i128init.c8
-rw-r--r--src/i128reg.h156
8 files changed, 996 insertions, 86 deletions
diff --git a/src/i128.h b/src/i128.h
index fd03ef7..24d53b8 100644
--- a/src/i128.h
+++ b/src/i128.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.6 2001/05/04 19:05:39 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.5 2001/04/01 14:00:11 tsi Exp $ */
/*
* Number Nine I128 functions
*
@@ -14,12 +14,20 @@
#include "compiler.h"
#include "xaa.h"
+#include "exa.h"
#include "xf86Cursor.h"
#include "vgaHW.h"
#include "colormapst.h"
#include "xf86DDC.h"
#include "i128reg.h"
+struct source_format {
+ int render_format;
+ int i128_format;
+ int swap_flags;
+ int ignore_alpha;
+};
+
/* Card-specific driver information */
#define I128PTR(p) ((I128Ptr)((p)->driverPrivate))
@@ -58,13 +66,28 @@ typedef struct {
DisplayModePtr mode;
/* accel specific */
+ CARD32 buf_ctrl;
CARD32 blitdir;
+ CARD32 planemask;
CARD32 cmd;
- CARD32 rop;
+ CARD32 rop; /* XXX XAA only */
CARD32 clptl;
CARD32 clpbr;
-
+ CARD32 sorg;
+ CARD32 sptch;
+ CARD32 dorg;
+ CARD32 dptch;
+ CARD32 wh;
+ CARD32 torg;
+ CARD32 tptch;
+ CARD32 tex_ctl;
+ CARD32 threedctl;
+ CARD32 acntrl;
+ struct source_format *source;
+ /* struct dest_format *dest; */
+
Bool NoAccel;
+ Bool exa;
Bool FlatPanel;
Bool DoubleScan;
Bool ShowCache;
@@ -88,7 +111,8 @@ typedef struct {
int minClock;
CloseScreenProcPtr CloseScreen;
- XAAInfoRecPtr AccelInfoRec;
+ XAAInfoRecPtr XaaInfoRec;
+ ExaDriverPtr ExaDriver;
xf86CursorInfoPtr CursorInfoRec;
I2CBusPtr I2C;
Bool DGAactive;
@@ -111,7 +135,8 @@ Bool I128SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
Bool I128HWCursorInit(ScreenPtr pScreen);
-Bool I128AccelInit(ScreenPtr pScreen);
+Bool I128XaaInit(ScreenPtr pScreen);
+Bool I128ExaInit(ScreenPtr pScreen);
void I128EngineDone(ScrnInfoPtr pScrn);
Bool I128Init(ScrnInfoPtr pScrn, DisplayModePtr mode);
@@ -135,8 +160,8 @@ Bool I128ProgramTi3025(ScrnInfoPtr pScrn, DisplayModePtr mode);
Bool I128ProgramIBMRGB(ScrnInfoPtr pScrn, DisplayModePtr mode);
Bool I128ProgramSilverHammer(ScrnInfoPtr pScrn, DisplayModePtr mode);
-void I128DumpBaseRegisters(ScrnInfoPtr pScrn);
+/* void I128DumpBaseRegisters(ScrnInfoPtr pScrn); */
void I128DumpActiveRegisters(ScrnInfoPtr pScrn);
-void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg);
-
+/* void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg); */
+
#endif
diff --git a/src/i128IBMDAC.c b/src/i128IBMDAC.c
index 13430f7..5616d71 100644
--- a/src/i128IBMDAC.c
+++ b/src/i128IBMDAC.c
@@ -39,12 +39,13 @@
#include "IBMRGB.h"
-void I128IBMShowCursor(ScrnInfoPtr pScrn);
-void I128IBMHideCursor(ScrnInfoPtr pScrn);
-void I128IBMSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
-void I128IBMSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
-void I128IBMLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
-unsigned char *I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs);
+static void I128IBMShowCursor(ScrnInfoPtr pScrn);
+static void I128IBMHideCursor(ScrnInfoPtr pScrn);
+static void I128IBMSetCursorPosition(ScrnInfoPtr pScrn, int x, int y);
+static void I128IBMSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
+static void I128IBMLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src);
+static unsigned char *I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr,
+ CursorPtr pCurs);
static Bool I128IBMUseHWCursor(ScreenPtr pScrn, CursorPtr pCurs);
@@ -96,7 +97,7 @@ I128IBMHWCursorInit(ScrnInfoPtr pScrn)
* (plane 0) maps to cursor colors 0 and 1
*/
-unsigned char *
+static unsigned char *
I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
{
register int i, j;
@@ -156,7 +157,7 @@ I128IBMRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs)
}
-void
+static void
I128IBMShowCursor(ScrnInfoPtr pScrn)
{
CARD32 tmpl, tmph;
@@ -176,7 +177,7 @@ I128IBMShowCursor(ScrnInfoPtr pScrn)
return;
}
-void
+static void
I128IBMHideCursor(ScrnInfoPtr pScrn)
{
CARD32 tmpl, tmph, tmp1;
@@ -196,7 +197,7 @@ I128IBMHideCursor(ScrnInfoPtr pScrn)
return;
}
-void
+static void
I128IBMSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
CARD32 tmpl, tmph;
@@ -228,7 +229,7 @@ I128IBMSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
return;
}
-void
+static void
I128IBMSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
CARD32 tmp;
@@ -257,7 +258,7 @@ I128IBMSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
return;
}
-void
+static void
I128IBMLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
I128Ptr pI128 = I128PTR(pScrn);
diff --git a/src/i128_driver.c b/src/i128_driver.c
index a713e81..9f4989d 100644
--- a/src/i128_driver.c
+++ b/src/i128_driver.c
@@ -86,6 +86,9 @@ static void I128LeaveVT(int scrnIndex, int flags);
static Bool I128CloseScreen(int scrnIndex, ScreenPtr pScreen);
static Bool I128SaveScreen(ScreenPtr pScreen, int mode);
+static void I128DumpBaseRegisters(ScrnInfoPtr pScrn);
+static void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg);
+
/* Optional functions */
static void I128FreeScreen(int scrnIndex, int flags);
static ModeStatus I128ValidMode(int scrnIndex, DisplayModePtr mode,
@@ -193,6 +196,14 @@ static const char *fbSymbols[] = {
NULL
};
+static const char *exaSymbols[] = {
+ "exaDriverInit",
+ "exaDriverFini",
+ "exaGetPixmapOffset",
+ "exaGetVersion",
+ NULL
+};
+
static const char *xaaSymbols[] = {
"XAACreateInfoRec",
"XAADestroyInfoRec",
@@ -278,6 +289,7 @@ i128Setup(pointer module, pointer opts, int *errmaj, int *errmin)
* might refer to.
*/
LoaderRefSymLists(fbSymbols,
+ exaSymbols,
xaaSymbols,
ramdacSymbols,
ddcSymbols,
@@ -461,7 +473,8 @@ typedef enum {
OPTION_NOACCEL,
OPTION_SHOWCACHE,
OPTION_DAC6BIT,
- OPTION_DEBUG
+ OPTION_DEBUG,
+ OPTION_ACCELMETHOD
} I128Opts;
static const OptionInfoRec I128Options[] = {
@@ -473,6 +486,7 @@ static const OptionInfoRec I128Options[] = {
{ OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DAC6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DEBUG, "Debug", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -666,7 +680,17 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
if (xf86ReturnOptValBool(pI128->Options, OPTION_NOACCEL, FALSE)) {
pI128->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
- } else pI128->NoAccel = FALSE;
+ } else {
+ int from = X_DEFAULT;
+ char *s = xf86GetOptValString(pI128->Options, OPTION_ACCELMETHOD);
+ pI128->NoAccel = FALSE;
+ if (!xf86NameCmp(s, "EXA")) {
+ pI128->exa = TRUE;
+ from = X_CONFIG;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s acceleration\n",
+ pI128->exa ? "EXA" : "XAA");
+ }
if (xf86ReturnOptValBool(pI128->Options, OPTION_SYNC_ON_GREEN, FALSE)) {
pI128->DACSyncOnGreen = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Sync-on-Green enabled\n");
@@ -1162,13 +1186,19 @@ I128PreInit(ScrnInfoPtr pScrn, int flags)
}
xf86LoaderReqSymLists(fbSymbols, NULL);
- /* Load XAA if needed */
+ /* Load the acceleration engine */
if (!pI128->NoAccel) {
- if (!xf86LoadSubModule(pScrn, "xaa")) {
- I128FreeRec(pScrn);
- return FALSE;
- }
- xf86LoaderReqSymLists(xaaSymbols, NULL);
+ if (pI128->exa) {
+ if (!xf86LoadSubModule(pScrn, "exa")) {
+ I128FreeRec(pScrn);
+ return FALSE;
+ } else xf86LoaderReqSymLists(exaSymbols, NULL);
+ } else {
+ if (!xf86LoadSubModule(pScrn, "xaa")) {
+ I128FreeRec(pScrn);
+ return FALSE;
+ } else xf86LoaderReqSymLists(xaaSymbols, NULL);
+ }
}
/* Load ramdac if needed */
@@ -1555,12 +1585,20 @@ I128ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
- if (!pI128->NoAccel)
- I128DGAInit(pScreen);
-
- if (!pI128->NoAccel)
- I128AccelInit(pScreen);
+ if (!pI128->NoAccel) {
+ if (pI128->exa)
+ ret = I128ExaInit(pScreen);
+ else {
+ I128DGAInit(pScreen);
+ ret = I128XaaInit(pScreen);
+ }
+ }
+ if (!ret) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Acceleration setup failed\n");
+ return FALSE;
+ }
+
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
xf86SetSilkenMouse(pScreen);
@@ -1708,8 +1746,12 @@ I128CloseScreen(int scrnIndex, ScreenPtr pScreen)
I128Restore(pScrn);
I128UnmapMem(pScrn);
}
- if (pI128->AccelInfoRec)
- XAADestroyInfoRec(pI128->AccelInfoRec);
+ if (pI128->XaaInfoRec)
+ XAADestroyInfoRec(pI128->XaaInfoRec);
+ if (pI128->ExaDriver) {
+ exaDriverFini(pScreen);
+ xfree(pI128->ExaDriver);
+ }
if (pI128->CursorInfoRec)
xf86DestroyCursorInfoRec(pI128->CursorInfoRec);
if (pI128->DGAModes)
@@ -2009,7 +2051,7 @@ I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
pI128->mem.rbase_g[CRT_1CON] = snc; MB;
}
-void
+static void
I128DumpBaseRegisters(ScrnInfoPtr pScrn)
{
I128Ptr pI128 = I128PTR(pScrn);
@@ -2370,7 +2412,7 @@ I128DumpActiveRegisters(ScrnInfoPtr pScrn)
I128DumpIBMDACRegisters(pScrn, vrbg);
}
-static unsigned char ibm52Xmask[0xA0] = {
+static const unsigned char ibm52Xmask[0xA0] = {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 00-07 */
0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, /* 08-0F */
0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, /* 10-17 */
@@ -2393,7 +2435,7 @@ static unsigned char ibm52Xmask[0xA0] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 98-9F */
};
-void
+static void
I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg)
{
unsigned char ibmr[0x100];
diff --git a/src/i128accel.c b/src/i128accel.c
index 185dbfd..da1f9af 100644
--- a/src/i128accel.c
+++ b/src/i128accel.c
@@ -42,24 +42,25 @@
#include "i128.h"
#include "i128reg.h"
-void I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2,
+static void I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2,
int w, int h);
-void I128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned planemask, int transparency_color);
-void I128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
+static void I128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir,
+ int ydir, int rop, unsigned planemask, int transparency_color);
+static void I128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int w, int h);
-void I128SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
+static void I128SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
unsigned planemask);
-void I128SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h);
-void I128SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2,
- int y2, int flags);
-void I128SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1,
+static void I128SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w,
+ int h);
+static void I128SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1,
+ int x2, int y2, int flags);
+static void I128SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2);
-void I128FillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
+static void I128FillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
unsigned int planemask, int nBox, register BoxPtr pBoxI);
-void I128ScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox, DDXPointPtr pptSrc,
- BoxPtr pbox, int xdir, int ydir, int alu, unsigned planemask);
-
+static void I128ScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir, int ydir, int alu,
+ unsigned planemask);
#define ENG_PIPELINE_READY() { while (pI128->mem.rbase_a[BUSY] & BUSY_BUSY) ; }
#define ENG_DONE() { while (pI128->mem.rbase_a[FLOW] & (FLOW_DEB | FLOW_MCB | FLOW_PRV)) ;}
@@ -67,7 +68,7 @@ void I128ScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox, DDXPointPtr pptSrc,
/* pre-shift rops and just or in as needed */
-static CARD32 i128alu[16] =
+static const CARD32 i128alu[16] =
{
CR_CLEAR<<8,
CR_AND<<8,
@@ -86,10 +87,10 @@ static CARD32 i128alu[16] =
CR_NAND<<8,
CR_SET<<8
};
- /* 8bpp 16bpp 32bpp unused */
-static int min_size[] = { 0x62, 0x32, 0x1A, 0x00 };
-static int max_size[] = { 0x80, 0x40, 0x20, 0x00 };
-static int split_size[] = { 0x20, 0x10, 0x08, 0x00 };
+ /* 8bpp 16bpp 32bpp unused */
+static const int min_size[] = { 0x62, 0x32, 0x1A, 0x00 };
+static const int max_size[] = { 0x80, 0x40, 0x20, 0x00 };
+static const int split_size[] = { 0x20, 0x10, 0x08, 0x00 };
void
@@ -100,7 +101,7 @@ I128EngineDone(ScrnInfoPtr pScrn)
}
-void
+static void
I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h)
{
I128Ptr pI128 = I128PTR(pScrn);
@@ -179,7 +180,7 @@ I128BitBlit(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h)
pI128->mem.rbase_a[XY1_DST] = (x2<<16) | y2; MB;
}
-void
+static void
I128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
int rop, unsigned planemask, int transparency_color)
{
@@ -234,14 +235,14 @@ I128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
pI128->mem.rbase_a[CMD] = pI128->cmd;
}
-void
+static void
I128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int w, int h)
{
I128BitBlit(pScrn, x1, y1, x2, y2, w, h);
}
-void
+static void
I128SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
{
I128Ptr pI128 = I128PTR(pScrn);
@@ -284,7 +285,7 @@ I128SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned planemask)
pI128->mem.rbase_a[CMD] = pI128->cmd;
}
-void
+static void
I128SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
#if 0
@@ -296,7 +297,7 @@ I128SubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
I128BitBlit(pScrn, 0, 0, x, y, w, h);
}
-void
+static void
I128SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2,
int y2, int flags)
{
@@ -323,7 +324,7 @@ I128SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2,
pI128->mem.rbase_a[XY1_DST] = (x2<<16) | y2; MB;
}
-void
+static void
I128SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
{
I128Ptr pI128 = I128PTR(pScrn);
@@ -342,7 +343,7 @@ I128SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
}
-void
+static void
I128FillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask,
int nBox, register BoxPtr pBoxI)
{
@@ -398,7 +399,7 @@ I128FillSolidRects(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask,
}
-void
+static void
I128ScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox, DDXPointPtr pptSrc,
BoxPtr pbox, int xdir, int ydir, int alu, unsigned planemask)
{
@@ -412,7 +413,7 @@ I128ScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox, DDXPointPtr pptSrc,
Bool
-I128AccelInit(ScreenPtr pScreen)
+I128XaaInit(ScreenPtr pScreen)
{
XAAInfoRecPtr infoPtr;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -421,7 +422,7 @@ I128AccelInit(ScreenPtr pScreen)
CARD32 buf_ctrl;
int maxlines;
- pI128->AccelInfoRec = infoPtr = XAACreateInfoRec();
+ pI128->XaaInfoRec = infoPtr = XAACreateInfoRec();
if (!infoPtr) return FALSE;
infoPtr->Flags = PIXMAP_CACHE |
@@ -511,7 +512,7 @@ I128AccelInit(ScreenPtr pScreen)
pI128->mem.rbase_a[INTM] = 0x03;
if (pI128->Debug) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I128AccelInit done\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I128XaaInit done\n");
I128DumpActiveRegisters(pScrn);
}
diff --git a/src/i128dga.c b/src/i128dga.c
index 07b98a5..1ceae5f 100644
--- a/src/i128dga.c
+++ b/src/i128dga.c
@@ -204,10 +204,10 @@ I128_FillRect (
){
I128Ptr pI128 = I128PTR(pScrn);
- if(pI128->AccelInfoRec) {
- (*pI128->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
- (*pI128->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- SET_SYNC_FLAG(pI128->AccelInfoRec);
+ if(pI128->XaaInfoRec) {
+ (*pI128->XaaInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*pI128->XaaInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ SET_SYNC_FLAG(pI128->XaaInfoRec);
}
}
@@ -220,15 +220,15 @@ I128_BlitRect(
){
I128Ptr pI128 = I128PTR(pScrn);
- if(pI128->AccelInfoRec) {
+ if(pI128->XaaInfoRec) {
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
int ydir = (srcy < dsty) ? -1 : 1;
- (*pI128->AccelInfoRec->SetupForScreenToScreenCopy)(
+ (*pI128->XaaInfoRec->SetupForScreenToScreenCopy)(
pScrn, xdir, ydir, GXcopy, ~0, -1);
- (*pI128->AccelInfoRec->SubsequentScreenToScreenCopy)(
+ (*pI128->XaaInfoRec->SubsequentScreenToScreenCopy)(
pScrn, srcx, srcy, dstx, dsty, w, h);
- SET_SYNC_FLAG(pI128->AccelInfoRec);
+ SET_SYNC_FLAG(pI128->XaaInfoRec);
}
}
@@ -243,15 +243,15 @@ I128_BlitTransRect(
){
I128Ptr pI128 = I128PTR(pScrn);
- if(pI128->AccelInfoRec) {
+ if(pI128->XaaInfoRec) {
int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
int ydir = (srcy < dsty) ? -1 : 1;
- (*pI128->AccelInfoRec->SetupForScreenToScreenCopy)(
+ (*pI128->XaaInfoRec->SetupForScreenToScreenCopy)(
pScrn, xdir, ydir, GXcopy, ~0, color);
- (*pI128->AccelInfoRec->SubsequentScreenToScreenCopy)(
+ (*pI128->XaaInfoRec->SubsequentScreenToScreenCopy)(
pScrn, srcx, srcy, dstx, dsty, w, h);
- SET_SYNC_FLAG(pI128->AccelInfoRec);
+ SET_SYNC_FLAG(pI128->XaaInfoRec);
}
}
#endif
diff --git a/src/i128exa.c b/src/i128exa.c
new file mode 100644
index 0000000..598a427
--- /dev/null
+++ b/src/i128exa.c
@@ -0,0 +1,689 @@
+/*
+ * Copyright 1997-2000 by Robin Cutshaw <robin@XFree86.Org>
+ * Copyright 2005 Adam Jackson <ajax@nwnk.net>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the names of the authors not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. The authors make no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* Solid and Copy support derived from the i128 XAA code */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "exa.h"
+#include "miline.h"
+#include "servermd.h"
+#include "picture.h"
+
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+#include "xf86Pci.h"
+#include "xf86PciInfo.h"
+
+#include "i128.h"
+#include "i128reg.h"
+
+#define PI128_FROM_PIXMAP(x) \
+ I128Ptr pI128 = I128PTR(xf86Screens[x->drawable.pScreen->myNum])
+#define PI128_FROM_SCREEN(x) \
+ I128Ptr pI128 = I128PTR(xf86Screens[x->myNum])
+#define PI128_FROM_PICTURE(x) \
+ I128Ptr pI128 = I128PTR(xf86Screens[x->pDrawable->pScreen->myNum])
+
+/* we might be able to do something smarter than this */
+#define ENG_PIPELINE_READY() \
+ while (pI128->mem.rbase_a[BUSY] & BUSY_BUSY)
+#define ENG_DONE() \
+ while (pI128->mem.rbase_a[FLOW] & (FLOW_DEB | FLOW_MCB | FLOW_PRV))
+
+#if 1
+#define I128_EXA_DEBUG(x)
+#else
+#define I128_EXA_DEBUG(x) ErrorF x
+#endif
+
+/* technically we should set the caches to bogus things during init... */
+#define CACHE_DEBUG 0
+
+#define CACHED_UPDATE(val, reg) \
+ do if (pI128->val != val) { \
+ if (CACHE_DEBUG) I128_EXA_DEBUG(("Updated cache for " #reg "\n")); \
+ pI128->mem.rbase_a[reg] = pI128->val = val; \
+ } while (0)
+
+static void
+i128SetBufCtrl(I128Ptr pI128, int dest_bpp)
+{
+ unsigned int buf_ctrl;
+
+ switch (dest_bpp) {
+ case 8: buf_ctrl = BC_PSIZ_8B; break;
+ case 16: buf_ctrl = BC_PSIZ_16B; break;
+ case 24:
+ case 32: buf_ctrl = BC_PSIZ_32B; break;
+ default: buf_ctrl = 0; break; /* error */
+ }
+ if (pI128->Chipset == PCI_CHIP_I128_T2R) {
+ if (pI128->MemoryType == I128_MEMORY_SGRAM)
+ buf_ctrl |= BC_MDM_PLN;
+ else
+ buf_ctrl |= BC_BLK_ENA;
+ }
+
+ CACHED_UPDATE(buf_ctrl, BUF_CTRL);
+}
+
+static const CARD32 i128alu[16] =
+{
+ CR_CLEAR << 8,
+ CR_AND << 8,
+ CR_AND_REV << 8,
+ CR_COPY << 8,
+ CR_AND_INV << 8,
+ CR_NOOP << 8,
+ CR_XOR << 8,
+ CR_OR << 8,
+ CR_NOR << 8,
+ CR_EQUIV << 8,
+ CR_INVERT << 8,
+ CR_OR_REV << 8,
+ CR_COPY_INV << 8,
+ CR_OR_INV << 8,
+ CR_NAND << 8,
+ CR_SET << 8
+};
+
+/* 8bpp 16bpp 32bpp unused */
+static const int min_size[] = { 0x62, 0x32, 0x1A, 0x00 };
+static const int max_size[] = { 0x80, 0x40, 0x20, 0x00 };
+static const int split_size[] = { 0x20, 0x10, 0x08, 0x00 };
+
+/*
+ * this is the workhorse for our solid and copy routines. this works because
+ * when CS_SOLID is set, the color comes from the FORE register regardless of
+ * the source pixmap coords.
+ */
+
+static void
+i128ExaBlit(PixmapPtr dst, int x1, int y1, int x2, int y2, int w, int h)
+{
+ int wh;
+ PI128_FROM_PIXMAP(dst);
+
+ I128_EXA_DEBUG(("Blit: %d %d %d %d %d %d\n", x1, y1, x2, y2, w, h));
+ ENG_PIPELINE_READY();
+
+ /*
+ * this deserves explanation. XY3_DIR == 0 means left to right, top to
+ * bottom. setting bit zero (DIR_LR_BT) switches to bottom to top, and
+ * setting bit one (DIR_RL_TB) switches to right to left. XXX rewrite me.
+ */
+ if (pI128->blitdir & DIR_RL_TB) { /* right-to-left */
+ x1 += w; x1--;
+ x2 += w; x2--;
+ }
+ if (pI128->blitdir & DIR_LR_BT) { /* bottom-to-top */
+ y1 += h; y1--;
+ y2 += h; y2--;
+ }
+
+ if (pI128->Chipset == PCI_CHIP_I128) {
+ int bppi;
+
+ /* The I128-1 has a nasty bitblit bug
+ * that occurs when dest is exactly 8 pages wide
+ */
+
+ bppi = (pI128->mem.rbase_a[BUF_CTRL] & BC_PSIZ_MSK) >> 24;
+
+ if ((w >= min_size[bppi]) && (w <= max_size[bppi])) {
+ bppi = split_size[bppi];
+#if 1
+ /* split method */
+
+ wh = (bppi << 16) | h;
+ CACHED_UPDATE(wh, XY2_WH);
+ pI128->mem.rbase_a[XY0_SRC] = (x1 << 16) | y1; MB;
+ pI128->mem.rbase_a[XY1_DST] = (x2 << 16) | y2; MB;
+
+ ENG_PIPELINE_READY();
+
+ w -= bppi;
+
+ if (pI128->blitdir & DIR_RL_TB) {
+ /* right to left blit */
+ x1 -= bppi;
+ x2 -= bppi;
+ } else {
+ /* left to right blit */
+ x1 += bppi;
+ x2 += bppi;
+ }
+#else
+ /* clip method */
+ pI128->mem.rbase_a[CLPTL] = (x2 << 16) | y2;
+ pI128->mem.rbase_a[CLPBR] = ((x2 + w) << 16) | (y2 + h);
+ w += bppi;
+#endif
+ }
+ }
+
+ /* this is overkill, but you can never have too much overkill */
+ wh = (w << 16) | h;
+ CACHED_UPDATE(wh, XY2_WH);
+
+ pI128->mem.rbase_a[XY0_SRC] = (x1 << 16) | y1; MB;
+ pI128->mem.rbase_a[XY1_DST] = (x2 << 16) | y2; MB;
+}
+
+static void
+i128WaitMarker(ScreenPtr pScreen, int Marker)
+{
+ PI128_FROM_SCREEN(pScreen);
+ ENG_DONE();
+}
+
+static void
+i128SetPlanemask(I128Ptr pI128, Pixel p)
+{
+ Pixel planemask;
+ I128_EXA_DEBUG(("SetPlanemask: %d\n", (int)p));
+ if (p == -1)
+ planemask = -1;
+ else switch (pI128->bitsPerPixel) {
+ case 8:
+ planemask = p * 0x01010101; break;
+ case 16:
+ planemask = p * 0x00010001; break;
+ default:
+ planemask = p; break;
+ }
+
+ CACHED_UPDATE(planemask, MASK);
+}
+
+/* this should be superfluous... */
+static void
+i128SetClip(I128Ptr pI128)
+{
+#if 0
+ pI128->clptl = pI128->mem.rbase_a[CLPTL] = 0x00000000;
+ pI128->clpbr = pI128->mem.rbase_a[CLPBR] = (4095 << 16) | 2047;
+#endif
+}
+
+static void
+i128SetBlitDirection(I128Ptr pI128, int dx, int dy)
+{
+ int blitdir;
+
+ I128_EXA_DEBUG(("SetBlitDirection: %d %d\n", dx, dy));
+
+ if (dx < 0) {
+ if (dy < 0) blitdir = DIR_RL_BT;
+ else blitdir = DIR_RL_TB;
+ } else {
+ if (dy < 0) blitdir = DIR_LR_BT;
+ else blitdir = DIR_LR_TB;
+ }
+
+ CACHED_UPDATE(blitdir, XY3_DIR);
+}
+
+static void
+i128SetRop(I128Ptr pI128, int alu, int solid)
+{
+ int cmd;
+
+ I128_EXA_DEBUG(("SetRop: %d %d\n", alu, solid));
+
+ cmd = i128alu[alu] | CO_BITBLT | (solid ? (CS_SOLID << 16) : 0);
+
+ CACHED_UPDATE(cmd, CMD);
+}
+
+static void
+i128SetSourcePixmap(I128Ptr pI128, PixmapPtr src)
+{
+ unsigned int sorg = exaGetPixmapOffset(src);
+ unsigned int sptch = exaGetPixmapPitch(src);
+
+ I128_EXA_DEBUG(("SetSourcePixmap: %x, %d\n", sorg, sptch));
+
+ CACHED_UPDATE(sorg, DE_SORG);
+ CACHED_UPDATE(sptch, DE_SPTCH);
+}
+
+static void
+i128SetDestPixmap(I128Ptr pI128, PixmapPtr dst)
+{
+ unsigned int dorg = exaGetPixmapOffset(dst);
+ unsigned int dptch = exaGetPixmapPitch(dst);
+
+ I128_EXA_DEBUG(("SetDestPixmap: %x, %d\n", dorg, dptch));
+
+ CACHED_UPDATE(dorg, DE_DORG);
+ CACHED_UPDATE(dptch, DE_DPTCH);
+}
+
+static void
+i128SetTexture(I128Ptr pI128, PixmapPtr tex)
+{
+ unsigned int torg = exaGetPixmapOffset(tex);
+ unsigned int tptch = exaGetPixmapPitch(tex);
+
+ I128_EXA_DEBUG(("SetTexture: %x, %d\n", torg, tptch));
+
+ CACHED_UPDATE(torg, LOD0_ORG);
+ CACHED_UPDATE(tptch, DE_TPTCH);
+}
+
+static const int func_tab[13][2] = {
+ /* source function, destination function */
+ { ABLEND_SRC_ZERO, ABLEND_DST_ZERO }, /* clear */
+ { ABLEND_SRC_ONE, ABLEND_DST_ZERO }, /* src */
+ { ABLEND_SRC_ZERO, ABLEND_DST_ONE }, /* dst */
+ { ABLEND_SRC_ONE, ABLEND_DST_OMSRC_ALPHA }, /* over */
+ { ABLEND_SRC_OMDST_ALPHA, ABLEND_DST_ONE }, /* overreverse */
+ { ABLEND_SRC_DST_ALPHA, ABLEND_DST_ZERO }, /* in */
+ { ABLEND_SRC_ZERO, ABLEND_DST_SRC_ALPHA }, /* inreverse */
+ { ABLEND_SRC_OMDST_ALPHA, ABLEND_DST_ZERO }, /* out */
+ { ABLEND_SRC_ZERO, ABLEND_DST_OMSRC_ALPHA }, /* outreverse */
+ { ABLEND_SRC_DST_ALPHA, ABLEND_DST_OMSRC_ALPHA }, /* atop */
+ { ABLEND_SRC_OMDST_ALPHA, ABLEND_DST_SRC_ALPHA }, /* atopreverse */
+ { ABLEND_SRC_OMDST_ALPHA, ABLEND_DST_OMSRC_ALPHA }, /* xor */
+ { ABLEND_SRC_ONE, ABLEND_DST_ONE } /* add */
+};
+
+static void
+i128SetAlphaForOp(I128Ptr pI128, int op, int enable)
+{
+ int acntrl = 0;
+
+ if (enable) {
+ acntrl |= ACTL_BE; /* blend enable */
+ acntrl |= func_tab[op][0]; /* source factor */
+ acntrl |= func_tab[op][1]; /* dest_factor */
+ acntrl |= 0; /* ACTL_AMD; / * modulate alpha */
+ } else {
+ acntrl = 0;
+ }
+
+ I128_EXA_DEBUG(("SetAlphaForOp: %d, %d\n", op, enable));
+
+ CACHED_UPDATE(acntrl, ACNTRL);
+}
+
+/* we don't need a finalizer, yet */
+static void
+i128Done(PixmapPtr p) {
+ I128_EXA_DEBUG(("Done\n\n"));
+ return;
+}
+
+/* Solid */
+
+static Bool
+i128PrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
+{
+ PI128_FROM_PIXMAP(pPixmap);
+
+ ENG_PIPELINE_READY();
+
+ i128SetPlanemask(pI128, planemask);
+
+ if (alu != GXclear && alu != GXset)
+ pI128->mem.rbase_a[FORE] = fg;
+
+ i128SetClip(pI128);
+ i128SetBlitDirection(pI128, 1, 1); /* probably unnecessary/ignored */
+
+ i128SetAlphaForOp(pI128, 0, 0);
+ i128SetRop(pI128, alu, 1);
+
+ /* no need to set the source, the chip ignores it */
+ i128SetDestPixmap(pI128, pPixmap);
+
+ return TRUE;
+}
+
+static void
+i128Solid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2)
+{
+ i128ExaBlit(pPixmap, 0, 0, x1, y1, x2 - x1, y2 - y1);
+}
+
+/* Copy */
+
+static Bool
+i128PrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int dx, int dy,
+ int alu, Pixel planemask)
+{
+ PI128_FROM_PIXMAP(pSrcPixmap);
+
+ ENG_PIPELINE_READY();
+
+ i128SetPlanemask(pI128, planemask);
+ i128SetClip(pI128);
+ i128SetBlitDirection(pI128, dx, dy);
+
+ i128SetAlphaForOp(pI128, 0, 0);
+ i128SetRop(pI128, alu, 0);
+
+ i128SetSourcePixmap(pI128, pSrcPixmap);
+ i128SetDestPixmap(pI128, pDstPixmap);
+
+ return TRUE;
+}
+
+static void
+i128Copy(PixmapPtr pDstPixmap, int x1, int y1, int x2, int y2, int w, int h)
+{
+ i128ExaBlit(pDstPixmap, x1, y1, x2, y2, w, h);
+}
+
+/* Composite */
+
+static const struct source_format source_formats[] = {
+ /* 32bpp */
+ { PICT_a8r8g8b8, 0x14, 0, 0 },
+ { PICT_x8r8g8b8, 0x14, 0, 1 },
+#if 0
+ { PICT_a8b8g8r8, 0x14, 0, 0 },
+ { PICT_x8b8g8r8, 0x14, 0, 1 },
+ /* no direct 24bpp formats */
+ /* 16bpp */
+ { PICT_r5g6b5, 0x12, 0, 0 },
+ { PICT_b5g6r5, 0x12, 0, 0 },
+ { PICT_a1r5g5b5, 0x11, 0, 0 },
+ { PICT_x1r5g5b5, 0x11, 0, 1 },
+ { PICT_a1b5g5r5, 0x11, 0, 0 },
+ { PICT_x1b5g5r5, 0x11, 0, 1 },
+ { PICT_a4r4g4b4, 0x10, 0, 0 },
+ { PICT_x4r4g4b4, 0x10, 0, 1 },
+ { PICT_a4b4g4r4, 0x10, 0, 0 },
+ { PICT_x4b4g4r4, 0x10, 0, 1 },
+ /* 8bpp */
+ { PICT_a8, 0x21, 0, 0 },
+ { PICT_r3g3b2, 0x0D, 0, 0 },
+ { PICT_b2g3r3, 0x0D, 0, 0 },
+ { PICT_a2r2g2b2, 0x30, 0, 0 },
+ { PICT_a2b2g2r2, 0x30, 0, 0 },
+ /* 4bpp */
+ { PICT_a4, 0x20, 0, 0 },
+#endif
+ /* terminator */
+ { 0, 0, 0, 0 }
+};
+
+static struct source_format *
+i128MapSourceFormat(int fmt)
+{
+ struct source_format *f;
+ for (f = (struct source_format *)source_formats; f->render_format; f++)
+ if (f->render_format == fmt)
+ return f;
+ return NULL;
+}
+
+struct dest_format {
+ int render_format;
+ int i128_format;
+};
+
+static const struct dest_format dest_formats[] = {
+ { 0, 0 }
+};
+
+static struct dest_format *
+i128MapDestFormat(int fmt)
+{
+ return NULL;
+}
+
+/* Composite is probably t2r and t2r4 only */
+static Bool
+i128CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture)
+{
+ PI128_FROM_PICTURE(pDstPicture);
+
+ if (op >= PictOpSaturate) return FALSE;
+
+ /*
+ * no direct alpha mask support. we only have one TMU, so while we
+ * can emulate it, we should emulate it in the generic EXA layer.
+ */
+ if (pMaskPicture) return FALSE;
+
+ /* when transforms added, be sure to check for linear/nearest */
+ /* if (pSrcPicture->transform) return FALSE; */
+
+ /* no support for external alpha */
+ if (pSrcPicture->alphaMap || pDstPicture->alphaMap) return FALSE;
+
+ pI128->source = i128MapSourceFormat(pSrcPicture->format);
+ if (!pI128->source)
+ return FALSE;
+#if 0
+ if (!i128MapDestFormat(pDstPicture->format)) return FALSE;
+#endif
+
+ return TRUE;
+}
+
+static Bool
+i128PrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
+ PicturePtr pDstPicture, PixmapPtr pSrc, PixmapPtr pMask,
+ PixmapPtr pDst)
+{
+ unsigned int cmd;
+ unsigned int tex_ctl = 0;
+ unsigned int threedctl = 0;
+ PI128_FROM_PIXMAP(pDst);
+
+ /* 2D setup */
+ i128SetBufCtrl(pI128, pDst->drawable.bitsPerPixel);
+ i128SetPlanemask(pI128, -1);
+ i128SetSourcePixmap(pI128, pSrc);
+ i128SetDestPixmap(pI128, pDst);
+
+ /* TEX_INV command here? */
+
+ cmd = CO_TRIAN3D;
+ CACHED_UPDATE(cmd, CMD);
+
+ /* 3D setup */
+ i128SetTexture(pI128, pSrc);
+
+ i128SetAlphaForOp(pI128, op, 1);
+
+ /* it looks pointless to cache these, but we'll need it for DRI */
+
+ tex_ctl |= TEX_TM; /* enable texture mapping */
+ tex_ctl |= TEX_NMG | TEX_NMN; /* nearest interpolation */
+ tex_ctl |= 0; /* TEX_RM; / * modulate RGB */
+ CACHED_UPDATE(tex_ctl, TEX_CTL);
+
+ threedctl |= 0; /* COMP_TRUE << TCTL_ZOP_SHIFT; / * always pass Z check */
+ threedctl |= TCTL_ABS; /* enable alpha blend */
+ threedctl |= TCTL_TBS; /* enable texture blend */
+ threedctl |= TCTL_RT; /* draw textured rectangle */
+ CACHED_UPDATE(threedctl, THREEDCTL);
+
+ return TRUE;
+}
+
+static void
+i128Composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY,
+ int dstX, int dstY, int width, int height)
+{
+ PI128_FROM_PIXMAP(pDst);
+
+ /*
+ * vertex setup. vertex layout must be:
+ * V0 V1
+ * V2 (V3 is implicit)
+ */
+
+ pI128->mem.rbase_af[V0_X] = 0.0;
+ pI128->mem.rbase_af[V0_Y] = 0.0;
+ pI128->mem.rbase_af[V0_W] = 1.0;
+ pI128->mem.rbase_af[V0_U] = 0.0;
+ pI128->mem.rbase_af[V0_V] = 0.0;
+ pI128->mem.rbase_af[V1_X] = 300.0;
+ pI128->mem.rbase_af[V1_Y] = 0.0;
+ pI128->mem.rbase_af[V1_W] = 1.0;
+ pI128->mem.rbase_af[V1_U] = 1.0;
+ pI128->mem.rbase_af[V1_V] = 0.0;
+ pI128->mem.rbase_af[V2_X] = 0.0;
+ pI128->mem.rbase_af[V2_Y] = 300.0;
+ pI128->mem.rbase_af[V2_W] = 1.0;
+ pI128->mem.rbase_af[V2_U] = 0.0;
+ pI128->mem.rbase_af[V2_V] = 1.0;
+
+ /* and fire */
+ pI128->mem.rbase_a[TRIGGER3D] = 1; MB;
+
+#if 0
+ static int i = 0;
+ /* test for raster */
+ if (!(i = (i + 1) % 32)) {
+ ErrorF("Composite test: %d %d %d %d %d %d\n", srcX, srcY, dstX, dstY,
+ width, height);
+ }
+ i128SetRop(pI128, GXxor, 0);
+ i128ExaBlit(pDst, srcX, srcY, dstX, dstY, width, height);
+#endif
+}
+
+#if 0
+/*
+ * upload and download will require a DRM. AGP DMA only works on T2R4, and
+ * then only for upload. we could probably use memory windows on other chips,
+ * but those have goofy alignment restrictions and need to be disabled when
+ * not in use.
+ */
+static Bool
+i128DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst,
+ int dst_pitch)
+{
+}
+
+static Bool
+i128UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
+ int src_pitch)
+{
+}
+#endif
+
+Bool
+I128ExaInit(ScreenPtr pScreen)
+{
+ ExaDriverPtr pExa;
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ I128Ptr pI128 = I128PTR(pScrn);
+
+ if (exaGetVersion() < EXA_MAKE_VERSION(0, 2, 0)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "EXA version is too old "
+ "(got 0x%3x, need >= 0x020)\n", exaGetVersion());
+ return FALSE;
+ }
+
+ if (!(pExa = xf86calloc(1, sizeof(*pExa)))) {
+ pI128->NoAccel = TRUE;
+ return FALSE;
+ }
+ pI128->ExaDriver = pExa;
+
+ pExa->card.flags = EXA_OFFSCREEN_PIXMAPS | EXA_OFFSCREEN_ALIGN_POT;
+ pExa->card.memoryBase = pI128->MemoryPtr;
+ pExa->card.memorySize = pI128->MemorySize * 1024;
+ pExa->card.offScreenBase = (pScrn->virtualX * pScrn->virtualY) *
+ (pScrn->bitsPerPixel / 8) + 4096;
+ /* these two are probably right */
+ pExa->card.pixmapOffsetAlign = 16;
+ pExa->card.pixmapPitchAlign = 16;
+ /* these two are guesses */
+ pExa->card.maxX = 2048;
+ pExa->card.maxY = 2048;
+
+ pExa->accel.WaitMarker = i128WaitMarker;
+
+ pExa->accel.PrepareSolid = i128PrepareSolid;
+ pExa->accel.Solid = i128Solid;
+ pExa->accel.DoneSolid = i128Done;
+
+ pExa->accel.PrepareCopy = i128PrepareCopy;
+ pExa->accel.Copy = i128Copy;
+ pExa->accel.DoneCopy = i128Done;
+
+ if (0 && (pI128->Chipset == PCI_CHIP_I128_T2R ||
+ pI128->Chipset == PCI_CHIP_I128_T2R4))
+ {
+#if 0
+ pExa->accel.DownloadFromScreen = i128DownloadFromScreen;
+ pExa->accel.UploadToScreen = i128UploadToScreen;
+#endif
+ pExa->accel.CheckComposite = i128CheckComposite;
+ pExa->accel.PrepareComposite = i128PrepareComposite;
+ pExa->accel.Composite = i128Composite;
+ pExa->accel.DoneComposite = i128Done;
+ }
+
+ /*
+ * XXX much of this is duplicated from the XAA code, but I expect the XAA
+ * support to disappear eventually.
+ */
+ pI128->buf_ctrl = 0; /* force write */
+ i128SetBufCtrl(pI128, pI128->bitsPerPixel);
+
+ /* all of this needs to be properly documented */
+ {
+ pI128->mem.rbase_a[DE_PGE] = 0x00;
+ pI128->mem.rbase_a[DE_SORG] = pI128->displayOffset;
+ pI128->mem.rbase_a[DE_DORG] = pI128->displayOffset;
+ pI128->mem.rbase_a[DE_MSRC] = 0x00;
+ pI128->mem.rbase_a[DE_WKEY] = 0x00;
+ pI128->mem.rbase_a[DE_SPTCH] = pI128->mem.rbase_g[DB_PTCH];
+ pI128->mem.rbase_a[DE_DPTCH] = pI128->mem.rbase_g[DB_PTCH];
+ if (pI128->Chipset == PCI_CHIP_I128_T2R4)
+ pI128->mem.rbase_a[DE_ZPTCH] = pI128->mem.rbase_g[DB_PTCH];
+ pI128->mem.rbase_a[RMSK] = 0x00000000;
+ pI128->mem.rbase_a[XY4_ZM] = ZOOM_NONE;
+ pI128->mem.rbase_a[LPAT] = 0xffffffff; /* for lines */
+ pI128->mem.rbase_a[PCTRL] = 0x00000000; /* for lines */
+ pI128->mem.rbase_a[CLPTL] = 0x00000000;
+ pI128->mem.rbase_a[CLPBR] = (4095 << 16) | 2047 ;
+ pI128->mem.rbase_a[ACNTRL] = 0x00000000;
+ pI128->mem.rbase_a[INTM] = 0x03;
+ }
+
+ /* need this as a float * for vertex setup */
+ pI128->mem.rbase_af = (float *)pI128->mem.rbase_a;
+
+ if (pI128->Debug) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I128ExaInit done\n");
+ I128DumpActiveRegisters(pScrn);
+ }
+
+ return(exaDriverInit(pScreen, pExa));
+}
diff --git a/src/i128init.c b/src/i128init.c
index a1b68d2..00ec646 100644
--- a/src/i128init.c
+++ b/src/i128init.c
@@ -40,8 +40,8 @@
#include "Ti302X.h"
#include "IBMRGB.h"
-void I128SavePalette(I128Ptr pI128);
-void I128RestorePalette(I128Ptr pI128);
+static void I128SavePalette(I128Ptr pI128);
+static void I128RestorePalette(I128Ptr pI128);
void
@@ -520,7 +520,7 @@ I128Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
-void
+static void
I128SavePalette(I128Ptr pI128)
{
short i;
@@ -540,7 +540,7 @@ I128SavePalette(I128Ptr pI128)
}
-void
+static void
I128RestorePalette(I128Ptr pI128)
{
int i;
diff --git a/src/i128reg.h b/src/i128reg.h
index e96c24b..01e2f41 100644
--- a/src/i128reg.h
+++ b/src/i128reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h,v 1.3 2002/01/25 21:56:02 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128reg.h,v 1.2 2000/10/23 14:11:39 robin Exp $ */
/*
* Copyright 1994 by Robin Cutshaw <robin@XFree86.Org>
*
@@ -72,6 +72,7 @@ struct i128mem {
CARD32 *rbase_a;
CARD32 *rbase_b;
CARD32 *rbase_i;
+ float *rbase_af;
};
/* save the registers needed for restoration in this structure */
@@ -128,6 +129,21 @@ typedef union {
#define GINTM 0x0004
#define SGRAM 0x00A4
+/* DMA regs, relative to RBASE_I. T2R4 only. */
+#define DMA_SRC 0x00D0/4
+#define DMA_SRC_MASK 0x07
+#define DMA_DST 0x00D4/4
+#define DMA_DST_MASK 0xFC000007
+#define DMA_CMD 0x00D8/4
+#define DMA_QWORDS_MASK 0x0001FFFF
+#define DMA_REQ_LENGTH_4Q 0x00000000
+#define DMA_REQ_LENGTH_8Q 0x01000000
+#define DMA_REQ_LENGTH_16Q 0x02000000
+#define DMA_REQ_LENGTH_32Q 0x03000000
+#define DMA_PIPELINE_READY 0x10000000
+#define DMA_IDLE 0x20000000
+#define DMA_EXPEDITE 0x40000000
+
/* RBASE_G register offsets (divided by four for double word indexing */
#define WR_ADR 0x0000/4
@@ -159,6 +175,7 @@ typedef union {
/* RBASE_W register offsets (divided by four for double word indexing */
+/* MW1_* are probably T2R and T2R4 only */
#define MW0_CTRL 0x0000/4
#define MW0_AD 0x0004/4
@@ -169,7 +186,15 @@ typedef union {
#define MW0_WKEY 0x001C/4
#define MW0_KDAT 0x0020/4
#define MW0_MASK 0x0024/4
-
+#define MW1_CTRL 0x0028/4
+#define MW1_AD 0x002C/4
+#define MW1_SZ 0x0030/4
+#define MW1_PGE 0x0034/4
+#define MW1_ORG 0x0038/4
+#define MW1_MSRC 0x0040/4
+#define MW1_WKEY 0x0044/4
+#define MW1_KDAT 0x0048/4
+#define MW1_MASK 0x004C/4
/* RBASE_[AB] register offsets (divided by four for double word indexing */
@@ -223,8 +248,10 @@ typedef union {
#define DE_SORG 0x0028/4
#define DE_DORG 0x002C/4
#define DE_MSRC 0x0030/4
+/* these next two sound bogus */
#define DE_WKEY 0x0038/4
#define DE_KYDAT 0x003C/4
+#define DE_TPTCH 0x0038/4
#define DE_ZPTCH 0x003C/4
#define DE_SPTCH 0x0040/4
#define DE_DPTCH 0x0044/4
@@ -241,8 +268,13 @@ typedef union {
#define CO_LINE 0x02
#define CO_ELINE 0x03
#define CO_TRIAN 0x04
+#define CO_PLINE 0x05
#define CO_RXFER 0x06
#define CO_WXFER 0x07
+#define CO_LINE3D 0x08
+#define CO_TRIAN3D 0x09
+#define CO_TEXINV 0x0A
+#define CO_LOADPAL 0x0B
#define CMD_ROP 0x0054/4
#define CR_CLEAR 0x00
#define CR_NOR 0x01
@@ -314,9 +346,129 @@ typedef union {
#define XY_X_DATA 0xFFFF0000
#define XY_I_DATA1 0x0000FFFF
#define XY_I_DATA2 0xFFFF0000
+#define LOD0_ORG 0x00D0/4
+#define LOD1_ORG 0x00D4/4
+#define LOD2_ORG 0x00D8/4
+#define LOD3_ORG 0x00DC/4
+#define LOD4_ORG 0x00E0/4
+#define LOD5_ORG 0x00E4/4
+#define LOD6_ORG 0x00E8/4
+#define LOD7_ORG 0x00EC/4
+#define LOD8_ORG 0x00F0/4
+#define LOD9_ORG 0x00F4/4
+
#define DL_ADR 0x00F8/4
#define DL_CNTRL 0x00FC/4
#define ACNTRL 0x016C/4
+#define ASRC_FUNC 0x0000000F
+#define ADST_FUNC 0x000000F0
+#define ACTL_SRE 0x00000100 /* 0: pixel alpha, 1: srca reg */
+#define ACTL_DRE 0x00000200 /* likewise */
+#define ACTL_BE 0x00000400
+#define ACTL_AOP 0x000F0000
+#define ACTL_AEN 0x00100000 /* alpha compare enable */
+#define ACTL_ASL 0x01000000 /* 0: texture alpha, 1: vertex alpha */
+#define ACTL_AMD 0x02000000
+#define ACTL_DAB 0x04000000
+#define THREEDCTL 0x0170/4
+#define TCTL_ZE 0x00000001
+#define TCTL_ZRO 0x00000002
+#define TCTL_FIS 0x00000008
+#define TCTL_FSL 0x00000010
+#define TCTL_ZOP 0x000000E0
+#define TCTL_ZOP_SHIFT 5
+#define TCTL_YOP 0x00000800
+#define TCTL_HOP 0x00003100
+#define TCTL_KYP 0x00004000
+#define TCTL_KYE 0x00008000
+#define TCTL_DOP 0x00010000
+#define TCTL_ABS 0x00020000
+#define TCTL_TBS 0x00040000
+#define TCTL_RSL 0x00080000
+#define TCTL_SSC 0x00200000
+#define TCTL_CW 0x00400000
+#define TCTL_BCE 0x00800000
+#define TCTL_SH 0x01000000
+#define TCTL_SPE 0x02000000
+#define TCTL_RSC 0x04000000
+#define TCTL_FEN 0x08000000
+#define TCTL_RT 0x10000000
+#define TCTL_P8 0x20000000
+#define TCTL_ZS 0x40000000
+#define TEX_CTL 0x0174/4
+#define TEX_TM 0x00000001
+#define TEX_MM 0x00000002
+#define TEX_NMG 0x00000004
+#define TEX_MLM 0x00000008
+#define TEX_NMN 0x00000010
+#define TEX_RM 0x00000020
+#define TEX_PM 0x00000040
+#define TEX_CCS 0x00000080
+#define TEX_TCU 0x00000100
+#define TEX_TCV 0x00000200
+#define TEX_MLP2 0x00000400
+#define TEX_MMN 0x0000F000
+#define TEX_MMSIZEX 0x000F0000
+#define TEX_MMSIZEY 0x00F00000
+#define TEX_FMT 0x3F000000
+#define TEX_TCT 0x40000000
+#define TEX_UVS 0x80000000
+#define PPTR 0x0178/4
+/* for each vertex: x, y, z, w, color, specular color, u, v */
+#define V0_X 0x017C/4
+#define V0_Y 0x0180/4
+#define V0_Z 0x0184/4
+#define V0_W 0x0188/4
+#define V0_C 0x018C/4
+#define V0_S 0x0190/4
+#define V0_U 0x0194/4
+#define V0_V 0x0198/4
+#define V1_X 0x019C/4
+#define V1_Y 0x01A0/4
+#define V1_Z 0x01A4/4
+#define V1_W 0x01A8/4
+#define V1_C 0x01AC/4
+#define V1_S 0x01B0/4
+#define V1_U 0x01B4/4
+#define V1_V 0x01B8/4
+#define V2_X 0x01BC/4
+#define V2_Y 0x01C0/4
+#define V2_Z 0x01C4/4
+#define V2_W 0x01C8/4
+#define V2_C 0x01CC/4
+#define V2_S 0x01D0/4
+#define V2_U 0x01D4/4
+#define V2_V 0x01D8/4
+#define TRIGGER3D 0x01DC/4
+
+/* alpha blend functions */
+#define ABLEND_SRC_ZERO 0
+#define ABLEND_SRC_ONE 1
+#define ABLEND_SRC_DST_COLOR 2
+#define ABLEND_SRC_OMDST_COLOR 3
+#define ABLEND_SRC_SRC_ALPHA 4
+#define ABLEND_SRC_OMSRC_ALPHA 5
+#define ABLEND_SRC_DST_ALPHA 6
+#define ABLEND_SRC_OMDST_ALPHA 7
+#define ABLEND_DST_ZERO 0 << 4
+#define ABLEND_DST_ONE 1 << 4
+#define ABLEND_DST_SRC_COLOR 2 << 4
+#define ABLEND_DST_OMSRC_COLOR 3 << 4
+#define ABLEND_DST_SRC_ALPHA 4 << 4
+#define ABLEND_DST_OMSRC_ALPHA 5 << 4
+#define ABLEND_DST_DST_ALPHA 6 << 4
+#define ABLEND_DST_OMDST_ALPHA 7 << 4
+
+/* comparison functions */
+#define COMP_FALSE 0
+#define COMP_TRUE 1
+#define COMP_LT 2
+#define COMP_LE 3
+#define COMP_EQ 4
+#define COMP_GE 5
+#define COMP_GT 6
+#define COMP_NE 7
+
#define I128_WAIT_READY 1
#define I128_WAIT_DONE 2