summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2007-03-23 21:30:19 +0200
committerGeorge Sapountzis <gsap7@yahoo.gr>2007-03-23 23:27:35 +0200
commit58626d8b78f26f0d9c480033d3c3a12e541342b1 (patch)
treeedddc652646f6b4f1fde570a7208caed4f729213 /src
parent166c760a86165330175023e07c4b2bd6891633c5 (diff)
Move {atimach64,r128,radeon}_probe.c from ati to subdrivers.
Subdrivers are now loaded from the wrapper Probe function rather than at screen creation time. The wrapper Identify callback only prints chip families now, chip lists are printed when a subdriver is loaded. This also avoids duplication of subdriver Identify callbacks. Unknown radeons should still get a list of known radeon and then probe fails... Probe for atimisc last to avoid needless loading in most cases (r128, radeon).
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am12
-rw-r--r--src/ati.c102
-rw-r--r--src/atimach64probe.c33
-rw-r--r--src/atimach64probe.h1
-rw-r--r--src/atimodule.c40
-rw-r--r--src/r128_probe.c20
-rw-r--r--src/radeon_probe.c17
7 files changed, 121 insertions, 104 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 5c1bee60..197c4867 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,8 +51,7 @@ ati_drv_la_LTLIBRARIES = ati_drv.la
ati_drv_la_LDFLAGS = -module -avoid-version
ati_drv_ladir = @moduledir@/drivers
ati_drv_la_SOURCES = \
- ati.c atichip.c atimodule.c atimach64probe.c \
- radeon_probe.c r128_probe.c
+ ati.c atichip.c atimodule.c
atimisc_drv_la_LTLIBRARIES = atimisc_drv.la
atimisc_drv_la_LDFLAGS = -module -avoid-version
@@ -64,15 +63,15 @@ atimisc_drv_la_SOURCES = \
atilock.c atimach64.c atimach64accel.c atimach64cursor.c \
atimach64i2c.c atimach64io.c atimach64xv.c atimode.c atipreinit.c \
atiprint.c atirgb514.c atiscreen.c atituner.c atiutil.c ativalid.c \
- atiload.c atimisc.c $(ATIMISC_DRI_SRCS) $(ATIMISC_DGA_SOURCES) \
- $(ATIMISC_CPIO_SOURCES) $(ATIMISC_EXA_SOURCES)
+ atiload.c atimisc.c atimach64probe.c $(ATIMISC_CPIO_SOURCES) \
+ $(ATIMISC_DGA_SOURCES) $(ATIMISC_DRI_SRCS) $(ATIMISC_EXA_SOURCES)
r128_drv_la_LTLIBRARIES = r128_drv.la
r128_drv_la_LDFLAGS = -module -avoid-version
r128_drv_ladir = @moduledir@/drivers
r128_drv_la_SOURCES = \
r128_accel.c r128_cursor.c r128_dga.c r128_driver.c \
- r128_video.c r128_misc.c $(R128_DRI_SRCS)
+ r128_video.c r128_misc.c r128_probe.c $(R128_DRI_SRCS)
radeon_drv_la_LTLIBRARIES = radeon_drv.la
radeon_drv_la_LDFLAGS = -module -avoid-version
@@ -80,7 +79,8 @@ radeon_drv_ladir = @moduledir@/drivers
radeon_drv_la_SOURCES = \
radeon_accel.c radeon_mergedfb.c radeon_cursor.c radeon_dga.c \
radeon_driver.c radeon_video.c radeon_bios.c radeon_mm_i2c.c \
- radeon_vip.c radeon_misc.c radeon_display.c radeon_modes.c $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES)
+ radeon_vip.c radeon_misc.c radeon_probe.c radeon_display.c \
+ radeon_modes.c $(RADEON_DRI_SRCS) $(RADEON_EXA_SOURCES)
theatre_detect_drv_la_LTLIBRARIES = theatre_detect_drv.la
theatre_detect_drv_la_LDFLAGS = -module -avoid-version
diff --git a/src/ati.c b/src/ati.c
index e7a5aeef..fa7d9e8a 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -59,6 +59,7 @@
#include "ati.h"
#include "atichip.h"
+#include "atimodule.h"
#include "ativersion.h"
#include "atimach64probe.h"
@@ -78,10 +79,13 @@ ATIIdentify
int flags
)
{
+ /*
+ * Only print chip families here, chip lists are printed when a subdriver
+ * is loaded.
+ */
xf86Msg(X_INFO, "%s: %s\n", ATI_NAME,
- "ATI driver (version " ATI_VERSION_NAME ") for chipset: mach64");
- R128Identify(flags);
- RADEONIdentify(flags);
+ "ATI driver wrapper (version " ATI_VERSION_NAME ") for chipsets: "
+ "mach64, rage128, radeon");
}
/*
@@ -98,7 +102,6 @@ ATIProbe
)
{
pciVideoPtr pVideo, *xf86PciVideoInfo = xf86GetPciVideoInfo();
- Bool ProbeSuccess = FALSE;
Bool DoMach64 = FALSE;
Bool DoRage128 = FALSE, DoRadeon = FALSE;
int i;
@@ -138,19 +141,73 @@ ATIProbe
}
}
- /* Call Mach64 driver probe */
- if (DoMach64 && Mach64Probe(pDriver, flags))
- ProbeSuccess = TRUE;
+ /* Call Radeon driver probe */
+ if (DoRadeon)
+ {
+ pointer radeon = xf86LoadDrvSubModule(pDriver, "radeon");
+
+ if (!radeon)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to load \"radeon\" module.\n");
+ return FALSE;
+ }
+
+ xf86LoaderReqSymLists(RADEONSymbols, NULL);
+
+ RADEONIdentify(flags);
+
+ if (RADEONProbe(pDriver, flags))
+ return TRUE;
+
+ xf86UnloadSubModule(radeon);
+ }
/* Call Rage 128 driver probe */
- if (DoRage128 && R128Probe(pDriver, flags))
- ProbeSuccess = TRUE;
+ if (DoRage128)
+ {
+ pointer r128 = xf86LoadDrvSubModule(pDriver, "r128");
- /* Call Radeon driver probe */
- if (DoRadeon && RADEONProbe(pDriver, flags))
- ProbeSuccess = TRUE;
+ if (!r128)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to load \"r128\" module.\n");
+ return FALSE;
+ }
+
+ xf86LoaderReqSymLists(R128Symbols, NULL);
- return ProbeSuccess;
+ R128Identify(flags);
+
+ if (R128Probe(pDriver, flags))
+ return TRUE;
+
+ xf86UnloadSubModule(r128);
+ }
+
+ /* Call Mach64 driver probe */
+ if (DoMach64)
+ {
+ pointer atimisc = xf86LoadDrvSubModule(pDriver, "atimisc");
+
+ if (!atimisc)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to load \"atimisc\" module.\n");
+ return FALSE;
+ }
+
+ xf86LoaderReqSymLists(ATISymbols, NULL);
+
+ Mach64Identify(flags);
+
+ if (Mach64Probe(pDriver, flags))
+ return TRUE;
+
+ xf86UnloadSubModule(atimisc);
+ }
+
+ return FALSE;
}
/*
@@ -158,22 +215,27 @@ ATIProbe
*
* Return recognised options that are intended for public consumption.
*/
-const OptionInfoRec *
+static const OptionInfoRec *
ATIAvailableOptions
(
int ChipId,
int BusId
)
{
- const OptionInfoRec *pOptions;
+ CARD16 ChipType = ChipId & 0xffff;
+ ATIChipType Chip;
- if ((pOptions = R128AvailableOptions(ChipId, BusId)))
- return pOptions;
+ /* Probe should have loaded the appropriate subdriver by this point */
- if ((pOptions = RADEONAvailableOptions(ChipId, BusId)))
- return pOptions;
+ Chip = ATIChipID(ChipType, 0x0); /* chip revision is don't care */
+ if (Chip <= ATI_CHIP_Mach64)
+ return Mach64AvailableOptions(ChipId, BusId);
+ else if (Chip <= ATI_CHIP_Rage128)
+ return R128AvailableOptions(ChipId, BusId);
+ else if (Chip <= ATI_CHIP_Radeon)
+ return RADEONAvailableOptions(ChipId, BusId);
- return Mach64AvailableOptions(ChipId, BusId);
+ return NULL;
}
/* The root of all evil... */
diff --git a/src/atimach64probe.c b/src/atimach64probe.c
index 47340a56..cff8bfbf 100644
--- a/src/atimach64probe.c
+++ b/src/atimach64probe.c
@@ -101,7 +101,7 @@ Mach64PciChipsets[] = {
{-1, -1, RES_UNDEFINED}
};
-const OptionInfoRec *
+_X_EXPORT const OptionInfoRec *
Mach64AvailableOptions(int chipid, int busid)
{
/*
@@ -112,12 +112,27 @@ Mach64AvailableOptions(int chipid, int busid)
}
/*
+ * Mach64Identify --
+ *
+ * Print the driver's list of chipset names.
+ */
+_X_EXPORT void
+Mach64Identify
+(
+ int flags
+)
+{
+ xf86Msg(X_INFO, "%s: %s\n", ATI_NAME,
+ "Driver for ATI Mach64 chipsets");
+}
+
+/*
* Mach64Probe --
*
* This function is called once, at the start of the first server generation to
* do a minimal probe for supported hardware.
*/
-Bool
+_X_EXPORT Bool
Mach64Probe(DriverPtr pDriver, int flags)
{
GDevPtr *devSections;
@@ -160,20 +175,6 @@ Mach64Probe(DriverPtr pDriver, int flags)
pEnt = xf86GetEntityInfo(usedChips[i]);
pVideo = xf86GetPciInfoForEntity(usedChips[i]);
-#ifdef XFree86LOADER
-
- if (!xf86LoadSubModule(pScrn, "atimisc"))
- {
- xf86Msg(X_ERROR,
- ATI_NAME ": Failed to load \"atimisc\" module.\n");
- xf86DeleteScreen(pScrn->scrnIndex, 0);
- continue;
- }
-
- xf86LoaderReqSymLists(ATISymbols, NULL);
-
-#endif
-
ATIFillInScreenInfo(pScrn);
pScrn->Probe = Mach64Probe;
diff --git a/src/atimach64probe.h b/src/atimach64probe.h
index 4e474ca3..fa9e713a 100644
--- a/src/atimach64probe.h
+++ b/src/atimach64probe.h
@@ -26,6 +26,7 @@
#include "xf86str.h"
extern const OptionInfoRec * Mach64AvailableOptions(int, int);
+extern void Mach64Identify(int);
extern Bool Mach64Probe(DriverPtr, int);
#endif /* ___ATIMACH64PROBE_H___ */
diff --git a/src/atimodule.c b/src/atimodule.c
index 05456e7c..6aa9a2e7 100644
--- a/src/atimodule.c
+++ b/src/atimodule.c
@@ -34,47 +34,25 @@
const char *ATISymbols[] =
{
- "ATIPreInit",
- "ATIScreenInit",
- "ATISwitchMode",
- "ATIAdjustFrame",
- "ATIEnterVT",
- "ATILeaveVT",
- "ATIFreeScreen",
- "ATIValidMode",
- "ATIOptionsWeak",
- "ATIFillInScreenInfo",
+ "Mach64Identify",
+ "Mach64Probe",
+ "Mach64AvailableOptions",
NULL
};
const char *R128Symbols[] =
{
- "R128PreInit",
- "R128ScreenInit",
- "R128SwitchMode",
- "R128AdjustFrame",
- "R128EnterVT",
- "R128LeaveVT",
- "R128FreeScreen",
- "R128ValidMode",
- "R128OptionsWeak",
- "R128FillInScreenInfo",
+ "R128Identify",
+ "R128Probe",
+ "R128AvailableOptions",
NULL
};
const char *RADEONSymbols[] =
{
- "RADEONPreInit",
- "RADEONScreenInit",
- "RADEONSwitchMode",
- "RADEONAdjustFrame",
- "RADEONEnterVT",
- "RADEONLeaveVT",
- "RADEONFreeScreen",
- "RADEONValidMode",
- "RADEONOptionsWeak",
- "RADEONHandleMessage",
- "RADEONFillInScreenInfo",
+ "RADEONIdentify",
+ "RADEONProbe",
+ "RADEONAvailableOptions",
NULL
};
diff --git a/src/r128_probe.c b/src/r128_probe.c
index 96e78974..836f1d07 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -107,7 +107,7 @@ PciChipsets R128PciChipsets[] = {
int gR128EntityIndex = -1;
/* Return the options for supported chipset 'n'; NULL otherwise */
-const OptionInfoRec *
+_X_EXPORT const OptionInfoRec *
R128AvailableOptions(int chipid, int busid)
{
int i;
@@ -126,7 +126,7 @@ R128AvailableOptions(int chipid, int busid)
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
-void
+_X_EXPORT void
R128Identify(int flags)
{
xf86PrintChipsets(R128_NAME,
@@ -135,7 +135,7 @@ R128Identify(int flags)
}
/* Return TRUE if chipset is present; FALSE otherwise. */
-Bool
+_X_EXPORT Bool
R128Probe(DriverPtr drv, int flags)
{
int numUsed;
@@ -194,20 +194,6 @@ R128Probe(DriverPtr drv, int flags)
if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
R128PciChipsets, 0, 0, 0, 0, 0)))
{
-
-#ifdef XFree86LOADER
-
- if (!xf86LoadSubModule(pScrn, "r128")) {
- xf86Msg(X_ERROR,
- R128_NAME ": Failed to load \"r128\" module.\n");
- xf86DeleteScreen(pScrn->scrnIndex, 0);
- continue;
- }
-
- xf86LoaderReqSymLists(R128Symbols, NULL);
-
-#endif
-
pScrn->Probe = R128Probe;
R128FillInScreenInfo(pScrn);
diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index 98b35aa6..4ff11ea5 100644
--- a/src/radeon_probe.c
+++ b/src/radeon_probe.c
@@ -200,7 +200,7 @@ PciChipsets RADEONPciChipsets[] = {
int gRADEONEntityIndex = -1;
/* Return the options for supported chipset 'n'; NULL otherwise */
-const OptionInfoRec *
+_X_EXPORT const OptionInfoRec *
RADEONAvailableOptions(int chipid, int busid)
{
int i;
@@ -219,7 +219,7 @@ RADEONAvailableOptions(int chipid, int busid)
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
-void
+_X_EXPORT void
RADEONIdentify(int flags)
{
xf86PrintChipsets(RADEON_NAME,
@@ -228,7 +228,7 @@ RADEONIdentify(int flags)
}
/* Return TRUE if chipset is present; FALSE otherwise. */
-Bool
+_X_EXPORT Bool
RADEONProbe(DriverPtr drv, int flags)
{
int numUsed;
@@ -285,17 +285,6 @@ RADEONProbe(DriverPtr drv, int flags)
if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
RADEONPciChipsets, 0, 0, 0,
0, 0))) {
-#ifdef XFree86LOADER
- if (!xf86LoadSubModule(pScrn, "radeon")) {
- xf86Msg(X_ERROR, RADEON_NAME
- ": Failed to load \"radeon\" module.\n");
- xf86DeleteScreen(pScrn->scrnIndex, 0);
- continue;
- }
-
- xf86LoaderReqSymLists(RADEONSymbols, NULL);
-#endif
-
pScrn->Probe = RADEONProbe;
RADEONFillInScreenInfo(pScrn);
foundScreen = TRUE;