diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:34:01 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-09-15 16:34:01 +0000 |
commit | 26f276bb2fe9d2a38b52968b0604b1b184e95329 (patch) | |
tree | a0cb4a8a3b30123b2d20fd2cb18aa6bfb37eeb9c /src/i830_accel.c | |
parent | 4db974c9e502fc406973b1d426aeec5a69386932 (diff) |
Pull XORG-6_8_0 to CYGWIN branchCYGWIN-6_8_1-MERGECYGWIN-6_8_0-MERGE
Diffstat (limited to 'src/i830_accel.c')
-rw-r--r-- | src/i830_accel.c | 106 |
1 files changed, 83 insertions, 23 deletions
diff --git a/src/i830_accel.c b/src/i830_accel.c index 64cf365a..d6c2d384 100644 --- a/src/i830_accel.c +++ b/src/i830_accel.c @@ -63,7 +63,7 @@ int I830WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis) { I830Ptr pI830 = I830PTR(pScrn); - I830RingBuffer *ring = &(pI830->LpRing); + I830RingBuffer *ring = pI830->LpRing; int iters = 0; int start = 0; int now = 0; @@ -141,6 +141,8 @@ I830Sync(ScrnInfoPtr pScrn) } #endif + if (pI830->entityPrivate && !pI830->entityPrivate->RingRunning) return; + /* Send a flush instruction and then wait till the ring is empty. * This is stronger than waiting for the blitter to finish as it also * flushes the internal graphics caches. @@ -152,9 +154,9 @@ I830Sync(ScrnInfoPtr pScrn) ADVANCE_LP_RING(); } - I830WaitLpRing(pScrn, pI830->LpRing.mem.Size - 8, 0); + I830WaitLpRing(pScrn, pI830->LpRing->mem.Size - 8, 0); - pI830->LpRing.space = pI830->LpRing.mem.Size - 8; + pI830->LpRing->space = pI830->LpRing->mem.Size - 8; pI830->nextColorExpandBuf = 0; } @@ -185,7 +187,7 @@ I830SelectBuffer(ScrnInfoPtr pScrn, int buffer) #endif default: case I830_SELECT_FRONT: - pI830->bufferOffset = pI830->FrontBuffer.Start; + pI830->bufferOffset = pScrn->fbOffset; break; } @@ -199,11 +201,11 @@ I830RefreshRing(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - pI830->LpRing.head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; - pI830->LpRing.tail = INREG(LP_RING + RING_TAIL); - pI830->LpRing.space = pI830->LpRing.head - (pI830->LpRing.tail + 8); - if (pI830->LpRing.space < 0) - pI830->LpRing.space += pI830->LpRing.mem.Size; + pI830->LpRing->head = INREG(LP_RING + RING_HEAD) & I830_HEAD_MASK; + pI830->LpRing->tail = INREG(LP_RING + RING_TAIL); + pI830->LpRing->space = pI830->LpRing->head - (pI830->LpRing->tail + 8); + if (pI830->LpRing->space < 0) + pI830->LpRing->space += pI830->LpRing->mem.Size; if (pI830->AccelInfoRec) pI830->AccelInfoRec->NeedToSync = TRUE; @@ -242,6 +244,7 @@ static void I830SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int skipleft); static void I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); #endif +static void I830RestoreAccelState(ScrnInfoPtr pScrn); /* The following function sets up the supported acceleration. Call it @@ -254,6 +257,10 @@ I830AccelInit(ScreenPtr pScreen) XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); + int i; + int width = 0; + int nr_buffers = 0; + unsigned char *ptr = NULL; if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) ErrorF("I830AccelInit\n"); @@ -297,12 +304,26 @@ I830AccelInit(ScreenPtr pScreen) } - if (pI830->Scratch.Size != 0) { - int i; - int width = ((pScrn->displayWidth + 31) & ~31) / 8; - int nr_buffers = pI830->Scratch.Size / width; - unsigned char *ptr = pI830->FbBase + pI830->Scratch.Start; + /* On the primary screen */ + if (pI830->init == 0) { + if (pI830->Scratch.Size != 0) { + width = ((pScrn->displayWidth + 31) & ~31) / 8; + nr_buffers = pI830->Scratch.Size / width; + ptr = pI830->FbBase + pI830->Scratch.Start; + } + } else { + /* On the secondary screen */ + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + if (pI8301->Scratch2.Size != 0) { + width = ((pScrn->displayWidth + 31) & ~31) / 8; + nr_buffers = pI8301->Scratch2.Size / width; + /* We have to use the primary screen's FbBase, as that's where + * we allocated Scratch2, so we get the correct pointer */ + ptr = pI8301->FbBase + pI8301->Scratch2.Start; + } + } + if (nr_buffers) { pI830->NumScanlineColorExpandBuffers = nr_buffers; pI830->ScanlineColorExpandBuffers = (unsigned char **) xnfcalloc(nr_buffers, sizeof(unsigned char *)); @@ -344,6 +365,18 @@ I830AccelInit(ScreenPtr pScreen) #endif } + { + Bool shared_accel = FALSE; + int i; + + for(i = 0; i < pScrn->numEntities; i++) { + if(xf86IsEntityShared(pScrn->entityList[i])) + shared_accel = TRUE; + } + if(shared_accel == TRUE) + infoPtr->RestoreAccelState = I830RestoreAccelState; + } + I830SelectBuffer(pScrn, I830_SELECT_FRONT); return XAAInit(pScreen, infoPtr); @@ -359,7 +392,7 @@ I830SetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, ErrorF("I830SetupForFillRectSolid color: %x rop: %x mask: %x\n", color, rop, planemask); - pI830->BR[13] = ((XAAPatternROP[rop] << 16) | + pI830->BR[13] = ((XAAGetPatternROP(rop) << 16) | (pScrn->displayWidth * pI830->cpp)); pI830->BR[16] = color; @@ -415,7 +448,7 @@ I830SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, xdir, ydir, rop, planemask, transparency_color); pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAACopyROP[rop] << 16; + pI830->BR[13] |= XAAGetCopyROP(rop) << 16; switch (pScrn->bitsPerPixel) { case 8: @@ -481,7 +514,7 @@ I830SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int pattx, int patty, pI830->BR[19] = fg; pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); /* In bytes */ - pI830->BR[13] |= XAAPatternROP[rop] << 16; + pI830->BR[13] |= XAAGetPatternROP(rop) << 16; if (bg == -1) pI830->BR[13] |= (1 << 28); @@ -570,7 +603,7 @@ I830SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, /* Fill out register values */ pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAACopyROP[rop] << 16; + pI830->BR[13] |= XAAGetCopyROP(rop) << 16; if (bg == -1) pI830->BR[13] |= (1 << 29); @@ -613,8 +646,17 @@ I830SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { I830Ptr pI830 = I830PTR(pScrn); - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); + if (pI830->init == 0) { + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI830->FbBase); + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + + /* We have to use the primary screen's FbBase, as that's where + * we allocated Scratch2, so we get the correct pointer */ + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI8301->FbBase); + } if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) ErrorF("I830SubsequentColorExpandScanline %d (addr %x)\n", @@ -659,7 +701,7 @@ I830SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, /* Fill out register values */ pI830->BR[13] = (pScrn->displayWidth * pI830->cpp); - pI830->BR[13] |= XAACopyROP[rop] << 16; + pI830->BR[13] |= XAAGetCopyROP(rop) << 16; switch (pScrn->bitsPerPixel) { case 8: @@ -696,8 +738,17 @@ I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) { I830Ptr pI830 = I830PTR(pScrn); - pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - - pI830->FbBase); + if (pI830->init == 0) { + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI830->FbBase); + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + + /* We have to use the primary screen's FbBase, as that's where + * we allocated Scratch2, so we get the correct pointer */ + pI830->BR[12] = (pI830->AccelInfoRec->ScanlineColorExpandBuffers[0] - + pI8301->FbBase); + } if (I810_DEBUG & DEBUG_VERBOSE_ACCEL) ErrorF("I830SubsequentImageWriteScanline %d (addr %x)\n", @@ -728,5 +779,14 @@ I830SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) pI830->BR[9] += pScrn->displayWidth * pI830->cpp; I830GetNextScanlineColorExpandBuffer(pScrn); } +#endif +/* Support for multiscreen */ +static void +I830RestoreAccelState(ScrnInfoPtr pScrn) +{ +#if 0 + /* might be needed, but everything is on a ring, so I don't think so */ + I830Sync(pScrn); #endif +} |