summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2006-12-14 17:26:59 -0700
committerJordan Crouse <jordan.crouse@amd.com>2006-12-14 17:33:59 -0700
commit73dc69c6597d5f0f6023c067f7b1c2d7709b604b (patch)
tree727f9e4d1e69c7cdcabc9211fb4cd93e3cc9cd1a
parenta38f40687c00f35d2e6529c3cfb894ee29cdea66 (diff)
PATCH: Automatically probe to see if VGA exists
-rw-r--r--src/amd_driver.c1
-rw-r--r--src/amd_gx_driver.c45
2 files changed, 36 insertions, 10 deletions
diff --git a/src/amd_driver.c b/src/amd_driver.c
index b5eab54..8b0d76f 100644
--- a/src/amd_driver.c
+++ b/src/amd_driver.c
@@ -210,7 +210,6 @@ OptionInfoRec GX_GeodeOptions[] = {
{GX_OPTION_OSM_CLR_BUFS, "OSMColorExpBuffers", OPTV_INTEGER, {0}, FALSE},
{GX_OPTION_CUSTOM_MODE, "CustomMode", OPTV_BOOLEAN, {0}, FALSE},
{GX_OPTION_FBSIZE, "FBSize", OPTV_INTEGER, {0}, FALSE },
- {GX_OPTION_NOVGA, "NoVGA", OPTV_BOOLEAN, {0}, FALSE },
{GX_OPTION_PANEL_GEOMETRY, "PanelGeometry", OPTV_STRING, {0}, FALSE },
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
diff --git a/src/amd_gx_driver.c b/src/amd_gx_driver.c
index aeda9ae..99ff264 100644
--- a/src/amd_gx_driver.c
+++ b/src/amd_gx_driver.c
@@ -451,6 +451,26 @@ GXMapMem(ScrnInfoPtr pScrni)
return TRUE;
}
+/* Check to see if VGA exists - we map the space and look for a
+ signature - if it doesn't match exactly, then we assume no VGA.
+*/
+
+static Bool
+GXCheckVGA(ScrnInfoPtr pScrni) {
+
+ char *vgasig = "IBM VGA Compatible";
+ vgaHWPtr pvgaHW = VGAHWPTR(pScrni);
+ int ret;
+
+ if (!vgaHWMapMem(pScrni))
+ return FALSE;
+
+ ret = memcmp(pvgaHW->Base + 0x1E, "IBM VGA Compatible", 18);
+ vgaHWUnmapMem(pScrni);
+
+ return ret ? FALSE : TRUE;
+}
+
static Bool
GXPreInit(ScrnInfoPtr pScrni, int flags)
{
@@ -469,8 +489,19 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
if (pGeode == NULL)
return FALSE;
+ /* Probe for VGA */
+ pGeode->useVGA = FALSE;
+
+ if (xf86LoadSubModule(pScrni, "vgahw")) {
+ if (vgaHWGetHWRec(pScrni)) {
+ pGeode->useVGA = GXCheckVGA(pScrni);
+ ErrorF("VGA support is %d\n", pGeode->useVGA);
+ }
+ }
+
#if INT10_SUPPORT
- pGeode->vesa = xcalloc(sizeof(VESARec), 1);
+ if (pGeode->useVGA)
+ pGeode->vesa = xcalloc(sizeof(VESARec), 1);
#endif
if (pScrni->numEntities != 1)
@@ -483,9 +514,9 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
/* ISSUE - this won't work without VGA, but its too early to know if we can use VGA or not */
- if (flags & PROBE_DETECT) {
- GXProbeDDC(pScrni, pGeode->pEnt->index);
- return TRUE;
+ if (pGeode->useVGA && (flags & PROBE_DETECT)) {
+ GXProbeDDC(pScrni, pGeode->pEnt->index);
+ return TRUE;
}
pGeode->cpu_version = gfx_detect_cpu();
@@ -549,9 +580,8 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
xf86ProcessOptions(pScrni->scrnIndex, pScrni->options, GeodeOptions);
/* Set up our various options that may get reversed as we go on */
- pGeode->useVGA = TRUE;
- pGeode->FBVGAActive = FALSE;
+ pGeode->FBVGAActive = FALSE;
pGeode->tryHWCursor = TRUE;
pGeode->tryCompression = TRUE;
@@ -568,9 +598,6 @@ GXPreInit(ScrnInfoPtr pScrni, int flags)
pGeode->NoOfColorExpandLines = DEFAULT_CLR_LINE_BUFS;
pGeode->exaBfrSz = DEFAULT_EXA_SCRATCH_BFRSZ;
- if (xf86ReturnOptValBool(GeodeOptions, GX_OPTION_NOVGA, FALSE))
- pGeode->useVGA = FALSE;
-
xf86GetOptValBool(GeodeOptions, GX_OPTION_HW_CURSOR,
&pGeode->tryHWCursor);