summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-08-03 15:08:45 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-08-03 21:42:28 +0100
commit05dcc5f1699ba90fc14c50882e8d4be89bc4a4f9 (patch)
treeacc433746fcc878f00e3e464924151ccb0218b66
parent2b3f4ca33a00440a7005fef69099f8dbaddbbad1 (diff)
Pass the chipset info through driverPrivate rather than a global pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_driver.c9
-rw-r--r--src/intel_driver.h6
-rw-r--r--src/intel_module.c11
-rw-r--r--src/legacy/i810/i810_driver.c2
-rw-r--r--src/sna/sna_driver.c7
5 files changed, 17 insertions, 18 deletions
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 0e27c48f..1ef06fbb 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -186,7 +186,7 @@ static void PreInitCleanup(ScrnInfoPtr scrn)
static void intel_check_chipset_option(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
- intel->info = intel_detect_chipset(scrn, intel->pEnt, intel->PciInfo);
+ intel_detect_chipset(scrn, intel->pEnt, intel->PciInfo);
}
static Bool I830GetEarlyOptions(ScrnInfoPtr scrn)
@@ -458,14 +458,15 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
if (flags & PROBE_DETECT)
return TRUE;
- intel = intel_get_screen_private(scrn);
- if (intel == NULL) {
- intel = xnfcalloc(sizeof(intel_screen_private), 1);
+ if (((uintptr_t)scrn->driverPrivate) & 1) {
+ intel = xnfcalloc(sizeof(*intel), 1);
if (intel == NULL)
return FALSE;
+ intel->info = (void *)((uintptr_t)scrn->driverPrivate & ~1);
scrn->driverPrivate = intel;
}
+ intel = intel_get_screen_private(scrn);
intel->scrn = scrn;
intel->pEnt = pEnt;
diff --git a/src/intel_driver.h b/src/intel_driver.h
index d760cb49..882d8895 100644
--- a/src/intel_driver.h
+++ b/src/intel_driver.h
@@ -238,9 +238,9 @@ struct intel_device_info {
int gen;
};
-const struct intel_device_info *
-intel_detect_chipset(ScrnInfoPtr scrn,
- EntityInfoPtr ent, struct pci_device *pci);
+void intel_detect_chipset(ScrnInfoPtr scrn,
+ EntityInfoPtr ent,
+ struct pci_device *pci);
#endif /* INTEL_DRIVER_H */
diff --git a/src/intel_module.c b/src/intel_module.c
index f1d9fc03..ae19f754 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -44,8 +44,6 @@
#include "legacy/legacy.h"
#include "sna/sna_module.h"
-static struct intel_device_info *chipset_info;
-
static const struct intel_device_info intel_generic_info = {
.gen = -1,
};
@@ -227,9 +225,10 @@ static const struct pci_id_match intel_device_match[] = {
{ 0, 0, 0 },
};
-const struct intel_device_info *
+void
intel_detect_chipset(ScrnInfoPtr scrn,
- EntityInfoPtr ent, struct pci_device *pci)
+ EntityInfoPtr ent,
+ struct pci_device *pci)
{
MessageType from = X_PROBED;
const char *name = NULL;
@@ -258,7 +257,6 @@ intel_detect_chipset(ScrnInfoPtr scrn,
}
scrn->chipset = name;
- return chipset_info;
}
/*
@@ -368,8 +366,6 @@ static Bool intel_pci_probe(DriverPtr driver,
PciChipsets intel_pci_chipsets[NUM_CHIPSETS];
unsigned i;
- chipset_info = (void *)match_data;
-
if (!has_kernel_mode_setting(device)) {
#if KMS_ONLY
return FALSE;
@@ -404,6 +400,7 @@ static Bool intel_pci_probe(DriverPtr driver,
scrn->driverVersion = INTEL_VERSION;
scrn->driverName = INTEL_DRIVER_NAME;
scrn->name = INTEL_NAME;
+ scrn->driverPrivate = (void *)(match_data | 1);
scrn->Probe = NULL;
#if !KMS_ONLY
diff --git a/src/legacy/i810/i810_driver.c b/src/legacy/i810/i810_driver.c
index 949fd274..fc6369ee 100644
--- a/src/legacy/i810/i810_driver.c
+++ b/src/legacy/i810/i810_driver.c
@@ -152,7 +152,7 @@ static int i810_pitches[] = {
static Bool
I810GetRec(ScrnInfoPtr scrn)
{
- if (scrn->driverPrivate)
+ if (((uintptr_t)scrn->driverPrivate & 1) == 0)
return TRUE;
scrn->driverPrivate = xnfcalloc(sizeof(I810Rec), 1);
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c
index bd31996b..2ccad598 100644
--- a/src/sna/sna_driver.c
+++ b/src/sna/sna_driver.c
@@ -383,14 +383,15 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
sna_selftest();
- sna = to_sna(scrn);
- if (sna == NULL) {
+ if (((uintptr_t)scrn->driverPrivate) & 1) {
sna = xnfcalloc(sizeof(struct sna), 1);
if (sna == NULL)
return FALSE;
+ sna->info = (void *)((uintptr_t)scrn->driverPrivate & ~1);
scrn->driverPrivate = sna;
}
+ sna = to_sna(scrn);
sna->scrn = scrn;
sna->pEnt = pEnt;
@@ -438,7 +439,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int flags)
if (sna->Options == NULL)
return FALSE;
- sna->info = intel_detect_chipset(scrn, sna->pEnt, sna->PciInfo);
+ intel_detect_chipset(scrn, sna->pEnt, sna->PciInfo);
kgem_init(&sna->kgem, fd, sna->PciInfo, sna->info->gen);
if (xf86ReturnOptValBool(sna->Options, OPTION_ACCEL_DISABLE, FALSE)) {