Pass the chipset info through driverPrivate rather than a global pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
2b3f4ca33a
commit
05dcc5f169
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue