xf86-video-intel: 2 commits - src/common.h src/i810_driver.c src/i810.h src/i830_bios.c src/i830_driver.c src/i830.h src/i830_modes.c

Keith Packard keithp at kemper.freedesktop.org
Thu Oct 2 14:46:23 PDT 2008


 src/common.h      |   17 -----------------
 src/i810.h        |    3 ++-
 src/i810_driver.c |   10 +---------
 src/i830.h        |    2 --
 src/i830_bios.c   |   53 +++++++++++++++++++++++++++++++----------------------
 src/i830_driver.c |    9 ---------
 src/i830_modes.c  |    1 -
 7 files changed, 34 insertions(+), 61 deletions(-)

New commits:
commit f1dbc266ccfe26c6b9a272e40a5bbe9afaa4f2e0
Author: Eric Anholt <eric at anholt.net>
Date:   Thu Oct 2 14:45:12 2008 -0700

    Work around libpciaccess reporting a 0 rom size by guessing.
    
    I required the following patch on top of this to work around libpciaccess
    brokenness.  libpciaccess reports 0 rom size if there's no rom resource,
    even if the rom file exists in sysfs.

diff --git a/src/i830_bios.c b/src/i830_bios.c
index 726fe30..007530d 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -159,6 +159,8 @@ parse_general_features(I830Ptr pI830, struct bdb_header *bdb)
     }
 }
 
+#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
+
 /**
  * i830_bios_init - map VBIOS, find VBT
  *
@@ -182,25 +184,35 @@ i830_bios_init(ScrnInfoPtr pScrn)
 
 #if XSERVER_LIBPCIACCESS
     size = pI830->PciInfo->rom_size;
+    if (size == 0) {
+	size = INTEL_VBIOS_SIZE;
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+		   "libpciaccess reported 0 rom size, guessing %dkB\n",
+		   size / 1024);
+    }
 #else
-#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
     size = INTEL_VBIOS_SIZE;
 #endif
-    if (size == 0)
-	return -1;
     bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
 #if XSERVER_LIBPCIACCESS
     ret = pci_device_read_rom (pI830->PciInfo, bios);
-    if (ret != 0)
+    if (ret != 0) {
+	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+                  "libpciaccess failed to read %dkB video BIOS: %s\n",
+                  size / 1024, strerror(-ret));
+	xfree (bios);
 	return -1;
+    }
 #else
     /* xf86ReadPciBIOS returns the length read */
     ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
-    if (ret <= 0)
+    if (ret <= 0) {
+	xfree (bios);
 	return -1;
+    }
 #endif
 
     vbt_off = INTEL_BIOS_16(0x1a);
commit 8304b405e0dc2f31fd2d2fd82e150ba502ab74e2
Author: Keith Packard <keithp at keithp.com>
Date:   Mon Sep 29 17:37:28 2008 -0700

    Eliminate INT10 call to get BIOS contents
    
    libpciaccess (and the old X server PCI code as well) provides a function to
    get the ROM contents. Code to use that was already present in the driver and
    used if the INT10 function failed. Skip the INT10 and just use libpciaccess
    as that eliminates several module loads and scary use of vm86.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/src/common.h b/src/common.h
index 840d30a..acd5f4a 100644
--- a/src/common.h
+++ b/src/common.h
@@ -81,8 +81,6 @@ extern void I830InitpScrn(ScrnInfoPtr pScrn);
 extern int I830EntityIndex;
 extern const char *I810vgahwSymbols[];
 extern const char *I810ramdacSymbols[];
-extern const char *I810int10Symbols[];
-extern const char *I810vbeSymbols[];
 extern const char *I810ddcSymbols[];
 extern const char *I810fbSymbols[];
 extern const char *I810xaaSymbols[];
@@ -106,21 +104,6 @@ extern void I830DPRINTF_stub(const char *filename, int line,
 #define RecPtr pI810
 #endif
 
-/* BIOS debug macro */
-#define xf86ExecX86int10_wrapper(pInt, pScrn) do {			\
-   ErrorF("Executing (ax == 0x%x) BIOS call at %s:%d\n", pInt->ax, __FILE__, __LINE__);	\
-   if (I810_DEBUG & DEBUG_VERBOSE_BIOS) {				\
-      ErrorF("Checking Error state before execution\n");		\
-      PrintErrorState(pScrn);						\
-   }									\
-   xf86ExecX86int10(pInt);						\
-   if(I810_DEBUG & DEBUG_VERBOSE_BIOS) {				\
-      ErrorF("Checking Error state after execution\n");			\
-      usleep(50000);							\
-      PrintErrorState(pScrn);						\
-   }									\
-} while (0)
-
 static inline void memset_volatile(volatile void *b, int c, size_t len)
 {
     int i;
diff --git a/src/i810.h b/src/i810.h
index e7331f6..7ea2043 100644
--- a/src/i810.h
+++ b/src/i810.h
@@ -47,7 +47,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86xv.h"
-#include "xf86int10.h"
 #include "vbe.h"
 #include "vgaHW.h"
 
@@ -276,6 +275,8 @@ typedef struct _I810Rec {
    int  drmMinor;
 } I810Rec;
 
+extern const char *I810vbeSymbols[];
+
 #define I810PTR(p) ((I810Ptr)((p)->driverPrivate))
 
 #define I810_SELECT_FRONT	0
diff --git a/src/i810_driver.c b/src/i810_driver.c
index a7f408c..cc28ad8 100644
--- a/src/i810_driver.c
+++ b/src/i810_driver.c
@@ -342,14 +342,6 @@ const char *I810ddcSymbols[] = {
    NULL
 };
 
-const char *I810int10Symbols[] = {
-   "xf86ExecX86int10",
-   "xf86InitInt10",
-   "xf86Int10AllocPages",
-   "xf86int10Addr",
-   NULL
-};
-
 const char *I810xaaSymbols[] = {
    "XAACreateInfoRec",
    "XAADestroyInfoRec",
@@ -518,7 +510,7 @@ i810Setup(pointer module, pointer opts, int *errmaj, int *errmin)
 #endif
 			I810shadowFBSymbols,
 			I810vbeSymbols, vbeOptionalSymbols,
-			I810ddcSymbols, I810int10Symbols, NULL);
+			I810ddcSymbols, NULL);
 
       /*
        * The return value must be non-NULL on success even though there
diff --git a/src/i830.h b/src/i830.h
index 491dfd0..5b78236 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -56,8 +56,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "xaa.h"
 #include "xf86Cursor.h"
 #include "xf86xv.h"
-#include "xf86int10.h"
-#include "vbe.h"
 #include "vgaHW.h"
 #include "xf86Crtc.h"
 #include "xf86RandR12.h"
diff --git a/src/i830_bios.c b/src/i830_bios.c
index 2cb0b07..726fe30 100644
--- a/src/i830_bios.c
+++ b/src/i830_bios.c
@@ -47,9 +47,6 @@
 				 (bios[_addr + 2] << 16)	\
 				 (bios[_addr + 3] << 24))
 
-/* XXX */
-#define INTEL_VBIOS_SIZE (64 * 1024)
-
 static void *
 find_section(struct bdb_header *bdb, int section_id)
 {
@@ -180,34 +177,34 @@ i830_bios_init(ScrnInfoPtr pScrn)
     struct bdb_header *bdb;
     int vbt_off, bdb_off;
     unsigned char *bios;
-    vbeInfoPtr	pVbe;
-    pointer pVBEModule = NULL;
+    int ret;
+    int size;
 
-    bios = xalloc(INTEL_VBIOS_SIZE);
+#if XSERVER_LIBPCIACCESS
+    size = pI830->PciInfo->rom_size;
+#else
+#define INTEL_VBIOS_SIZE (64 * 1024)	/* XXX */
+    size = INTEL_VBIOS_SIZE;
+#endif
+    if (size == 0)
+	return -1;
+    bios = xalloc(size);
     if (bios == NULL)
 	return -1;
 
-    /* Load vbe module */
-    if (!(pVBEModule = xf86LoadSubModule(pScrn, "vbe")))
-	return FALSE;
-    xf86LoaderReqSymLists(I810vbeSymbols, NULL);
-
-    pVbe = VBEInit(NULL, pI830->pEnt->index);
-    if (pVbe != NULL) {
-	memcpy(bios, xf86int10Addr(pVbe->pInt10,
-				   pVbe->pInt10->BIOSseg << 4),
-	       INTEL_VBIOS_SIZE);
-	vbeFree (pVbe);
-    } else {
 #if XSERVER_LIBPCIACCESS
-	pci_device_read_rom (pI830->PciInfo, bios);
+    ret = pci_device_read_rom (pI830->PciInfo, bios);
+    if (ret != 0)
+	return -1;
 #else
-	xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, INTEL_VBIOS_SIZE);
+    /* xf86ReadPciBIOS returns the length read */
+    ret = xf86ReadPciBIOS(0, pI830->PciTag, 0, bios, size);
+    if (ret <= 0)
+	return -1;
 #endif
-    }
 
     vbt_off = INTEL_BIOS_16(0x1a);
-    if (vbt_off >= INTEL_VBIOS_SIZE) {
+    if (vbt_off >= size) {
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Bad VBT offset: 0x%x\n",
 		   vbt_off);
 	xfree(bios);
diff --git a/src/i830_driver.c b/src/i830_driver.c
index 53219c3..3a2a9a4 100644
--- a/src/i830_driver.c
+++ b/src/i830_driver.c
@@ -191,7 +191,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #include "dixstruct.h"
 #include "xf86xv.h"
 #include <X11/extensions/Xv.h>
-#include "vbe.h"
 #include "shadow.h"
 #include "i830.h"
 #include "i830_display.h"
@@ -441,9 +440,6 @@ I830DetectMemory(ScrnInfoPtr pScrn)
    uint16_t gmch_ctrl;
    int memsize = 0, gtt_size;
    int range;
-#if 0
-   VbeInfoBlock *vbeInfo;
-#endif
 
 #if XSERVER_LIBPCIACCESS
    struct pci_device *bridge = intel_host_bridge ();
@@ -1420,11 +1416,6 @@ I830LoadSyms(ScrnInfoPtr pScrn)
     if (pI830->use_drm_mode)
 	return TRUE;
 
-    /* Load int10 module */
-    if (!xf86LoadSubModule(pScrn, "int10"))
-	return FALSE;
-    xf86LoaderReqSymLists(I810int10Symbols, NULL);
-
     /* The vgahw module should be loaded here when needed */
     if (!xf86LoadSubModule(pScrn, "vgahw"))
 	return FALSE;
diff --git a/src/i830_modes.c b/src/i830_modes.c
index 06921a5..4aa493e 100644
--- a/src/i830_modes.c
+++ b/src/i830_modes.c
@@ -31,7 +31,6 @@
  * Authors: David Dawes <dawes at xfree86.org>
  *	    Eric Anholt <eric.anholt at intel.com>
  *
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbeModes.c,v 1.6 2002/11/02 01:38:25 dawes Exp $
  */
 /*
  * Modified by Alan Hourihane <alanh at tungstengraphics.com>


More information about the xorg-commit mailing list