summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Sapountzis <gsap7@yahoo.gr>2008-01-12 16:18:34 +0200
committerGeorge Sapountzis <gsap7@yahoo.gr>2008-01-16 16:15:57 +0200
commitc2caeb11a97dad5379d70881c5c0fd834a8c3d54 (patch)
tree00718c716fa2ddebe3f27cb0a62fa5f997c3bc90 /src
parent19e1b180fec6f83a474e125465bc60111c0f43e0 (diff)
ati wrapper: add DriverRec's and use them
Diffstat (limited to 'src')
-rw-r--r--src/ati.c100
-rw-r--r--src/atimach64probe.c17
-rw-r--r--src/atimach64probe.h6
-rw-r--r--src/r128_probe.c17
-rw-r--r--src/r128_probe.h4
-rw-r--r--src/radeon_probe.c17
-rw-r--r--src/radeon_probe.h4
7 files changed, 117 insertions, 48 deletions
diff --git a/src/ati.c b/src/ati.c
index 5a4eb019..caee4439 100644
--- a/src/ati.c
+++ b/src/ati.c
@@ -65,9 +65,13 @@
#include "ati.h"
#include "ativersion.h"
-#include "atimach64probe.h"
-#include "radeon_probe.h"
-#include "r128_probe.h"
+/* names duplicated from version headers */
+#define MACH64_NAME "MACH64"
+#define MACH64_DRIVER_NAME "mach64"
+#define R128_NAME "R128"
+#define R128_DRIVER_NAME "r128"
+#define RADEON_NAME "RADEON"
+#define RADEON_DRIVER_NAME "radeon"
enum
{
@@ -193,61 +197,70 @@ ATIProbe
/* Call Radeon driver probe */
if (DoRadeon)
{
- pointer radeon = xf86LoadDrvSubModule(pDriver, "radeon");
+ DriverRec *radeon;
+
+ if (!LoaderSymbol(RADEON_NAME))
+ xf86LoadDrvSubModule(pDriver, RADEON_DRIVER_NAME);
+
+ radeon = (DriverRec*)LoaderSymbol(RADEON_NAME);
if (!radeon)
{
xf86Msg(X_ERROR,
- ATI_NAME ": Failed to load \"radeon\" module.\n");
+ ATI_NAME ": Failed to find \"radeon\" driver symbol.\n");
return FALSE;
}
- RADEONIdentify(flags);
+ radeon->Identify(flags);
- if (RADEONProbe(pDriver, flags))
+ if (radeon->Probe(pDriver, flags))
return TRUE;
-
- xf86UnloadSubModule(radeon);
}
/* Call Rage 128 driver probe */
if (DoRage128)
{
- pointer r128 = xf86LoadDrvSubModule(pDriver, "r128");
+ DriverRec *r128;
+
+ if (!LoaderSymbol(R128_NAME))
+ xf86LoadDrvSubModule(pDriver, R128_DRIVER_NAME);
+
+ r128 = (DriverRec*)LoaderSymbol(R128_NAME);
if (!r128)
{
xf86Msg(X_ERROR,
- ATI_NAME ": Failed to load \"r128\" module.\n");
+ ATI_NAME ": Failed to find \"r128\" driver symbol.\n");
return FALSE;
}
- R128Identify(flags);
+ r128->Identify(flags);
- if (R128Probe(pDriver, flags))
+ if (r128->Probe(pDriver, flags))
return TRUE;
-
- xf86UnloadSubModule(r128);
}
/* Call Mach64 driver probe */
if (DoMach64)
{
- pointer mach64 = xf86LoadDrvSubModule(pDriver, "mach64");
+ DriverRec *mach64;
+
+ if (!LoaderSymbol(MACH64_NAME))
+ xf86LoadDrvSubModule(pDriver, MACH64_DRIVER_NAME);
+
+ mach64 = (DriverRec*)LoaderSymbol(MACH64_NAME);
if (!mach64)
{
xf86Msg(X_ERROR,
- ATI_NAME ": Failed to load \"mach64\" module.\n");
+ ATI_NAME ": Failed to find \"mach64\" driver symbol.\n");
return FALSE;
}
- Mach64Identify(flags);
+ mach64->Identify(flags);
- if (Mach64Probe(pDriver, flags))
+ if (mach64->Probe(pDriver, flags))
return TRUE;
-
- xf86UnloadSubModule(mach64);
}
return FALSE;
@@ -272,11 +285,46 @@ ATIAvailableOptions
Chip = ATIChipID(ChipType);
if (Chip == ATI_CHIP_FAMILY_Mach64)
- return Mach64AvailableOptions(ChipId, BusId);
- else if (Chip == ATI_CHIP_FAMILY_Rage128)
- return R128AvailableOptions(ChipId, BusId);
- else if (Chip == ATI_CHIP_FAMILY_Radeon)
- return RADEONAvailableOptions(ChipId, BusId);
+ {
+ DriverRec *mach64 = (DriverRec*)LoaderSymbol(MACH64_NAME);
+
+ if (!mach64)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to find \"mach64\" driver symbol.\n");
+ return NULL;
+ }
+
+ return mach64->AvailableOptions(ChipId, BusId);
+ }
+
+ if (Chip == ATI_CHIP_FAMILY_Rage128)
+ {
+ DriverRec *r128 = (DriverRec*)LoaderSymbol(R128_NAME);
+
+ if (!r128)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to find \"r128\" driver symbol.\n");
+ return NULL;
+ }
+
+ return r128->AvailableOptions(ChipId, BusId);
+ }
+
+ if (Chip == ATI_CHIP_FAMILY_Radeon)
+ {
+ DriverRec *radeon = (DriverRec*)LoaderSymbol(RADEON_NAME);
+
+ if (!radeon)
+ {
+ xf86Msg(X_ERROR,
+ ATI_NAME ": Failed to find \"radeon\" driver symbol.\n");
+ return NULL;
+ }
+
+ return radeon->AvailableOptions(ChipId, BusId);
+ }
return NULL;
}
diff --git a/src/atimach64probe.c b/src/atimach64probe.c
index 5227775e..ffab153b 100644
--- a/src/atimach64probe.c
+++ b/src/atimach64probe.c
@@ -107,7 +107,7 @@ Mach64PciChipsets[] = {
{-1, -1, RES_UNDEFINED}
};
-_X_EXPORT const OptionInfoRec *
+static const OptionInfoRec *
Mach64AvailableOptions(int chipid, int busid)
{
/*
@@ -122,7 +122,7 @@ Mach64AvailableOptions(int chipid, int busid)
*
* Print the driver's list of chipset names.
*/
-_X_EXPORT void
+static void
Mach64Identify
(
int flags
@@ -138,7 +138,7 @@ Mach64Identify
* This function is called once, at the start of the first server generation to
* do a minimal probe for supported hardware.
*/
-_X_EXPORT Bool
+static Bool
Mach64Probe(DriverPtr pDriver, int flags)
{
GDevPtr *devSections, *ATIGDevs, *Mach64GDevs;
@@ -221,3 +221,14 @@ Mach64Probe(DriverPtr pDriver, int flags)
return ProbeSuccess;
}
+
+_X_EXPORT DriverRec MACH64 =
+{
+ MACH64_VERSION_CURRENT,
+ MACH64_DRIVER_NAME,
+ Mach64Identify,
+ Mach64Probe,
+ Mach64AvailableOptions,
+ NULL,
+ 0
+};
diff --git a/src/atimach64probe.h b/src/atimach64probe.h
index 65ced985..9d50b638 100644
--- a/src/atimach64probe.h
+++ b/src/atimach64probe.h
@@ -25,10 +25,6 @@
#include "xf86str.h"
-extern SymTabRec Mach64Chipsets[];
-
-extern const OptionInfoRec * Mach64AvailableOptions(int, int);
-extern void Mach64Identify(int);
-extern Bool Mach64Probe(DriverPtr, int);
+extern SymTabRec Mach64Chipsets[];
#endif /* ___ATIMACH64PROBE_H___ */
diff --git a/src/r128_probe.c b/src/r128_probe.c
index 0be21e8a..5dd5cc9c 100644
--- a/src/r128_probe.c
+++ b/src/r128_probe.c
@@ -106,7 +106,7 @@ PciChipsets R128PciChipsets[] = {
int gR128EntityIndex = -1;
/* Return the options for supported chipset 'n'; NULL otherwise */
-_X_EXPORT const OptionInfoRec *
+static const OptionInfoRec *
R128AvailableOptions(int chipid, int busid)
{
int i;
@@ -125,7 +125,7 @@ R128AvailableOptions(int chipid, int busid)
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
-_X_EXPORT void
+static void
R128Identify(int flags)
{
xf86PrintChipsets(R128_NAME,
@@ -134,7 +134,7 @@ R128Identify(int flags)
}
/* Return TRUE if chipset is present; FALSE otherwise. */
-_X_EXPORT Bool
+static Bool
R128Probe(DriverPtr drv, int flags)
{
int numUsed;
@@ -253,3 +253,14 @@ R128Probe(DriverPtr drv, int flags)
return foundScreen;
}
+
+_X_EXPORT DriverRec R128 =
+{
+ R128_VERSION_CURRENT,
+ R128_DRIVER_NAME,
+ R128Identify,
+ R128Probe,
+ R128AvailableOptions,
+ NULL,
+ 0
+};
diff --git a/src/r128_probe.h b/src/r128_probe.h
index 82d0fbea..28856044 100644
--- a/src/r128_probe.h
+++ b/src/r128_probe.h
@@ -54,10 +54,6 @@ typedef struct
} R128EntRec, *R128EntPtr;
/* r128_probe.c */
-extern const OptionInfoRec * R128AvailableOptions(int, int);
-extern void R128Identify(int);
-extern Bool R128Probe(DriverPtr, int);
-
extern PciChipsets R128PciChipsets[];
/* r128_driver.c */
diff --git a/src/radeon_probe.c b/src/radeon_probe.c
index e0a77e6b..0cf54b6c 100644
--- a/src/radeon_probe.c
+++ b/src/radeon_probe.c
@@ -58,7 +58,7 @@
int gRADEONEntityIndex = -1;
/* Return the options for supported chipset 'n'; NULL otherwise */
-_X_EXPORT const OptionInfoRec *
+static const OptionInfoRec *
RADEONAvailableOptions(int chipid, int busid)
{
int i;
@@ -77,7 +77,7 @@ RADEONAvailableOptions(int chipid, int busid)
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
-_X_EXPORT void
+static void
RADEONIdentify(int flags)
{
xf86PrintChipsets(RADEON_NAME,
@@ -86,7 +86,7 @@ RADEONIdentify(int flags)
}
/* Return TRUE if chipset is present; FALSE otherwise. */
-_X_EXPORT Bool
+static Bool
RADEONProbe(DriverPtr drv, int flags)
{
int numUsed;
@@ -207,3 +207,14 @@ RADEONProbe(DriverPtr drv, int flags)
return foundScreen;
}
+
+_X_EXPORT DriverRec RADEON =
+{
+ RADEON_VERSION_CURRENT,
+ RADEON_DRIVER_NAME,
+ RADEONIdentify,
+ RADEONProbe,
+ RADEONAvailableOptions,
+ NULL,
+ 0
+};
diff --git a/src/radeon_probe.h b/src/radeon_probe.h
index 5828133b..37cd6e65 100644
--- a/src/radeon_probe.h
+++ b/src/radeon_probe.h
@@ -543,10 +543,6 @@ typedef struct
} RADEONEntRec, *RADEONEntPtr;
/* radeon_probe.c */
-extern const OptionInfoRec *RADEONAvailableOptions(int, int);
-extern void RADEONIdentify(int);
-extern Bool RADEONProbe(DriverPtr, int);
-
extern PciChipsets RADEONPciChipsets[];
/* radeon_driver.c */