summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkeithw <keithw>2000-02-12 01:33:23 +0000
committerkeithw <keithw>2000-02-12 01:33:23 +0000
commit9fa929afe029fa3216515da345cec01fa84ee3d8 (patch)
tree80005cfc88936fc3e35046cb6457e8d23cfd79a7
parentaa84f69d1822425e7455b448ec3c8117d21d8289 (diff)
Implemented selectbuffer/movebuffers
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c21
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c45
3 files changed, 47 insertions, 21 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
index 0bc95270c..4bacad446 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
@@ -269,7 +269,7 @@ void MGADRICloseScreen(ScreenPtr pScreen);
Bool MGADRIFinishScreenInit(ScreenPtr pScreen);
void MGASwapContext(ScreenPtr pScreen);
void MGALostContext(ScreenPtr pScreen);
-void MGASelectBuffer(MGAPtr pMGA, int which);
+void MGASelectBuffer(ScrnInfoPtr pScrn, int which);
Bool mgaConfigureWarp(ScrnInfoPtr pScrn);
unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset);
unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
index a7042a4b0..6ba277359 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -447,7 +447,7 @@ Bool MGADRIScreenInit(ScreenPtr pScreen)
* memory for the hardware cursor.
*/
pMGADRI->textureSize = pMGA->FbUsableSize - pMGADRI->textureOffset;
- pMGADRI->frontOffset = pMGA->YDstOrg * (pScrn->bitsPerPixel / 8);
+ pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */
pMGADRI->mAccess = pMGA->MAccess;
i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS);
@@ -666,7 +666,22 @@ MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
}
}
-/* Needs to be written */
-void MGASelectBuffer(MGAPtr pMGA, int which)
+void
+MGASelectBuffer(ScrnInfoPtr pScrn, int which)
{
+ MGAPtr pMga = MGAPTR(pScrn);
+ MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate;
+
+ switch (which) {
+ case MGA_BACK:
+ OUTREG(MGAREG_DSTORG, pMGADRI->backOffset);
+ break;
+ case MGA_DEPTH:
+ OUTREG(MGAREG_DSTORG, pMGADRI->depthOffset);
+ break;
+ default:
+ case MGA_FRONT:
+ OUTREG(MGAREG_DSTORG, pMGADRI->frontOffset);
+ break;
+ }
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
index 09f334169..cffbfa763 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
@@ -1969,15 +1969,15 @@ MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index)
MGANAME(SetupForSolidFill)(pScrn, 0, GXcopy, -1);
while (nbox--) {
- MGASelectBuffer(pMGA, MGA_BACK);
+ MGASelectBuffer(pScrn, MGA_BACK);
MGANAME(SubsequentSolidFillRect)(pScrn, pbox->x1, pbox->y1,
pbox->x2-pbox->x1, pbox->y2-pbox->y1);
- MGASelectBuffer(pMGA, MGA_DEPTH);
+ MGASelectBuffer(pScrn, MGA_DEPTH);
MGANAME(SubsequentSolidFillRect)(pScrn, pbox->x1, pbox->y1,
pbox->x2-pbox->x1, pbox->y2-pbox->y1);
pbox++;
}
- MGASelectBuffer(pMGA, MGA_FRONT);
+ MGASelectBuffer(pScrn, MGA_FRONT);
pMGA->AccelInfoRec->NeedToSync = TRUE;
}
@@ -1993,7 +1993,6 @@ void
MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
-#if 0
ScreenPtr pScreen = pParent->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
MGAPtr pMGA = MGAPTR(pScrn);
@@ -2001,9 +2000,12 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
DDXPointPtr pptTmp, pptNew1, pptNew2;
int xdir, ydir;
- int dx, dy, w, h;
+ int dx, dy;
DDXPointPtr pptSrc;
+ int screenwidth = pScrn->virtualX;
+ int screenheight = pScrn->virtualY;
+
pbox = REGION_RECTS(prgnSrc);
nbox = REGION_NUM_RECTS(prgnSrc);
pboxNew1 = 0;
@@ -2090,18 +2092,28 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
}
MGANAME(SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, -1, -1);
- while (nbox--) {
- w=pbox->x2-pbox->x1+1;
- h=pbox->y2-pbox->y1+1;
- MGASelectBuffer(pMGA, MGA_BACK);
- MGANAME(SubsequentScreenToScreenCopy)(pScrn, pbox->x1, pbox->y1,
- pbox->x1+dx, pbox->y1+dy, w, h);
- MGASelectBuffer(pMGA, MGA_DEPTH);
- MGANAME(SubsequentScreenToScreenCopy)(pScrn, pbox->x1, pbox->y1,
- pbox->x1+dx, pbox->y1+dy, w, h);
- pbox++;
+ for ( ; nbox-- ; pbox++)
+ {
+ int x1 = pbox->x1;
+ int y1 = pbox->y1;
+ int destx = x1 + dx;
+ int desty = y1 + dy;
+ int w = pbox->x2 - x1 + 1;
+ int h = pbox->y2 - y1 + 1;
+
+ if ( destx < 0 ) w += destx, destx = 0;
+ if ( desty < 0 ) h += desty, desty = 0;
+ if ( destx + w > screenwidth ) w = screenwidth - destx;
+ if ( desty + h > screenheight ) h = screenheight - desty;
+ if ( w <= 0 ) continue;
+ if ( h <= 0 ) continue;
+
+ MGASelectBuffer(pScrn, MGA_BACK);
+ MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, destx,desty, w, h);
+ MGASelectBuffer(pScrn, MGA_DEPTH);
+ MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, destx,desty, w, h);
}
- MGASelectBuffer(pMGA, MGA_FRONT);
+ MGASelectBuffer(pScrn, MGA_FRONT);
if (pboxNew2) {
DEALLOCATE_LOCAL(pptNew2);
@@ -2113,7 +2125,6 @@ MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg,
}
pMGA->AccelInfoRec->NeedToSync = TRUE;
-#endif
}
#endif /* XF86DRI */