? diff Index: i830_driver.c =================================================================== RCS file: /cvs/xorg/driver/xf86-video-i810/src/i830_driver.c,v retrieving revision 1.36 diff -u -r1.36 i830_driver.c --- i830_driver.c 3 Oct 2005 09:39:17 -0000 1.36 +++ i830_driver.c 6 Jan 2006 12:56:58 -0000 @@ -354,10 +354,12 @@ } while (mode && mode != pScrn->modes); } - if (pI830->vbeInfo) - VBEFreeVBEInfo(pI830->vbeInfo); - if (pI830->pVbe) - vbeFree(pI830->pVbe); + if (IsPrimary(pScrn)) { + if (pI830->vbeInfo) + VBEFreeVBEInfo(pI830->vbeInfo); + if (pI830->pVbe) + vbeFree(pI830->pVbe); + } pVesa = pI830->vesa; if (pVesa->monitor) @@ -1513,6 +1515,9 @@ DPRINTF(PFX, "SaveBIOSMemSize\n"); + if (!IsPrimary(pScrn)) + return FALSE; + pI830->useSWF1 = FALSE; #if HAVE_GET_PUT_BIOSMEMSIZE @@ -1572,6 +1577,9 @@ PCITAG tag =pciTag(0,0,0); + if (!IsPrimary(pScrn)) + return 0; + if(!pI830->PciInfo || !(IS_845G(pI830) || IS_I85X(pI830) || IS_I865G(pI830))) return 0; @@ -1618,10 +1626,16 @@ if (preinit) { /* reinitialize VBE for new size */ - VBEFreeVBEInfo(pI830->vbeInfo); - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + if (IsPrimary(pScrn)) { + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pI830->pVbe); + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->pVbe = pI8301->pVbe; + pI830->vbeInfo = pI8301->vbeInfo; + } /* verify that change was successful */ if (pI830->vbeInfo->TotalMemory != (newsize >> 16)){ @@ -1648,8 +1662,11 @@ DPRINTF(PFX, "RestoreBIOSMemSize\n"); + if (!IsPrimary(pScrn)) + return; + if (TweakMemorySize(pScrn, pI830->saveBIOSMemSize,FALSE)) - return; + return; if (!pI830->overrideBIOSMemSize) return; @@ -1920,7 +1937,7 @@ { vgaHWPtr hwp; I830Ptr pI830; - MessageType from; + MessageType from = X_PROBED; rgb defaultWeight = { 0, 0, 0 }; EntityInfoPtr pEnt; I830EntPtr pI830Ent = NULL; @@ -1994,6 +2011,30 @@ return FALSE; } + if (xf86IsEntityShared(pScrn->entityList[0])) { + if (xf86IsPrimInitDone(pScrn->entityList[0])) { + pI830->init = 1; + + if (!pI830Ent->pScrn_1) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to setup second head due to primary head failure.\n"); + return FALSE; + } + } else { + xf86SetPrimInitDone(pScrn->entityList[0]); + pI830->init = 0; + } + } + + if (xf86IsEntityShared(pScrn->entityList[0])) { + if (!IsPrimary(pScrn)) { + pI830Ent->pScrn_2 = pScrn; + } else { + pI830Ent->pScrn_1 = pScrn; + pI830Ent->pScrn_2 = NULL; + } + } + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; pScrn->monitor = pScrn->confScreen->monitor; pScrn->progClock = TRUE; @@ -2039,9 +2080,14 @@ I830SetPIOAccess(pI830); /* Initialize VBE record */ - if ((pI830->pVbe = VBEInit(NULL, pI830->pEnt->index)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VBE initialization failed.\n"); - return FALSE; + if (IsPrimary(pScrn)) { + if ((pI830->pVbe = VBEInit(NULL, pI830->pEnt->index)) == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "VBE initialization failed.\n"); + return FALSE; + } + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->pVbe = pI8301->pVbe; } switch (pI830->PciInfo->chipType) { @@ -2097,7 +2143,12 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Integrated Graphics Chipset: Intel(R) %s\n", chipname); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + if (IsPrimary(pScrn)) { + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->vbeInfo = pI8301->vbeInfo; + } /* Set the Chipset and ChipRev, allowing config file entries to override. */ if (pI830->pEnt->device->chipset && *pI830->pEnt->device->chipset) { @@ -2207,23 +2258,6 @@ pI830->FbMapSize = 0x8000000; } - - if (xf86IsEntityShared(pScrn->entityList[0])) { - if (xf86IsPrimInitDone(pScrn->entityList[0])) { - pI830->init = 1; - - if (!pI830Ent->pScrn_1) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to setup second head due to primary head failure.\n"); - return FALSE; - } - - } else { - xf86SetPrimInitDone(pScrn->entityList[0]); - pI830->init = 0; - } - } - if (pI830->PciInfo->chipType == PCI_CHIP_E7221_G) pI830->availablePipes = 1; else @@ -2597,10 +2631,16 @@ pI830->overrideBIOSMemSize = TRUE; SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); - VBEFreeVBEInfo(pI830->vbeInfo); - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + if (IsPrimary(pScrn)) { + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pI830->pVbe); + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + } else { + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->pVbe = pI8301->pVbe; + pI830->vbeInfo = pI8301->vbeInfo; + } pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64); xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2783,7 +2823,7 @@ "Primary Pipe has been switched from original pipe (%s to %s)\n", pI830->origPipe ? "B" : "A", pI830->pipe ? "B" : "A"); } else { - I830Ptr pI8301 = I830PTR(pI830Ent->pScrn_1); + I830Ptr pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); pI830->operatingDevices = pI8301->operatingDevices; pI830->pipe = !pI8301->pipe; pI830->MonType1 = pI8301->MonType1; @@ -2833,17 +2873,12 @@ if (xf86IsEntityShared(pScrn->entityList[0])) { if (!IsPrimary(pScrn)) { - pI830Ent->pScrn_2 = pScrn; - /* This could be made to work with a little more fiddling */ pI830->directRenderingDisabled = TRUE; xf86DrvMsg(pScrn->scrnIndex, from, "Secondary head is using Pipe %s\n", pI830->pipe ? "B" : "A"); } else { - pI830Ent->pScrn_1 = pScrn; - pI830Ent->pScrn_2 = NULL; - xf86DrvMsg(pScrn->scrnIndex, from, "Primary head is using Pipe %s\n", pI830->pipe ? "B" : "A"); } @@ -3334,10 +3369,14 @@ xf86LoaderReqSymLists(I810shadowFBSymbols, NULL); } - VBEFreeVBEInfo(pI830->vbeInfo); +#if 0 + if (IsPrimary(pScrn)) { + VBEFreeVBEInfo(pI830->vbeInfo); + vbeFree(pI830->pVbe); + } pI830->vbeInfo = NULL; - vbeFree(pI830->pVbe); pI830->pVbe = NULL; +#endif /* Use the VBE mode restore workaround by default. */ pI830->vbeRestoreWorkaround = TRUE; @@ -4458,7 +4497,6 @@ vgaHWPtr hwp; I830Ptr pI830; VisualPtr visual; - I830EntPtr pI830Ent = NULL; I830Ptr pI8301 = NULL; int width, height, displayWidth; unsigned char *fbbase; @@ -4471,9 +4509,6 @@ hwp = VGAHWPTR(pScrn); if (xf86IsEntityShared(pScrn->entityList[0])) { - pI830Ent = pI830->entityPrivate; - pI8301 = I830PTR(pI830Ent->pScrn_1); - /* PreInit failed on the second head, so make sure we turn it off */ if (IsPrimary(pScrn) && !pI830->entityPrivate->pScrn_2) { if (pI830->pipe == 0) { @@ -4509,31 +4544,41 @@ pI830->entityPrivate->XvInUse = -1; } - if (xf86IsEntityShared(pScrn->entityList[0])) { - /* Make our second head point to the first heads structures */ - if (!IsPrimary(pScrn)) { - pI830->LpRing = pI8301->LpRing; - pI830->CursorMem = pI8301->CursorMem; - pI830->CursorMemARGB = pI8301->CursorMemARGB; - pI830->OverlayMem = pI8301->OverlayMem; - pI830->overlayOn = pI8301->overlayOn; - } + /* Make our second head point to the first heads structures */ + if (!IsPrimary(pScrn)) { + pI8301 = I830PTR(pI830->entityPrivate->pScrn_1); + pI830->LpRing = pI8301->LpRing; + pI830->CursorMem = pI8301->CursorMem; + pI830->CursorMemARGB = pI8301->CursorMemARGB; + pI830->OverlayMem = pI8301->OverlayMem; + pI830->overlayOn = pI8301->overlayOn; + pI830->used3D = pI8301->used3D; } /* * If we're changing the BIOS's view of the video memory size, do that * first, then re-initialise the VBE information. */ - if (pI830->pVbe) - vbeFree(pI830->pVbe); - pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); - if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + if (IsPrimary(pScrn)) { + if (pI830->pVbe) + vbeFree(pI830->pVbe); + pI830->pVbe = VBEInit(NULL, pI830->pEnt->index); + } else { + pI830->pVbe = pI8301->pVbe; + } + if (IsPrimary(pScrn)) { + if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + } if (!pI830->pVbe) return FALSE; - if (pI830->vbeInfo) - VBEFreeVBEInfo(pI830->vbeInfo); - pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + if (IsPrimary(pScrn)) { + if (pI830->vbeInfo) + VBEFreeVBEInfo(pI830->vbeInfo); + pI830->vbeInfo = VBEGetVBEInfo(pI830->pVbe); + } else { + pI830->vbeInfo = pI8301->vbeInfo; + } miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, @@ -4674,7 +4719,6 @@ if (IsPrimary(pScrn)) { pScrn->fbOffset = pI830->FrontBuffer.Start; } else { - I830Ptr pI8301 = I830PTR(pI830Ent->pScrn_1); pScrn->fbOffset = pI8301->FrontBuffer2.Start; } @@ -5276,8 +5320,10 @@ return FALSE; CheckInheritedState(pScrn); - if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) - SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + if (IsPrimary(pScrn)) { + if (!TweakMemorySize(pScrn, pI830->newBIOSMemSize,FALSE)) + SetBIOSMemSize(pScrn, pI830->newBIOSMemSize); + } ResetState(pScrn, FALSE); SetHWOperatingState(pScrn);