summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:49:00 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:49:00 +0000
commita7ec7f5767b9fc20fc173d2f173f3826d20010cd (patch)
tree78cbc25ee2ea356f3e73deafa981bb6c411a8b59
parentc4dd1bf20f2bae6d34db059ae47f053012d8a822 (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branchXEVIE-BASE
-rw-r--r--src/tdfx_dri.c14
-rw-r--r--src/tdfx_driver.c146
-rw-r--r--src/tdfx_video.c160
-rw-r--r--src/tdfxdefs.h3
4 files changed, 112 insertions, 211 deletions
diff --git a/src/tdfx_dri.c b/src/tdfx_dri.c
index 0df0b43..f276994 100644
--- a/src/tdfx_dri.c
+++ b/src/tdfx_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.25 2003/02/08 21:26:59 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.26 2003/09/28 20:16:01 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -116,10 +116,10 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].auxBuffers = 0;
pConfigs[i].level = 0;
if (stencil || accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ pConfigs[i].visualRating = GLX_SLOW_CONFIG;
else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
+ pConfigs[i].visualRating = GLX_NONE;
+ pConfigs[i].transparentPixel = GLX_NONE;
pConfigs[i].transparentRed = 0;
pConfigs[i].transparentGreen = 0;
pConfigs[i].transparentBlue = 0;
@@ -211,10 +211,10 @@ TDFXInitVisualConfigs(ScreenPtr pScreen)
pConfigs[i].auxBuffers = 0;
pConfigs[i].level = 0;
if (accum)
- pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ pConfigs[i].visualRating = GLX_SLOW_CONFIG;
else
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
+ pConfigs[i].visualRating = GLX_NONE;
+ pConfigs[i].transparentPixel = GLX_NONE;
pConfigs[i].transparentRed = 0;
pConfigs[i].transparentGreen = 0;
pConfigs[i].transparentBlue = 0;
diff --git a/src/tdfx_driver.c b/src/tdfx_driver.c
index 0c0ce80..9987b52 100644
--- a/src/tdfx_driver.c
+++ b/src/tdfx_driver.c
@@ -27,7 +27,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.92 2002/11/25 14:05:00 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.105 2003/11/03 05:11:41 tsi Exp $ */
/*
* Authors:
@@ -88,7 +88,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "tdfx.h"
-#include "miscstruct.h"
+#include "regionstr.h"
#include "dixstruct.h"
#include "xf86xv.h"
@@ -129,8 +129,8 @@ static Bool TDFXSaveScreen(ScreenPtr pScreen, int mode);
static void TDFXFreeScreen(int scrnIndex, int flags);
/* Check if a mode is valid on the hardware */
-static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool
- verbose, int flags);
+static ModeStatus TDFXValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
static void TDFXBlockHandler(int, pointer, pointer, pointer);
@@ -485,8 +485,8 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
/* Some information about the timing register (for later debugging) */
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DRAMINIT1 read 0x%x, programming 0x%x (not Banshee)\n",
- pTDFX->readLong(pTDFX, DRAMINIT1), dramInit1);
+ "DRAMINIT1 read 0x%x, programming 0x%lx (not Banshee)\n",
+ pTDFX->readLong(pTDFX, DRAMINIT1), (unsigned long)dramInit1);
/*
* Here we don't whack the timing register on the Banshee boards as the
@@ -513,7 +513,7 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
} else if ( (dramInit0_strap & SST_SGRAM_TYPE) == SST_SGRAM_TYPE_16MBIT) {
partSize = 16;
} else {
- ErrorF("Invalid sgram type = 0x%x",
+ ErrorF("Invalid sgram type = 0x%lx",
(dramInit0_strap & SST_SGRAM_TYPE) << SST_SGRAM_TYPE_SHIFT );
return 0;
}
@@ -525,8 +525,10 @@ TDFXCountRam(ScrnInfoPtr pScrn) {
banks=((dramInit0_strap&BIT(30))==0) ? 2 : 4;
vmemSize=nChips*partSize*banks;
}
- TDFXTRACEREG("dramInit0 = %x dramInit1 = %x\n", dramInit0_strap, dramInit1_strap);
- TDFXTRACEREG("MemConfig %d chips %d size %d total\n", nChips, partSize, vmemSize);
+ TDFXTRACEREG("dramInit0 = %lx dramInit1 = %lx\n",
+ (unsigned long)dramInit0_strap, (unsigned long)dramInit1_strap);
+ TDFXTRACEREG("MemConfig %d chips %ld size %ld total\n", (int)nChips,
+ (unsigned long)partSize, (unsigned long)vmemSize);
/*
disable block writes for SDRAM
@@ -598,8 +600,12 @@ static void
TDFXInitChips(ScrnInfoPtr pScrn)
{
TDFXPtr pTDFX;
- int i, v, cfgbits, initbits;
- int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits;
+ int i;
+#if 0
+ int v;
+#endif
+ unsigned long cfgbits, initbits;
+ unsigned long mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits;
pTDFX=TDFXPTR(pScrn);
cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE);
@@ -630,8 +636,8 @@ TDFXInitChips(ScrnInfoPtr pScrn)
for (i=0; i<pTDFX->numChips; i++) {
initbits|=BIT(10);
pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits);
- v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
#if 0
+ v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND);
if (!i)
pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3);
else
@@ -743,38 +749,24 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
* not sure if they are disabled.
*/
xf86SetOperatingState(resVgaIo, pTDFX->pEnt->index, ResDisableOpr);
-#if 0
- pScrn->racIoFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
- pScrn->racMemFlags = RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
-#endif
-#if 0
-#if 1
/* Is VGA memory disabled during OPERATING state? */
-
- xf86SetOperatingState(resVgaMem, pTDFX->pEnt->index, ResDisableOpr);
-#else
- pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
-#endif
-#endif
-
-#if 1
+ xf86SetOperatingState(resVgaMem, pTDFX->pEnt->index, ResUnusedOpr);
/*
* I'm sure we don't need to set these. All resources
* for these operations are exclusive.
*/
if (pTDFX->usePIO) {
- pScrn->racMemFlags = RAC_FB;
+ pScrn->racMemFlags = 0;
pScrn->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
} else
- pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT;
-#endif
+ pScrn->racMemFlags = 0;
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
flags24=Support24bppFb | Support32bppFb | SupportConvert32to24;
- if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) {
+ if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) {
return FALSE;
} else {
switch (pScrn->depth) {
@@ -902,7 +894,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
/* Multiple by two because tiled access requires more address space */
pTDFX->FbMapSize = pScrn->videoRam*1024*2;
- xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte Mapping %d kByte\n",
+ xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte Mapping %ld kByte\n",
pScrn->videoRam, pTDFX->FbMapSize/1024);
/* Since we can do gamma correction, we call xf86SetGamma */
@@ -961,7 +953,18 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->minClock= 12000; /* !!! What's the min clock? !!! */
clockRanges->maxClock=pTDFX->MaxClock;
clockRanges->clockIndex = -1;
- clockRanges->interlaceAllowed = FALSE;
+ switch (pTDFX->ChipType) {
+ case PCI_CHIP_BANSHEE:
+ clockRanges->interlaceAllowed = FALSE;
+ break;
+ case PCI_CHIP_VOODOO3:
+ case PCI_CHIP_VOODOO5:
+ clockRanges->interlaceAllowed = TRUE;
+ break;
+ default:
+ clockRanges->interlaceAllowed = FALSE;
+ break;
+ }
clockRanges->doubleScanAllowed = TRUE;
/*
@@ -991,7 +994,7 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
+ xf86SetCrtcForModes(pScrn, 0);
pScrn->currentMode = pScrn->modes;
@@ -1095,7 +1098,14 @@ TDFXPreInit(ScrnInfoPtr pScrn, int flags)
pTDFX->writeLong(pTDFX, MISCINIT0, pTDFX->ModeReg.miscinit0);
#endif
-
+#ifdef XF86DRI
+ /* Load the dri module if requested. */
+ if (xf86ReturnOptValBool(pTDFX->Options, OPTION_DRI, FALSE)) {
+ if (xf86LoadSubModule(pScrn, "dri")) {
+ xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
+ }
+ }
+#endif
return TRUE;
}
@@ -1612,8 +1622,8 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) {
TDFXPtr pTDFX;
TDFXRegPtr tdfxReg;
vgaRegPtr pVga;
- int hbs, hbe, vbs, vbe, hse, wd;
- int hd, hss, ht, vss, vt, vd, vse;
+ int hbs, hbe, vbs, vbe, hse;
+ int hd, hss, ht, vt, vd;
TDFXTRACE("TDFXSetMode start\n");
@@ -1621,11 +1631,6 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) {
tdfxReg = &pTDFX->ModeReg;
pVga = &VGAHWPTR(pScrn)->ModeReg;
- if (pTDFX->cpp==4)
- wd = pScrn->displayWidth>>1;
- else
- wd = pScrn->displayWidth>>(4-pTDFX->cpp);
-
/* Tell the board we're using a programmable clock */
pVga->MiscOutReg |= 0xC;
@@ -1638,8 +1643,6 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) {
hbe = (mode->CrtcHBlankEnd>>3)-1;
vd = mode->CrtcVDisplay-1;
- vss = mode->CrtcVSyncStart;
- vse = mode->CrtcVSyncEnd;
vt = mode->CrtcVTotal-2;
vbs = mode->CrtcVBlankStart-1;
vbe = mode->CrtcVBlankEnd-1;
@@ -1667,6 +1670,10 @@ TDFXSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) {
tdfxReg->screensize=mode->HDisplay|(mode->VDisplay<<12);
tdfxReg->vidcfg &= ~SST_HALF_MODE;
}
+ if (mode->Flags&V_INTERLACE) {
+ tdfxReg->vidcfg|=SST_INTERLACE;
+ } else
+ tdfxReg->vidcfg&=~SST_INTERLACE;
TDFXTRACEREG("cpp=%d Hdisplay=%d Vdisplay=%d stride=%d screensize=%x\n",
pTDFX->cpp, mode->HDisplay, mode->VDisplay, tdfxReg->stride,
@@ -2221,6 +2228,21 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
xf86DPMSInit(pScreen, TDFXDisplayPowerManagementSet, 0);
+ /* Initialize Xv support */
+ TDFXInitVideo (pScreen);
+
+ pScreen->SaveScreen = TDFXSaveScreen;
+ pTDFX->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = TDFXCloseScreen;
+
+ pTDFX->BlockHandler = pScreen->BlockHandler;
+ pScreen->BlockHandler = TDFXBlockHandler;
+
+ /*
+ * DRICloseScreen isn't called thru a wrapper but explicitely
+ * in of TDFXCloseScreen() before the rest is unwrapped
+ */
+
#ifdef XF86DRI
if (pTDFX->directRenderingEnabled) {
/* Now that mi, fb, drm and others have done their thing,
@@ -2235,19 +2257,6 @@ TDFXScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
}
#endif
-
-#ifdef XvExtension
- /* Initialize Xv support */
- TDFXInitVideo (pScreen);
-#endif
-
- pScreen->SaveScreen = TDFXSaveScreen;
- pTDFX->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = TDFXCloseScreen;
-
- pTDFX->BlockHandler = pScreen->BlockHandler;
- pScreen->BlockHandler = TDFXBlockHandler;
-
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
@@ -2390,14 +2399,31 @@ TDFXFreeScreen(int scrnIndex, int flags) {
vgaHWFreeHWRec(xf86Screens[scrnIndex]);
}
-static int
+static ModeStatus
TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) {
+ ScrnInfoPtr pScrn;
+ TDFXPtr pTDFX;
+
TDFXTRACE("TDFXValidMode start\n");
if ((mode->HDisplay>2048) || (mode->VDisplay>1536))
return MODE_BAD;
- /* Banshee doesn't support interlace. Does V3? */
- if (mode->Flags&V_INTERLACE)
- return MODE_BAD;
+ /* Banshee doesn't support interlace, but Voodoo 3 and higher do. */
+ pScrn = xf86Screens[scrnIndex];
+ pTDFX = TDFXPTR(pScrn);
+ if (mode->Flags&V_INTERLACE) {
+ switch (pTDFX->ChipType) {
+ case PCI_CHIP_BANSHEE:
+ return MODE_BAD;
+ break;
+ case PCI_CHIP_VOODOO3:
+ case PCI_CHIP_VOODOO5:
+ return MODE_OK;
+ break;
+ default:
+ return MODE_BAD;
+ break;
+ }
+ }
/* In clock doubled mode widths must be divisible by 16 instead of 8 */
if ((mode->Clock>TDFX2XCUTOFF) && (mode->HDisplay%16))
return MODE_BAD;
diff --git a/src/tdfx_video.c b/src/tdfx_video.c
index 8d90c1f..496eb54 100644
--- a/src/tdfx_video.c
+++ b/src/tdfx_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.16 2002/10/17 01:02:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.21 2003/11/10 18:22:34 tsi Exp $ */
#include "xf86.h"
#include "tdfx.h"
@@ -35,9 +35,6 @@ static Atom xvColorKey, xvFilterQuality;
#define GET_PORT_PRIVATE(pScrn) \
(TDFXPortPrivPtr)((TDFXPTR(pScrn))->overlayAdaptor->pPortPrivates[0].ptr)
-/* Doesn't matter what screen we use */
-#define DummyScreen screenInfo.screens[0]
-
/* Needed for attribute atoms */
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -132,9 +129,6 @@ void TDFXInitVideo(ScreenPtr pScreen)
if(pTDFX->cpp == 1)
return;
- if(!pTDFX->AccelInfoRec || !pTDFX->AccelInfoRec->FillSolidRects)
- return;
-
if (!pTDFX->TextureXvideo) {
/* Offscreen support for Overlay only */
TDFXInitOffscreenImages(pScreen);
@@ -245,7 +239,7 @@ TDFXSetupImageVideoOverlay(ScreenPtr pScreen)
pTDFX->overlayAdaptor = adapt;
pPriv = (TDFXPortPrivPtr)(adapt->pPortPrivates[0].ptr);
- REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0);
+ REGION_NULL(pScreen, &(pPriv->clip));
TDFXResetVideoOverlay(pScrn);
@@ -264,7 +258,7 @@ TDFXSetupImageVideoTexture(ScreenPtr pScreen)
return NULL;
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
- adapt->flags = 0;
+ adapt->flags = VIDEO_OVERLAID_IMAGES;
adapt->name = "3dfx Video Texture";
adapt->nPorts = TDFX_MAX_TEXTURE_PORTS;
adapt->nEncodings = sizeof(TextureEncoding) / sizeof(XF86VideoEncodingRec);
@@ -299,85 +293,6 @@ TDFXSetupImageVideoTexture(ScreenPtr pScreen)
* MISCELLANEOUS ROUTINES
*/
-static Bool
-TDFXClipVideo(
- BoxPtr dst,
- INT32 *xa,
- INT32 *xb,
- INT32 *ya,
- INT32 *yb,
- RegionPtr reg,
- INT32 width,
- INT32 height
-){
- INT32 vscale, hscale, delta;
- BoxPtr extents = REGION_EXTENTS(DummyScreen, reg);
- int diff;
-
- hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1);
- vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1);
-
- *xa <<= 16; *xb <<= 16;
- *ya <<= 16; *yb <<= 16;
-
- diff = extents->x1 - dst->x1;
- if(diff > 0) {
- dst->x1 = extents->x1;
- *xa += diff * hscale;
- }
- diff = dst->x2 - extents->x2;
- if(diff > 0) {
- dst->x2 = extents->x2;
- *xb -= diff * hscale;
- }
- diff = extents->y1 - dst->y1;
- if(diff > 0) {
- dst->y1 = extents->y1;
- *ya += diff * vscale;
- }
- diff = dst->y2 - extents->y2;
- if(diff > 0) {
- dst->y2 = extents->y2;
- *yb -= diff * vscale;
- }
-
- if(*xa < 0) {
- diff = (- *xa + hscale - 1)/ hscale;
- dst->x1 += diff;
- *xa += diff * hscale;
- }
- delta = *xb - (width << 16);
- if(delta > 0) {
- diff = (delta + hscale - 1)/ hscale;
- dst->x2 -= diff;
- *xb -= diff * hscale;
- }
- if(*xa >= *xb) return FALSE;
-
- if(*ya < 0) {
- diff = (- *ya + vscale - 1)/ vscale;
- dst->y1 += diff;
- *ya += diff * vscale;
- }
- delta = *yb - (height << 16);
- if(delta > 0) {
- diff = (delta + vscale - 1)/ vscale;
- dst->y2 -= diff;
- *yb -= diff * vscale;
- }
- if(*ya >= *yb) return FALSE;
-
- if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) ||
- (dst->y1 != extents->y1) || (dst->y2 != extents->y2))
- {
- RegionRec clipReg;
- REGION_INIT(DummyScreen, &clipReg, dst, 1);
- REGION_INTERSECT(DummyScreen, reg, reg, &clipReg);
- REGION_UNINIT(DummyScreen, &clipReg);
- }
- return TRUE;
-}
-
static int
TDFXQueryImageAttributes(
ScrnInfoPtr pScrn,
@@ -592,9 +507,6 @@ static void
TDFXStopVideoTexture(ScrnInfoPtr pScrn, pointer data, Bool cleanup)
{
TDFXPtr pTDFX = TDFXPTR(pScrn);
- TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data;
-
- REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
if (cleanup) {
if(pTDFX->textureBuffer) {
@@ -622,6 +534,7 @@ TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn,
INT32 src_h = (src_y2 - src_y1) & 0x1FFF;
INT32 dst_w = (dst_x2 - dst_x1) & 0x1FFF;
INT32 dst_h = (dst_y2 - dst_y1) & 0x1FFF;
+
/* Setup for blit src and dest */
TDFXMakeRoom(pTDFX, 4);
DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY|SSTCP_COMMAND/*|SSTCP_COMMANDEXTRA*/);
@@ -766,39 +679,6 @@ TDFXPutImageTexture(
/*
- * COMMON DRAWING FUNCTIONS
- */
-
-static Bool
-RegionsEqual(RegionPtr A, RegionPtr B)
-{
- int *dataA, *dataB;
- int num;
-
- num = REGION_NUM_RECTS(A);
- if(num != REGION_NUM_RECTS(B))
- return FALSE;
-
- if((A->extents.x1 != B->extents.x1) ||
- (A->extents.x2 != B->extents.x2) ||
- (A->extents.y1 != B->extents.y1) ||
- (A->extents.y2 != B->extents.y2))
- return FALSE;
-
- dataA = (int*)REGION_RECTS(A);
- dataB = (int*)REGION_RECTS(B);
-
- while(num--) {
- if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
- return FALSE;
- dataA += 2;
- dataB += 2;
- }
-
- return TRUE;
-}
-
-/*
* OVERLAY DRAWING FUNCTIONS
*/
@@ -916,7 +796,8 @@ TDFXDisplayVideoOverlay(
int dudx, dvdy;
dudx = (src_w << 20) / drw_w;
- dvdy = (src_h << 20) / drw_h;
+ /* subract 1 to eliminate garbage on last line */
+ dvdy = (( src_h - 1 )<< 20) / drw_h;
offset += ((left >> 16) & ~1) << 1;
left = (left & 0x0001ffff) << 3;
@@ -946,7 +827,7 @@ TDFXDisplayVideoOverlay(
pTDFX->writeLong(pTDFX, VIDDESKTOPOVERLAYSTRIDE, pTDFX->ModeReg.stride);
pTDFX->writeLong(pTDFX, SST_3D_LEFTOVERLAYBUF, offset & ~3);
pTDFX->writeLong(pTDFX, VIDINADDR0, offset & ~3);
- TDFXTRACE("TDFXDisplayVideoOverlay: done, offset=0x%x\n");
+ TDFXTRACE("TDFXDisplayVideoOverlay: done, offset=0x%x\n", offset);
}
@@ -1008,7 +889,7 @@ TDFXPutImageOverlay(
TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data;
INT32 xa, xb, ya, yb;
unsigned char *dst_start;
- int pitch, new_size, offset;
+ int new_size, offset;
int s2offset = 0, s3offset = 0;
int srcPitch = 0, srcPitch2 = 0;
int dstPitch;
@@ -1044,7 +925,8 @@ TDFXPutImageOverlay(
dstBox.y1 = drw_y;
dstBox.y2 = drw_y + drw_h;
- if(!TDFXClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height))
+ if(!xf86XVClipVideoHelper(&dstBox, &xa, &xb, &ya, &yb,
+ clipBoxes, width, height))
return Success;
dstBox.x1 -= pScrn->frameX0;
@@ -1053,7 +935,6 @@ TDFXPutImageOverlay(
dstBox.y2 -= pScrn->frameY0;
bpp = pScrn->bitsPerPixel >> 3;
- pitch = bpp * pScrn->displayWidth;
switch(id) {
case FOURCC_YV12:
@@ -1129,12 +1010,9 @@ TDFXPutImageOverlay(
break;
}
- if(!RegionsEqual(&pPriv->clip, clipBoxes)) {
- REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
- (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey,
- GXcopy, ~0,
- REGION_NUM_RECTS(clipBoxes),
- REGION_RECTS(clipBoxes));
+ if(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) {
+ REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
+ xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
}
TDFXDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h);
@@ -1285,7 +1163,7 @@ TDFXAllocateSurface(
){
TDFXPtr pTDFX = TDFXPTR(pScrn);
FBLinearPtr linear;
- int pitch, fbpitch, size, bpp;
+ int pitch, size, bpp;
OffscreenPrivPtr pPriv;
if((w > 2048) || (h > 2048))
@@ -1294,7 +1172,6 @@ TDFXAllocateSurface(
w = (w + 1) & ~1;
pitch = ((w << 1) + 15) & ~15;
bpp = pScrn->bitsPerPixel >> 3;
- fbpitch = bpp * pScrn->displayWidth;
size = ((pitch * h) + bpp - 1) / bpp;
if(!(linear = TDFXAllocateMemoryLinear(pScrn, NULL, size)))
@@ -1410,8 +1287,8 @@ TDFXDisplaySurface(
dstBox.y1 = drw_y;
dstBox.y2 = drw_y + drw_h;
- if(!TDFXClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes,
- surface->width, surface->height))
+ if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes,
+ surface->width, surface->height))
{
return Success;
}
@@ -1429,10 +1306,7 @@ TDFXDisplaySurface(
surface->width, surface->height, surface->pitches[0],
x1, y1, x2, &dstBox, src_w, src_h, drw_w, drw_h);
- (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, portPriv->colorKey,
- GXcopy, ~0,
- REGION_NUM_RECTS(clipBoxes),
- REGION_RECTS(clipBoxes));
+ xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes);
pPriv->isOn = TRUE;
/* we've prempted the XvImage stream so set its free timer */
diff --git a/src/tdfxdefs.h b/src/tdfxdefs.h
index a9ef1df..b9c01ce 100644
--- a/src/tdfxdefs.h
+++ b/src/tdfxdefs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.13 2002/10/17 01:02:08 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.14 2003/06/18 16:17:41 eich Exp $ */
/*
Voodoo Banshee driver version 1.0.1
@@ -45,6 +45,7 @@
#define SST_DESKTOP_EN BIT(7)
#define SST_DESKTOP_PIXEL_FORMAT_SHIFT 18
#define SST_DESKTOP_CLUT_BYPASS BIT(10)
+#define SST_INTERLACE BIT(3)
#define SST_HALF_MODE BIT(4)
#define SST_CURSOR_EN BIT(27)
#define SST_FBI_BUSY BIT(7)