summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaryll <daryll>2000-06-12 23:49:38 +0000
committerdaryll <daryll>2000-06-12 23:49:38 +0000
commit8d87bbd53bcc65486a3351526a0f42383a15903e (patch)
tree01365966f20838b72199056b66c0c51a79279763
parent398c32009b9b91defcc7ddc172c503d75280333f (diff)
This insures we get a lock before doing any drawing.
-rw-r--r--xc/config/cf/host.def3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c32
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c11
5 files changed, 30 insertions, 24 deletions
diff --git a/xc/config/cf/host.def b/xc/config/cf/host.def
index a8e712215..ebb4d7d6e 100644
--- a/xc/config/cf/host.def
+++ b/xc/config/cf/host.def
@@ -13,6 +13,9 @@
#define BuildXF86DRI YES
#define HasGlide3 YES
+/* To do profiling turn on this plus one of the builtin drivers*/
+/* #define ProfileLibGlx YES */
+
/* Optionally turn these on for debugging */
/* #define GlxBuiltInTdfx YES */
/* #define GlxBuiltInI810 YES */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
index e6db51242..bc0d5ff3f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
@@ -77,6 +77,7 @@ void
TDFXNeedSync(ScrnInfoPtr pScrn) {
TDFXPtr pTDFX = TDFXPTR(pScrn);
pTDFX->syncDone=FALSE;
+ pTDFX->AccelInfoRec->NeedToSync = TRUE;
}
void
@@ -349,10 +350,15 @@ TDFXMatchState(TDFXPtr pTDFX)
}
static void
-TDFXClearState(TDFXPtr pTDFX)
+TDFXClearState(ScrnInfoPtr pScrn)
{
+ TDFXPtr pTDFX;
+
+ pTDFX=TDFXPTR(pScrn);
pTDFX->Cmd=0;
pTDFX->DrawState&=~DRAW_STATE_TRANSPARENT;
+ /* Make sure we've done a sync */
+ TDFXFirstSync(pScrn);
}
static void
@@ -393,8 +399,7 @@ TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop,
"rop=%d planemask=%d trans_color=%d\n",
xdir, ydir, rop, planemask, trans_color);
pTDFX=TDFXPTR(pScrn);
- TDFXFirstSync(pScrn);
- TDFXClearState(pTDFX);
+ TDFXClearState(pScrn);
if (trans_color!=-1) {
TDFXMakeRoom(pTDFX, 3);
@@ -461,8 +466,7 @@ TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
TDFXTRACEACCEL("TDFXSetupForSolidFill color=%d rop=%d planemask=%d\n",
color, rop, planemask);
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
pTDFX->Cmd=TDFXROPCvt[rop]<<24;
if (pTDFX->cpp==1) fmt=(1<<16)|pTDFX->stride;
@@ -506,8 +510,7 @@ TDFXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
" bg=%d rop=%d planemask=%d\n", patx, paty, fg, bg, rop,
planemask);
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
pTDFX->Cmd = (TDFXROPCvt[rop+ROP_PATTERN_OFFSET]<<24) |
SST_2D_MONOCHROME_PATTERN;
@@ -552,8 +555,7 @@ TDFXSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
TDFXTRACEACCEL("TDFXSetupForSolidLine\n");
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
pTDFX->Cmd = (TDFXROPCvt[rop]<<24);
@@ -618,8 +620,7 @@ TDFXNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
TDFXTRACEACCEL("TDFXNonTEGlyphRenderer\n");
pTDFX=TDFXPTR(pScrn);
- TDFXFirstSync(pScrn);
- TDFXClearState(pTDFX);
+ TDFXClearState(pScrn);
/* Don't bother fixing clip1, we're going to change it anyway */
pTDFX->DrawState&=~DRAW_STATE_CLIP1CHANGED;
TDFXMatchState(pTDFX);
@@ -684,8 +685,7 @@ TDFXSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
TDFXTRACEACCEL("TDFXSetupForDashedLine\n");
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
pTDFX->Cmd = (TDFXROPCvt[rop]<<24) | SST_2D_STIPPLE_LINE;
if(bg == -1) {
@@ -728,8 +728,7 @@ TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
TDFXTRACEACCEL("TDFXSetupForScreenToScreenColorExpandFill\n");
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
TDFXMatchState(pTDFX);
pTDFX->Cmd|=SST_2D_SCRNTOSCRNBLIT|(TDFXROPCvt[rop]<<24);
@@ -794,8 +793,7 @@ TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg,
TDFXTRACEACCEL("SetupForCPUToScreenColorExpandFill bg=%x fg=%x rop=%d\n",
bg, fg, rop);
pTDFX=TDFXPTR(pScrn);
- TDFXClearState(pTDFX);
- TDFXFirstSync(pScrn);
+ TDFXClearState(pScrn);
pTDFX->Cmd|=SST_2D_HOSTTOSCRNBLIT|(TDFXROPCvt[rop]<<24);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
index 726cf7629..400355fa6 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c
@@ -222,7 +222,7 @@ TDFX_OpenFramebuffer(
TDFXPtr pTDFX = TDFXPTR(pScrn);
*name = NULL; /* no special device */
- *mem = (unsigned char*)pTDFX->LinearAddr;
+ *mem = (unsigned char*)pTDFX->LinearAddr[0];
*size = pTDFX->FbMapSize;
*offset = 0;
*flags = DGA_NEED_ROOT;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index 8b0c2dc38..cf9099069 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -782,7 +782,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
}
}
xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
- (unsigned long)pTDFX->LinearAddr);
+ (unsigned long)pTDFX->LinearAddr[0]);
if (pTDFX->pEnt->device->IOBase != 0) {
pTDFX->MMIOAddr[0] = pTDFX->pEnt->device->IOBase;
@@ -1689,7 +1689,7 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
hwp = VGAHWPTR(pScrn);
if (!TDFXMapMem(pScrn)) return FALSE;
- pScrn->memPhysBase = (int)pTDFX->LinearAddr;
+ pScrn->memPhysBase = (int)pTDFX->LinearAddr[0];
if (!pTDFX->usePIO) TDFXSetMMIOAccess(pTDFX);
vgaHWGetIOBase(hwp);
@@ -1707,6 +1707,8 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
TDFXSetLFBConfig(pTDFX);
+ /* We initialize in the state that our FIFO is up to date */
+ pTDFX->syncDone=TRUE;
#ifdef PROP_3DFX
if (!TDFXInitPrivate(pScreen)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n");
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
index 0d09b79dd..7fc57b19e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c
@@ -27,10 +27,6 @@ void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
- if (!pTDFX->syncDone) {
- TDFXFirstSync(pScrn);
- return;
- }
pTDFX=TDFXPTR(pScrn);
TDFXAllocateSlots(pTDFX, 2);
SET_3DPK4_HEADER(1, 0x48<<3);
@@ -42,6 +38,10 @@ void TDFXSendNOPPrivate2D(ScrnInfoPtr pScrn)
TDFXPtr pTDFX;
pTDFX=TDFXPTR(pScrn);
+ if (!pTDFX->syncDone) {
+ TDFXFirstSync(pScrn);
+ return;
+ }
TDFXAllocateSlots(pTDFX, 2);
SET_PKT2_HEADER(SSTCP_COMMAND);
WRITE_FIFO(pTDFX, SST_2D_COMMAND, SST_2D_NOP|SST_2D_GO);
@@ -332,6 +332,9 @@ TDFXAllocateSlots(TDFXPtr pTDFX, int slots)
#ifdef TDFX_DEBUG_FIFO
if (pTDFX->fifoEnd-pTDFX->fifoPtr<pTDFX->fifoSlots)
ErrorF("FIFO overrun\n");
+ if (!pTDFX->syncDone) {
+ ErrorF("Writing to FIFO without sync\n");
+ }
#endif
pTDFX->fifoSlots-=slots;
if (pTDFX->fifoSlots<0) TDFXMakeSpace(pTDFX, slots);