[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#226430: [christian.guggenberger@physik.uni-regensburg.de: latest upstream seems to fix problems with i865G chipsets]



tag 226430 + patch
thanks

Thank you very much for looking into this, Mr. Guggenberger!

I am forwarding your patch to the first of the merged bugs and tagging
it accordingly.

-- 
G. Branden Robinson                |     Men are born ignorant, not stupid.
Debian GNU/Linux                   |     They are made stupid by education.
branden@debian.org                 |     -- Bertrand Russell
http://people.debian.org/~branden/ |
--- Begin Message ---
[ this applies to bugs #226430 #233684 #233951 ]

Dear Branden,

I spent some hours with fiddling latest changes of UPSTREAM's i830.h and
i830_driver.c into xfree86-4.3.0-2 to get some machines with Intel's
865G chip working again.
Well, it seems I've succeeded.
Basically, what i've done is merge all changes from upstream into
debian's source. (I've reverted 
http://cvsweb.xfree86.org/cvsweb/xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c.diff?r1=1.36&r2=1.37   because I got a build error I could not workaround with my little knowledge)

I will attach both patches (the first brings i830.h in shape, the other
one i830_driver.c)
I have succesfully (short...) tested the resulting .debs on i845G and
i865G hardware, X is working again on 865g now.

If you'd (or any other "patchmaster" here on the list) find some time to
review the patches and pull the nessessary changes into your svn
repository - that would be nice.
 
thanks
 - Christian



--- xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h.orig	Wed Feb 25 19:13:29 2004
+++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h	Wed Feb 25 19:21:15 2004
@@ -27,7 +27,7 @@
 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.7.2.1 2003/10/21 02:22:38 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830.h,v 1.13 2004/02/20 00:06:00 alanh Exp $ */
 
 /*
  * Authors:
@@ -302,6 +302,8 @@
    int yoffset;
 
    int SaveGeneration;
+   Bool vbeRestoreWorkaround;
+   Bool displayInfo;
 } I830Rec;
 
 #define I830PTR(p) ((I830Ptr)((p)->driverPrivate))
--- xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c.orig	Wed Feb 25 21:29:49 2004
+++ xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c	Wed Feb 25 21:37:30 2004
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.27.2.3 2003/12/19 23:41:32 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_driver.c,v 1.51 2004/02/25 12:53:14 eich Exp $ */
 /**************************************************************************
 
 Copyright 2001 VA Linux Systems Inc., Fremont, California.
@@ -154,7 +154,7 @@
 #include "micmap.h"
 
 #include "fb.h"
-#include "miscstruct.h"
+#include "regionstr.h"
 #include "xf86xv.h"
 #include "Xv.h"
 #include "vbe.h"
@@ -202,8 +202,8 @@
    OPTION_XVIDEO,
    OPTION_VIDEO_KEY,
    OPTION_COLOR_KEY,
-   OPTION_STRETCH,
-   OPTION_CENTER
+   OPTION_VBE_RESTORE,
+   OPTION_DISPLAY_INFO
 } I830Opts;
 
 static OptionInfoRec I830BIOSOptions[] = {
@@ -215,8 +215,8 @@
    {OPTION_XVIDEO,	"XVideo",	OPTV_BOOLEAN,	{0},	TRUE},
    {OPTION_COLOR_KEY,	"ColorKey",	OPTV_INTEGER,	{0},	FALSE},
    {OPTION_VIDEO_KEY,	"VideoKey",	OPTV_INTEGER,	{0},	FALSE},
-   {OPTION_STRETCH,	"Stretch",	OPTV_BOOLEAN,	{0},	FALSE},
-   {OPTION_CENTER,	"Center",	OPTV_BOOLEAN,	{0},	FALSE},
+   {OPTION_VBE_RESTORE,	"VBERestore",	OPTV_BOOLEAN,	{0},	FALSE},
+   {OPTION_DISPLAY_INFO,"DisplayInfo",	OPTV_BOOLEAN,	{0},	FALSE},
    {-1,			NULL,		OPTV_NONE,	{0},	FALSE}
 };
 /* *INDENT-ON* */
@@ -790,18 +790,26 @@
    I830Ptr pI830 = I830PTR(pScrn);
    int pipe, n;
    DisplayType i;
-
-   for (i = 0; i < NumKnownDisplayTypes; i++) {
-      if (GetDisplayInfo(pScrn, 1 << i, &pI830->displayAttached[i],
+   
+   /* This seems to lockup some Dell BIOS'. So it's on option to turn on */
+   if (pI830->displayInfo) {
+       xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		  "Broken BIOSes cause the system to hang here.\n"
+		  "\t      If you encounter this problem please add \n"
+		  "\t\t Option \"DisplayInfo\" \"FALSE\"\n"
+		  "\t      to the Device section of your XF86Config file.\n");
+      for (i = 0; i < NumKnownDisplayTypes; i++) {
+         if (GetDisplayInfo(pScrn, 1 << i, &pI830->displayAttached[i],
 			 &pI830->displayPresent[i],
 			 &pI830->displaySize[i].x2,
 			 &pI830->displaySize[i].y2)) {
-	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 		    "Display Info: %s: attached: %s, present: %s, size: "
 		    "(%d,%d)\n", displayDevices[i],
 		    BOOLTOSTRING(pI830->displayAttached[i]),
 		    BOOLTOSTRING(pI830->displayPresent[i]),
 		    pI830->displaySize[i].x2, pI830->displaySize[i].y2);
+         }
       }
    }
 
@@ -1183,7 +1191,7 @@
 SetBIOSMemSize(ScrnInfoPtr pScrn, int newSize)
 {
    I830Ptr pI830 = I830PTR(pScrn);
-   CARD32 swf1;
+   unsigned long swf1;
    Bool mapped;
 
    DPRINTF(PFX, "SetBIOSMemSize: %d kB\n", newSize / 1024);
@@ -1199,7 +1207,7 @@
 #endif
 
    if ((IS_I830(pI830) || IS_845G(pI830)) && pI830->useSWF1) {
-      CARD32 newSWF1;
+      unsigned long newSWF1;
 
       /* Need MMIO access here. */
       mapped = (pI830->MMIOBase != NULL);
@@ -1212,10 +1220,10 @@
 	 newSWF1 = 8;
 
       swf1 = INREG(SWF1);
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08x\n", swf1);
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Before: SWF1 is 0x%08lx\n", swf1);
       swf1 &= ~0x0f;
       swf1 |= (newSWF1 & 0x0f);
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08x\n", swf1);
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "After: SWF1 is 0x%08lx\n", swf1);
       OUTREG(SWF1, swf1);
       if (!mapped)
 	 I830UnmapMMIO(pScrn);
@@ -1546,7 +1554,7 @@
    /* Sanity check: compare with what the BIOS thinks. */
    if (pI830->vbeInfo->TotalMemory != pI830->StolenMemory.Size / 1024 / 64) {
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "Detected stolen memory (%d kB) doesn't match what the BIOS"
+		 "Detected stolen memory (%ld kB) doesn't match what the BIOS"
 		 " reports (%d kB)\n",
 		 ROUND_DOWN_TO(pI830->StolenMemory.Size / 1024, 64),
 		 pI830->vbeInfo->TotalMemory * 64);
@@ -1694,7 +1702,7 @@
 
 	    pI830->BIOSMemorySize = KB(pI830->vbeInfo->TotalMemory * 64);
 	    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
-		       "BIOS now sees %d kB VideoRAM\n",
+		       "BIOS now sees %ld kB VideoRAM\n",
 		       pI830->BIOSMemorySize / 1024);
  	 } else if ((pI830->saveBIOSMemSize 
  		  = TweakMemorySize(pScrn, pI830->newBIOSMemSize, TRUE)) != 0) 
@@ -1707,7 +1715,9 @@
       }
    }
 
-   xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pre-allocated VideoRAM: %d kByte\n",
+   pVbe = pI830->pVbe;
+
+   xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pre-allocated VideoRAM: %ld kByte\n",
 	      pI830->StolenMemory.Size / 1024);
    xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam);
    pI830->TotalVideoRam = KB(pScrn->videoRam);
@@ -1814,6 +1824,15 @@
    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%d display pipe%s available.\n",
 	      pI830->availablePipes, pI830->availablePipes > 1 ? "s" : "");
 
+   pI830->displayInfo = TRUE;
+   from = X_DEFAULT;
+   if (!xf86ReturnOptValBool(pI830->Options, OPTION_DISPLAY_INFO, TRUE)) {
+      from = X_CONFIG;
+      pI830->displayInfo = FALSE;
+   }
+   xf86DrvMsg(pScrn->scrnIndex, from, "Display Info: %s.\n",
+	      pI830->displayInfo ? "enabled" : "disabled");
+
    if (!I830DetectDisplayDevice(pScrn)) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		 "Couldn't detect display devices.\n");
@@ -2012,7 +2031,7 @@
 		  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 			     "Allocation with DRI tiling enabled would "
 			     "exceed the\n"
-			     "\tmemory aperture size (%d kB) by %d kB.\n"
+			     "\tmemory aperture size (%ld kB) by %ld kB.\n"
 			     "\tReduce VideoRam amount to avoid this!\n",
 			     pI830->FbMapSize / 1024,
 			     -pI830->MemoryAperture.Size / 1024);
@@ -2052,7 +2071,7 @@
 		  xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 			     "Allocation with DRI enabled would "
 			     "exceed the\n"
-			     "\tmemory aperture size (%d kB) by %d kB.\n"
+			     "\tmemory aperture size (%ld kB) by %ld kB.\n"
 			     "\tReduce VideoRam amount to avoid this!\n",
 			     pI830->FbMapSize / 1024,
 			     -pI830->MemoryAperture.Size / 1024);
@@ -2126,6 +2145,16 @@
    VBEFreeVBEInfo(pI830->vbeInfo);
    vbeFree(pVbe);
 
+   /* Use the VBE mode restore workaround by default. */
+   pI830->vbeRestoreWorkaround = TRUE;
+   from = X_DEFAULT;
+   if (xf86ReturnOptValBool(pI830->Options, OPTION_VBE_RESTORE, FALSE)) {
+      pI830->vbeRestoreWorkaround = FALSE;
+      from = X_CONFIG;
+   }
+   xf86DrvMsg(pScrn->scrnIndex, from, "VBE Restore workaround: %s.\n",
+	      pI830->vbeRestoreWorkaround ? "enabled" : "disabled");
+      
 #if defined(XF86DRI)
    if (!pI830->directRenderingDisabled) {
       if (!xf86LoadSubModule(pScrn, "shadow")) {
@@ -2153,26 +2182,26 @@
    /* Check first for page table errors */
    temp = INREG(PGE_ERR);
    if (temp != 0) {
-      xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08x\n", temp);
+      xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "PGTBL_ER is 0x%08lx\n", temp);
       errors++;
    }
    temp = INREG(PGETBL_CTL);
    if (!(temp & 1)) {
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "PGTBL_CTL (0x%08x) indicates GTT is disabled\n", temp);
+		 "PGTBL_CTL (0x%08lx) indicates GTT is disabled\n", temp);
       errors++;
    }
    temp = INREG(LP_RING + RING_LEN);
    if (temp & 1) {
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "PRB0_CTL (0x%08x) indicates ring buffer enabled\n", temp);
+		 "PRB0_CTL (0x%08lx) indicates ring buffer enabled\n", temp);
       errors++;
    }
    head = INREG(LP_RING + RING_HEAD);
    tail = INREG(LP_RING + RING_TAIL);
    if ((tail & I830_TAIL_MASK) != (head & I830_HEAD_MASK)) {
       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-		 "PRB0_HEAD (0x%08x) and PRB0_TAIL (0x%08x) indicate "
+		 "PRB0_HEAD (0x%08lx) and PRB0_TAIL (0x%08lx) indicate "
 		 "ring buffer not flushed\n", head, tail);
       errors++;
    }
@@ -2257,7 +2286,7 @@
    if ((pI830->LpRing.mem.Start & I830_RING_START_MASK) !=
        pI830->LpRing.mem.Start) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "I830SetRingRegs: Ring buffer start (%x) violates its "
+		 "I830SetRingRegs: Ring buffer start (%lx) violates its "
 		 "mask (%x)\n", pI830->LpRing.mem.Start, I830_RING_START_MASK);
    }
    /* Don't care about the old value.  Reserved bits must be zero anyway. */
@@ -2267,7 +2296,7 @@
    if (((pI830->LpRing.mem.Size - 4096) & I830_RING_NR_PAGES) !=
        pI830->LpRing.mem.Size - 4096) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-		 "I830SetRingRegs: Ring buffer size - 4096 (%x) violates its "
+		 "I830SetRingRegs: Ring buffer size - 4096 (%lx) violates its "
 		 "mask (%x)\n", pI830->LpRing.mem.Size - 4096,
 		 I830_RING_NR_PAGES);
    }
@@ -2323,10 +2352,6 @@
    vgaHWUnlock(hwp);
    vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS);
 
-#ifndef I845G_VBE_WORKAROUND
-#define I845G_VBE_WORKAROUND 1
-#endif
-
    pVesa = pI830->vesa;
    /*
     * This save/restore method doesn't work for 845G BIOS, or for some
@@ -2338,7 +2363,7 @@
     * registers, turning off the irq & breaking the kernel module
     * behaviour.
     */
-   if (!I845G_VBE_WORKAROUND) {
+   if (!pI830->vbeRestoreWorkaround) {
       CARD16 imr = INREG16(IMR);
       CARD16 ier = INREG16(IER);
       CARD16 hwstam = INREG16(HWSTAM);
@@ -2534,6 +2559,22 @@
    }
 
    /*
+    * Test if the extendedRefresh BIOS function is supported.
+    */
+   if (pI830->useExtendedRefresh && !pI830->vesa->useDefaultRefresh &&
+       (mode & (1 << 11)) && data && data->data && data->block) {
+      if (!SetRefreshRate(pScrn, mode, 60)) {
+	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		    "BIOS call 0x5f05 not supported, "
+		    "setting refresh with VBE 3 method.\n");
+	 pI830->useExtendedRefresh = FALSE;
+	 pI830->enableDisplays = FALSE;
+	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+		 "Not using BIOS call 0x5f64 to enable displays.\n");
+      }
+   }
+
+   /*
     * The BIOS may not set a scanline pitch that would require more video
     * memory than it's aware of.  We check for this later, and set it
     * explicitly if necessary.
@@ -2637,10 +2678,10 @@
     * Print out the PIPEACONF and PIPEBCONF registers.
     */
    temp = INREG(PIPEACONF);
-   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08x\n", temp);
+   xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEACONF is 0x%08lx\n", temp);
    if (IS_MOBILE(pI830)) {
       temp = INREG(PIPEBCONF);
-      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08x\n", temp);
+      xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PIPEBCONF is 0x%08lx\n", temp);
    }
 
 #if PRINT_MODE_INFO
@@ -3207,9 +3248,7 @@
       return FALSE;
    }
 
-#ifdef DPMSExtension
    xf86DPMSInit(pScreen, I830DisplayPowerManagementSet, 0);
-#endif
 
 #ifdef I830_XV
    /* Init video */
@@ -3332,10 +3371,6 @@
 #endif
 
    ResetState(pScrn, TRUE);
-#ifdef XF86DRI
-   /* NeedToSync is set TRUE in RefreshRing called from ResetState() */
-   pI830->AccelInfoRec->NeedToSync = FALSE;
-#endif
    RestoreHWState(pScrn);
    RestoreBIOSMemSize(pScrn);
    I830UnbindGARTMemory(pScrn);
@@ -3432,11 +3467,6 @@
       } while (_head != _tail);
    }
 
-#if 0
-   OffsetFrame = !OffsetFrame;
-   pScrn->AdjustFrame(scrnIndex, 0, 0, 0);
-#endif
-
 #ifndef BINDUNBIND
 #define BINDUNBIND 0
 #endif
@@ -3583,7 +3613,7 @@
    return (*pScreen->CloseScreen) (scrnIndex, pScreen);
 }
 
-static int
+static ModeStatus
 I830ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
 {
    if (mode->Flags & V_INTERLACE) {

--- End Message ---

Attachment: signature.asc
Description: Digital signature


Reply to: