From d290e49ae8fc6bbb137f2ceef216662ef248e7f5 Mon Sep 17 00:00:00 2001 From: Deron Johnson Date: Thu, 6 Jan 2005 04:14:02 +0000 Subject: Integrate updates from Xorg 6.8.2 RC2. VS: ---------------------------------------------------------------------- --- src/common.h | 4 ++-- src/i810.h | 7 ++++--- src/i810_accel.c | 2 +- src/i810_dga.c | 2 +- src/i810_dri.c | 2 +- src/i810_driver.c | 17 ++++++++--------- src/i810_io.c | 2 +- src/i810_memory.c | 4 ++-- src/i810_reg.h | 4 ++-- src/i810_video.c | 34 +++++++++++++++++++++------------- src/i810_wmark.c | 2 +- src/i830.h | 12 ++++++------ src/i830_driver.c | 23 +++++++++++++---------- src/i830_memory.c | 24 ++++++++++++------------ 14 files changed, 75 insertions(+), 64 deletions(-) diff --git a/src/common.h b/src/common.h index 1b98d695..5d2ac521 100644 --- a/src/common.h +++ b/src/common.h @@ -173,7 +173,7 @@ extern void I830DPRINTF_stub(const char *filename, int line, #define BEGIN_LP_RING(n) \ unsigned int outring, ringmask; \ volatile unsigned char *virt; \ - unsigned int needed; \ + int needed; \ if ((n) & 1) \ ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ @@ -206,7 +206,7 @@ extern void I830DPRINTF_stub(const char *filename, int line, #define BEGIN_LP_RING(n) \ unsigned int outring, ringmask; \ volatile unsigned char *virt; \ - unsigned int needed; \ + int needed; \ if ((n) & 1) \ ErrorF("BEGIN_LP_RING called with odd argument: %d\n", n); \ if ((n) > 2 && (I810_DEBUG&DEBUG_ALWAYS_SYNC)) \ diff --git a/src/i810.h b/src/i810.h index 58345abc..18fefb67 100644 --- a/src/i810.h +++ b/src/i810.h @@ -172,7 +172,7 @@ typedef struct _I810Rec { unsigned long OverlayPhysical; unsigned long OverlayStart; int colorKey; - int surfaceAllocation[I810_TOTAL_SURFACES]; + unsigned int surfaceAllocation[I810_TOTAL_SURFACES]; int numSurfaces; DGAModePtr DGAModes; @@ -295,9 +295,10 @@ extern int I810WaitLpRing(ScrnInfoPtr pScrn, int n, int timeout_millis); extern void I810Sync(ScrnInfoPtr pScrn); extern unsigned long I810LocalToPhysical(ScrnInfoPtr pScrn, unsigned long local); -extern int I810AllocLow(I810MemRange * result, I810MemRange * pool, int size); +extern int I810AllocLow(I810MemRange * result, I810MemRange * pool, + int size); extern int I810AllocHigh(I810MemRange * result, I810MemRange * pool, - int size); + int size); extern Bool I810AllocateFront(ScrnInfoPtr pScrn); extern int I810AllocateGARTMemory(ScrnInfoPtr pScrn); diff --git a/src/i810_accel.c b/src/i810_accel.c index 2b0b594a..44d14e85 100644 --- a/src/i810_accel.c +++ b/src/i810_accel.c @@ -259,7 +259,7 @@ I810Sync(ScrnInfoPtr pScrn) #ifdef XF86DRI /* VT switching tries to do this. */ - if (!pI810->LockHeld && pI810->directRenderingEnabled) { + if ((!pI810->LockHeld && pI810->directRenderingEnabled) || !pScrn->vtSema) { return; } #endif diff --git a/src/i810_dga.c b/src/i810_dga.c index 0abac2bf..6450e49b 100644 --- a/src/i810_dga.c +++ b/src/i810_dga.c @@ -34,7 +34,7 @@ * with characters expanded at 8-column intervals. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.6 2003/02/26 04:19:36 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dga.c,v 1.5 2002/09/11 00:29:31 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" diff --git a/src/i810_dri.c b/src/i810_dri.c index 0750f3f8..3dcf5cdb 100644 --- a/src/i810_dri.c +++ b/src/i810_dri.c @@ -290,7 +290,7 @@ I810DRIScreenInit(ScreenPtr pScreen) unsigned long dcacheHandle; int sysmem_size = 0; int back_size = 0; - int pitch_idx = 0; + unsigned int pitch_idx = 0; int bufs; int width = pScrn->displayWidth * pI810->cpp; int i; diff --git a/src/i810_driver.c b/src/i810_driver.c index 8b09243d..b87ca6e9 100644 --- a/src/i810_driver.c +++ b/src/i810_driver.c @@ -1124,14 +1124,6 @@ I810PreInit(ScrnInfoPtr pScrn, int flags) xf86SetOperatingState(resVgaIo, pI810->pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMem, pI810->pEnt->index, ResDisableOpr); - pI810->LpRing = xalloc(sizeof(I810RingBuffer)); - if (!pI810->LpRing) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Could not allocate lpring data structure.\n"); - I810FreeRec(pScrn); - return FALSE; - } - return TRUE; } @@ -1159,7 +1151,7 @@ static Bool I810MapMem(ScrnInfoPtr pScrn) { I810Ptr pI810 = I810PTR(pScrn); - unsigned i; + long i; for (i = 2; i < pI810->FbMapSize; i <<= 1) ; pI810->FbMapSize = i; @@ -2074,6 +2066,13 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pI810 = I810PTR(pScrn); hwp = VGAHWPTR(pScrn); + pI810->LpRing = xcalloc(sizeof(I810RingBuffer),1); + if (!pI810->LpRing) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not allocate lpring data structure.\n"); + return FALSE; + } + miClearVisualTypes(); /* Re-implemented Direct Color support, -jens */ diff --git a/src/i810_io.c b/src/i810_io.c index de947dde..a2da7bf6 100644 --- a/src/i810_io.c +++ b/src/i810_io.c @@ -24,7 +24,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/i810/i810_io.c,v 1.5 2002/09/11 00:29:32 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_io.c,v 1.4 2002/01/25 21:56:04 tsi Exp $ */ /* * Reformatted with GNU indent (2.2.8), using the following options: diff --git a/src/i810_memory.c b/src/i810_memory.c index 8b899fbe..75ec2442 100644 --- a/src/i810_memory.c +++ b/src/i810_memory.c @@ -55,7 +55,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. int I810AllocLow(I810MemRange * result, I810MemRange * pool, int size) { - if (size > pool->Size) + if (size > (long)pool->Size) return 0; pool->Size -= size; @@ -69,7 +69,7 @@ I810AllocLow(I810MemRange * result, I810MemRange * pool, int size) int I810AllocHigh(I810MemRange * result, I810MemRange * pool, int size) { - if (size > pool->Size) + if (size > (long)pool->Size) return 0; pool->Size -= size; diff --git a/src/i810_reg.h b/src/i810_reg.h index eac71ba9..e52375f8 100644 --- a/src/i810_reg.h +++ b/src/i810_reg.h @@ -459,11 +459,11 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define I830_HEAD_MASK 0x001FFFFC #define RING_START 0x08 -#define START_ADDR 0x00FFFFF8 +#define START_ADDR 0x03FFFFF8 #define I830_RING_START_MASK 0xFFFFF000 #define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 +#define RING_NR_PAGES 0x001FF000 #define I830_RING_NR_PAGES 0x001FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 diff --git a/src/i810_video.c b/src/i810_video.c index 2855178c..8d2bdc9a 100644 --- a/src/i810_video.c +++ b/src/i810_video.c @@ -23,7 +23,7 @@ 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/i810/i810_video.c,v 1.24 2003/09/08 14:25:29 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.26 2003/11/10 18:22:22 tsi Exp $ */ /* * i810_video.c: i810 Xv driver. Based on the mga Xv driver by Mark Vojkovich. @@ -420,7 +420,7 @@ I810SetupImageVideo(ScreenPtr pScreen) pPriv->currentBuf = 0; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); pI810->adaptor = adapt; @@ -765,9 +765,9 @@ I810DisplayVideo( } else { overlay->OV0CONF = 0; /* two 720 pixel line buffers */ } - + overlay->SHEIGHT = height | (height << 15); - overlay->DWINPOS = (dstBox->y1 << 16) | dstBox->x1; + overlay->DWINPOS = (dstBox->y1 << 16) | (dstBox->x1); overlay->DWINSZ = ((dstBox->y2 - dstBox->y1) << 16) | (dstBox->x2 - dstBox->x1); @@ -991,14 +991,18 @@ I810PutImage( dstBox.y2 = drw_y + drw_h; I810ClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - + REGION_EXTENTS(pScrn->pScreen, clipBoxes), width, height); + if((x1 >= x2) || (y1 >= y2)) return Success; - - dstBox.x1 -= pScrn->frameX0; - dstBox.x2 -= pScrn->frameX0; - dstBox.y1 -= pScrn->frameY0; + /* + * Fix for 4 pixel granularity of AdjustFrame + * unless boarder is clipped by frame + */ + dstBox.x1 -= (pScrn->frameX0 & + ((dstBox.x1 == pScrn->frameX0) ? ~0x0UL : ~0x3UL)); + dstBox.x2 -= (pScrn->frameX0 & ~0x3); + dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; switch(id) { @@ -1079,7 +1083,6 @@ I810PutImage( xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); } - I810DisplayVideo(pScrn, id, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); @@ -1336,8 +1339,13 @@ I810DisplaySurface( REGION_EXTENTS(screenInfo.screens[0], clipBoxes), surface->width, surface->height); - dstBox.x1 -= pScrn->frameX0; - dstBox.x2 -= pScrn->frameX0; + /* + * Fix for 4 pixel granularity of AdjustFrame + * unless boarder is clipped by frame + */ + dstBox.x1 -= (pScrn->frameX0 & + ((dstBox.x1 == pScrn->frameX0) ? ~0x0UL : ~0x3UL)); + dstBox.x2 -= (pScrn->frameX0 & ~0x3); dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; diff --git a/src/i810_wmark.c b/src/i810_wmark.c index 9a6bdd34..f124e5f1 100644 --- a/src/i810_wmark.c +++ b/src/i810_wmark.c @@ -25,7 +25,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/i810/i810_wmark.c,v 1.8 2002/10/30 12:52:18 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_wmark.c,v 1.7 2002/09/11 00:29:32 dawes Exp $ */ /* * Reformatted with GNU indent (2.2.8), using the following options: diff --git a/src/i830.h b/src/i830.h index 4b25ea1b..063826fb 100644 --- a/src/i830.h +++ b/src/i830.h @@ -180,17 +180,17 @@ typedef struct _I830Rec { int CacheLines; /* These are set in PreInit and never changed. */ - unsigned long FbMapSize; - unsigned long TotalVideoRam; + long FbMapSize; + long TotalVideoRam; I830MemRange StolenMemory; /* pre-allocated memory */ - unsigned long BIOSMemorySize; /* min stolen pool size */ + long BIOSMemorySize; /* min stolen pool size */ int BIOSMemSizeLoc; /* These change according to what has been allocated. */ long FreeMemory; I830MemRange MemoryAperture; I830MemPool StolenPool; - unsigned long allocatedMemory; + long allocatedMemory; /* Regions allocated either from the above pools, or from agpgart. */ /* for single and dual head configurations */ @@ -348,7 +348,7 @@ typedef struct _I830Rec { int xoffset; int yoffset; - int SaveGeneration; + unsigned int SaveGeneration; Bool vbeRestoreWorkaround; Bool displayInfo; Bool devicePresence; @@ -415,7 +415,7 @@ extern Bool I830FixupOffsets(ScrnInfoPtr pScrn); extern Bool I830BindGARTMemory(ScrnInfoPtr pScrn); extern Bool I830UnbindGARTMemory(ScrnInfoPtr pScrn); extern unsigned long I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result, - I830MemPool *pool, unsigned long size, + I830MemPool *pool, long size, unsigned long alignment, int flags); extern void I830PrintAllRegisters(I830RegPtr i830Reg); diff --git a/src/i830_driver.c b/src/i830_driver.c index c0fed71f..c6d6c583 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -594,6 +594,7 @@ SetDisplayDevices(ScrnInfoPtr pScrn, int devices) I830Ptr pI830 = I830PTR(pScrn); vbeInfoPtr pVbe = pI830->pVbe; CARD32 temp; + #ifdef I915G_WORKAROUND int getmode; int mode; @@ -1018,7 +1019,7 @@ static Bool I830MapMem(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - unsigned i; + long i; for (i = 2; i < pI830->FbMapSize; i <<= 1) ; pI830->FbMapSize = i; @@ -2898,7 +2899,7 @@ SetRingRegs(ScrnInfoPtr pScrn) OUTREG(LP_RING + RING_TAIL, 0); OUTREG(LP_RING + RING_HEAD, 0); - if ((pI830->LpRing->mem.Start & I830_RING_START_MASK) != + if ((long)(pI830->LpRing->mem.Start & I830_RING_START_MASK) != pI830->LpRing->mem.Start) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I830SetRingRegs: Ring buffer start (%lx) violates its " @@ -3441,7 +3442,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); temp = INREG(stridereg); - if (temp / pI8301->cpp != pI830->entityPrivate->pScrn_1->displayWidth) { + if (temp / pI8301->cpp != (CARD32)(pI830->entityPrivate->pScrn_1->displayWidth)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(pI830->pipe), (int)(temp / pI8301->cpp), pI830->entityPrivate->pScrn_1->displayWidth); @@ -3459,7 +3460,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) sizereg = pI830->pipe ? DSPASIZE : DSPBSIZE; temp = INREG(stridereg); - if (temp / pI8302->cpp != pI830->entityPrivate->pScrn_2->displayWidth) { + if (temp / pI8302->cpp != (CARD32)(pI830->entityPrivate->pScrn_2->displayWidth)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(!pI830->pipe), (int)(temp / pI8302->cpp), pI830->entityPrivate->pScrn_2->displayWidth); @@ -3478,7 +3479,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) I830Ptr pI8302 = I830PTR(pI830->entityPrivate->pScrn_2); temp = INREG(stridereg); - if (temp / pI8301->cpp != pI830->entityPrivate->pScrn_1->displayWidth) { + if (temp / pI8301->cpp != (CARD32)(pI830->entityPrivate->pScrn_1->displayWidth)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(pI830->pipe), (int)(temp / pI8301->cpp), pI830->entityPrivate->pScrn_1->displayWidth); @@ -3494,7 +3495,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) sizereg = !pI830->pipe ? DSPASIZE : DSPBSIZE; temp = INREG(stridereg); - if (temp / pI8302->cpp != pI830->entityPrivate->pScrn_2->displayWidth) { + if (temp / pI8302->cpp != ((CARD32)pI830->entityPrivate->pScrn_2->displayWidth)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(!pI830->pipe), (int)(temp / pI8302->cpp), pI830->entityPrivate->pScrn_2->displayWidth); @@ -3515,7 +3516,7 @@ I830VESASetMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) continue; temp = INREG(stridereg); - if (temp / pI830->cpp != pScrn->displayWidth) { + if (temp / pI830->cpp != (CARD32)pScrn->displayWidth) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Correcting plane %c stride (%d -> %d)\n", PIPE_NAME(i), (int)(temp / pI830->cpp), pScrn->displayWidth); @@ -4354,6 +4355,9 @@ I830BIOSLeaveVT(int scrnIndex, int flags) SaveHWOperatingState(pScrn); #endif + ResetState(pScrn, TRUE); + RestoreHWState(pScrn); + if (IsPrimary(pScrn)) { if (!SetDisplayDevices(pScrn, pI830->savedDevices)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -4365,8 +4369,6 @@ I830BIOSLeaveVT(int scrnIndex, int flags) } } - ResetState(pScrn, TRUE); - RestoreHWState(pScrn); RestoreBIOSMemSize(pScrn); if (IsPrimary(pScrn)) I830UnbindGARTMemory(pScrn); @@ -4506,7 +4508,8 @@ I830BIOSSaveScreen(ScreenPtr pScreen, int mode) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); Bool on = xf86IsUnblank(mode); - CARD32 temp, ctrl, base, i; + CARD32 temp, ctrl, base; + int i; DPRINTF(PFX, "I830BIOSSaveScreen: %d, on is %s\n", mode, BOOLTOSTRING(on)); diff --git a/src/i830_memory.c b/src/i830_memory.c index 990651e1..24cf9575 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -63,10 +63,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static unsigned long AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, - unsigned long size, unsigned long alignment, int flags) + long size, unsigned long alignment, int flags) { I830Ptr pI830 = I830PTR(pScrn); - unsigned long needed, start, end; + long needed, start, end; Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); if (!result || !pool || !size) @@ -94,7 +94,7 @@ AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, } } if (needed > pool->Free.Size) { - unsigned long extra; + long extra; /* See if the pool can be grown. */ if (pI830->StolenOnly && !dryrun) return 0; @@ -107,7 +107,7 @@ AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, return 0; } - if (!dryrun && (extra > pI830->MemoryAperture.Size)) + if (!dryrun && ((long)extra > pI830->MemoryAperture.Size)) return 0; pool->Free.Size += extra; @@ -136,7 +136,7 @@ AllocFromPool(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, } static unsigned long -AllocFromAGP(ScrnInfoPtr pScrn, I830MemRange *result, unsigned long size, +AllocFromAGP(ScrnInfoPtr pScrn, I830MemRange *result, long size, unsigned long alignment, int flags) { I830Ptr pI830 = I830PTR(pScrn); @@ -212,7 +212,7 @@ AllocFromAGP(ScrnInfoPtr pScrn, I830MemRange *result, unsigned long size, unsigned long I830AllocVidMem(ScrnInfoPtr pScrn, I830MemRange *result, I830MemPool *pool, - unsigned long size, unsigned long alignment, int flags) + long size, unsigned long alignment, int flags) { I830Ptr pI830 = I830PTR(pScrn); Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); @@ -392,7 +392,7 @@ Bool I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) { I830Ptr pI830 = I830PTR(pScrn); - unsigned long size, alloced; + long size, alloced; Bool dryrun = ((flags & ALLOCATE_DRY_RUN) != 0); int verbosity = dryrun ? 4 : 1; const char *s = dryrun ? "[dryrun] " : ""; @@ -610,9 +610,9 @@ I830Allocate2DMemory(ScrnInfoPtr pScrn, const int flags) return FALSE; } } else { - unsigned long lineSize; - unsigned long extra = 0; - unsigned long maxFb = 0; + long lineSize; + long extra = 0; + long maxFb = 0; /* * XXX Need to "free" up any 3D allocations if the DRI ended up @@ -857,7 +857,7 @@ long I830GetExcessMemoryAllocations(ScrnInfoPtr pScrn) { I830Ptr pI830 = I830PTR(pScrn); - unsigned long allocated; + long allocated; allocated = pI830->StolenPool.Total.Size + pI830->allocatedMemory; if (allocated > pI830->TotalVideoRam) @@ -1367,7 +1367,7 @@ MakeTiles(ScrnInfoPtr pScrn, I830MemRange *pMem) I830Ptr pI830 = I830PTR(pScrn); int pitch, ntiles, i; static int nextTile = 0; - static int tileGeneration = -1; + static unsigned int tileGeneration = -1; #if 0 /* Hack to "improve" the alignment of the front buffer. -- cgit v1.2.3