summaryrefslogtreecommitdiff
path: root/hw/xfree86/vbe
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-07-06 14:37:48 +0000
committerEgbert Eich <eich@suse.de>2004-07-06 14:37:48 +0000
commitdf2b55a25b7056ac92c1f6cbee9f16bd0a37ba8c (patch)
tree490aecaafb235cfff27a8f924ae92f4136b2dcd5 /hw/xfree86/vbe
parent7c466d64c34e68e0bc50e083861874161ae02db9 (diff)
Separated Intel drivers from default DriDrivers to avoid building them on
IA64 (Egbert Eich). Fixed wrong function prototype (Egbert Eich). Don't test for generic VGA on IA64 (Egbert Eich). Fixed a segfault when accessing a structure before verifying the pointer exists (Egbert Eich). Added a showcache option for debugging (Egbert Eich). Increase default video RAM size to 16MB when DRI is enabled and more than 128MB are available (Egbert Eich). Fixed lockups during mode switch. Problem was introduced when attempting to copy the behavior during LeaveVT()/EnterVT() but but forgetting to call I810DRILeave() before I810DRIEnter(). The entire DRILeave()/Enter() scenario has been commented out as it didn't seem to be necessary (Egbert Eich). Fix TweakMemorySize() (tested with i855/i865) (Egbert Eich). increased MAX_DEVICES to 128 (Egbert Eich). Use OS provided PCI config space access as default method (Egbert Eich). Added support for Linux 2.6 proc file format. Fixed unaligned accesses to pieces of the VBE info block. VESA did not align elements to size (Egbert Eich).
Diffstat (limited to 'hw/xfree86/vbe')
-rw-r--r--hw/xfree86/vbe/vbe.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/xfree86/vbe/vbe.c b/hw/xfree86/vbe/vbe.c
index 9cc8be74d..a8203e910 100644
--- a/hw/xfree86/vbe/vbe.c
+++ b/hw/xfree86/vbe/vbe.c
@@ -57,8 +57,11 @@ VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags)
vbeControllerInfoPtr vbe = NULL;
Bool init_int10 = FALSE;
vbeInfoPtr vip = NULL;
- int screen = pScrn->scrnIndex;
+ int screen;
+ if (!pScrn) return NULL;
+ screen = pScrn->scrnIndex;
+
if (!pInt) {
if (!xf86LoadSubModule(pScrn, "int10"))
goto error;
@@ -336,6 +339,8 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule)
return pMonitor;
}
+#define GET_UNALIGNED2(x) \
+ ((*(CARD16*)(x)) | (*(((CARD16*)(x) + 1))) << 16)
VbeInfoBlock *
VBEGetVBEInfo(vbeInfoPtr pVbe)
@@ -381,7 +386,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4);
major = (unsigned)block->VESAVersion >> 8;
- pStr = *(CARD32*)(((char*)pVbe->memory) + 6);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 6));
str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
block->OEMStringPtr = strdup(str);
@@ -390,7 +395,7 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
block->Capabilities[2] = ((char*)pVbe->memory)[12];
block->Capabilities[3] = ((char*)pVbe->memory)[13];
- pModes = *(CARD32*)(((char*)pVbe->memory) + 14);
+ pModes = GET_UNALIGNED2((((char*)pVbe->memory) + 14));
modes = xf86int10Addr(pVbe->pInt10, FARP(pModes));
i = 0;
while (modes[i] != 0xffff)
@@ -405,13 +410,13 @@ VBEGetVBEInfo(vbeInfoPtr pVbe)
memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236);
else {
block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20);
- pStr = *(CARD32*)(((char*)pVbe->memory) + 22);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 22));
str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
block->OemVendorNamePtr = strdup(str);
- pStr = *(CARD32*)(((char*)pVbe->memory) + 26);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 26));
str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
block->OemProductNamePtr = strdup(str);
- pStr = *(CARD32*)(((char*)pVbe->memory) + 30);
+ pStr = GET_UNALIGNED2((((char*)pVbe->memory) + 30));
str = xf86int10Addr(pVbe->pInt10, FARP(pStr));
block->OemProductRevPtr = strdup(str);
memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222);