summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2008-01-18 18:17:40 +0200
committerGeorge Sapountzis <gsap7@yahoo.gr>2008-01-18 18:17:40 +0200
commit12c00111b68c9cf4872a424258c6f8b7247aac47 (patch)
tree183e2fa028dd2b56c18b0bac55050f88e8c9be98 /src
parent24c7d134cd450f9e2cca85e4a2fc3253d250be04 (diff)
use stand-alone drivers for each chip family.
Do not load the ati wrapper when the user specifies the sub-driver name in the Driver line of xorg.conf. Also, for -configure cause the wrapper to fail and let each sub-driver speak for themselves.
Diffstat (limited to 'src')
-rw-r--r--src/ati.c39
-rw-r--r--src/ati.h2
-rw-r--r--src/atimach64probe.h2
-rw-r--r--src/atimisc.c6
-rw-r--r--src/atimodule.c2
-rw-r--r--src/r128_misc.c5
-rw-r--r--src/r128_probe.h2
-rw-r--r--src/radeon_misc.c5
-rw-r--r--src/radeon_probe.h2
9 files changed, 56 insertions, 9 deletions
diff --git a/src/ati.c b/src/ati.c
index caee4439..89e62dc4 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -81,6 +81,29 @@ enum
ATI_CHIP_FAMILY_Radeon
};
+/*
+ * Record which sub-drivers have already been loaded, and thus have called
+ * xf86AddDriver(). For those sub-drivers, cause the ati wrapper later to fail
+ * when probing.
+ *
+ * The check is only called once when the ati wrapper is loaded and depends on
+ * the X server loading all drivers before doing any probes.
+ */
+static Bool mach64_drv_added = FALSE;
+static Bool r128_drv_added = FALSE;
+static Bool radeon_drv_added = FALSE;
+
+void
+ati_check_subdriver_added()
+{
+ if (LoaderSymbol(MACH64_NAME))
+ mach64_drv_added = TRUE;
+ if (LoaderSymbol(R128_NAME))
+ r128_drv_added = TRUE;
+ if (LoaderSymbol(RADEON_NAME))
+ radeon_drv_added = TRUE;
+}
+
static int ATIChipID(const CARD16);
#ifdef XSERVER_LIBPCIACCESS
@@ -142,6 +165,10 @@ ATIProbe
Bool DoRage128 = FALSE, DoRadeon = FALSE;
int Chip;
+ /* Let the sub-drivers probe & configure for themselves */
+ if (xf86ServerIsOnlyDetecting())
+ return FALSE;
+
#ifndef XSERVER_LIBPCIACCESS
xf86PciVideoInfo = xf86GetPciVideoInfo();
@@ -199,6 +226,10 @@ ATIProbe
{
DriverRec *radeon;
+ /* If the sub-driver was added, let it probe for itself */
+ if (radeon_drv_added)
+ return FALSE;
+
if (!LoaderSymbol(RADEON_NAME))
xf86LoadDrvSubModule(pDriver, RADEON_DRIVER_NAME);
@@ -222,6 +253,10 @@ ATIProbe
{
DriverRec *r128;
+ /* If the sub-driver was added, let it probe for itself */
+ if (r128_drv_added)
+ return FALSE;
+
if (!LoaderSymbol(R128_NAME))
xf86LoadDrvSubModule(pDriver, R128_DRIVER_NAME);
@@ -245,6 +280,10 @@ ATIProbe
{
DriverRec *mach64;
+ /* If the sub-driver was added, let it probe for itself */
+ if (mach64_drv_added)
+ return FALSE;
+
if (!LoaderSymbol(MACH64_NAME))
xf86LoadDrvSubModule(pDriver, MACH64_DRIVER_NAME);
diff --git a/src/ati.h b/src/ati.h
index 0a32acf0..e86e50c1 100644
--- a/src/ati.h
+++ b/src/ati.h
@@ -31,6 +31,8 @@
#include "xf86_OSproc.h"
+extern void ati_check_subdriver_added();
+
extern DriverRec ATI;
#endif /* ___ATI_H___ */
diff --git a/src/atimach64probe.h b/src/atimach64probe.h
index 9d50b638..7b0b4b67 100644
--- a/src/atimach64probe.h
+++ b/src/atimach64probe.h
@@ -25,6 +25,8 @@
#include "xf86str.h"
+extern DriverRec MACH64;
+
extern SymTabRec Mach64Chipsets[];
#endif /* ___ATIMACH64PROBE_H___ */
diff --git a/src/atimisc.c b/src/atimisc.c
index d71b0ad4..cf2347a3 100644
--- a/src/atimisc.c
+++ b/src/atimisc.c
@@ -27,6 +27,7 @@
#include "ati.h"
#include "ativersion.h"
+#include "atimach64probe.h"
#include "atimach64version.h"
/* Module loader interface for subsidiary driver module */
@@ -63,9 +64,8 @@ ATISetup
if (!Inited)
{
- /* Ensure main driver module is loaded, but not as a submodule */
- if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME))
- xf86LoadOneModule(ATI_DRIVER_NAME, Options);
+ if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
+ xf86AddDriver(&MACH64, Module, 0);
Inited = TRUE;
}
diff --git a/src/atimodule.c b/src/atimodule.c
index 12b4ffd9..802c35ad 100644
--- a/src/atimodule.c
+++ b/src/atimodule.c
@@ -63,6 +63,8 @@ ATISetup
{
Inited = TRUE;
xf86AddDriver(&ATI, Module, 0);
+
+ ati_check_subdriver_added();
}
return (pointer)1;
diff --git a/src/r128_misc.c b/src/r128_misc.c
index 49d2803b..f8bccfef 100644
--- a/src/r128_misc.c
+++ b/src/r128_misc.c
@@ -65,9 +65,8 @@ R128Setup
if (!Inited)
{
- /* Ensure main driver module is loaded, but not as a submodule */
- if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME))
- xf86LoadOneModule(ATI_DRIVER_NAME, Options);
+ if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
+ xf86AddDriver(&R128, Module, 0);
Inited = TRUE;
}
diff --git a/src/r128_probe.h b/src/r128_probe.h
index 28856044..719340a0 100644
--- a/src/r128_probe.h
+++ b/src/r128_probe.h
@@ -38,6 +38,8 @@
#include "xf86str.h"
+extern DriverRec R128;
+
typedef struct
{
Bool IsDRIEnabled;
diff --git a/src/radeon_misc.c b/src/radeon_misc.c
index 7840376a..fc608ddc 100644
--- a/src/radeon_misc.c
+++ b/src/radeon_misc.c
@@ -64,9 +64,8 @@ RADEONSetup
static Bool Inited = FALSE;
if (!Inited) {
- /* Ensure main driver module is loaded, but not as a submodule */
- if (!xf86ServerIsOnlyDetecting() && !LoaderSymbol(ATI_NAME))
- xf86LoadOneModule(ATI_DRIVER_NAME, Options);
+ if (xf86ServerIsOnlyDetecting() || !LoaderSymbol(ATI_NAME))
+ xf86AddDriver(&RADEON, Module, 0);
Inited = TRUE;
}
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index ef4ddbcf..17c0f1b1 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -53,6 +53,8 @@
#include "xaa.h"
#endif
+extern DriverRec RADEON;
+
typedef enum
{
MT_UNKNOWN = -1,