Refactor the common probe methods for scrn construction
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
0040eb84c9
commit
13f47008ec
|
|
@ -462,50 +462,15 @@ static enum accel_method { UXA, SNA } get_accel_method(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
static Bool
|
||||||
* intel_pci_probe --
|
intel_scrn_create(DriverPtr driver,
|
||||||
*
|
int entity_num,
|
||||||
* Look through the PCI bus to find cards that are intel boards.
|
intptr_t match_data,
|
||||||
* Setup the dispatch table for the rest of the driver functions.
|
unsigned flags)
|
||||||
*
|
|
||||||
*/
|
|
||||||
static Bool intel_pci_probe(DriverPtr driver,
|
|
||||||
int entity_num,
|
|
||||||
struct pci_device *device,
|
|
||||||
intptr_t match_data)
|
|
||||||
{
|
{
|
||||||
ScrnInfoPtr scrn;
|
ScrnInfoPtr scrn;
|
||||||
PciChipsets intel_pci_chipsets[NUM_CHIPSETS];
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (!has_kernel_mode_setting(device)) {
|
scrn = xf86AllocateScreen(driver, flags);
|
||||||
#if KMS_ONLY
|
|
||||||
return FALSE;
|
|
||||||
#else
|
|
||||||
switch (DEVICE_ID(device)) {
|
|
||||||
case PCI_CHIP_I810:
|
|
||||||
case PCI_CHIP_I810_DC100:
|
|
||||||
case PCI_CHIP_I810_E:
|
|
||||||
case PCI_CHIP_I815:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < NUM_CHIPSETS; i++) {
|
|
||||||
intel_pci_chipsets[i].numChipset = intel_chipsets[i].token;
|
|
||||||
intel_pci_chipsets[i].PCIid = intel_chipsets[i].token;
|
|
||||||
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,6,99,0,0)
|
|
||||||
intel_pci_chipsets[i].resList = RES_SHARED_VGA;
|
|
||||||
#else
|
|
||||||
intel_pci_chipsets[i].dummy = NULL;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
|
|
||||||
NULL, NULL, NULL, NULL, NULL);
|
|
||||||
if (scrn == NULL)
|
if (scrn == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
@ -515,6 +480,10 @@ static Bool intel_pci_probe(DriverPtr driver,
|
||||||
scrn->driverPrivate = (void *)(match_data | 1);
|
scrn->driverPrivate = (void *)(match_data | 1);
|
||||||
scrn->Probe = NULL;
|
scrn->Probe = NULL;
|
||||||
|
|
||||||
|
if (xf86IsEntitySharable(entity_num))
|
||||||
|
xf86SetEntityShared(entity_num);
|
||||||
|
xf86AddEntityToScreen(scrn, entity_num);
|
||||||
|
|
||||||
#if !KMS_ONLY
|
#if !KMS_ONLY
|
||||||
switch (DEVICE_ID(device)) {
|
switch (DEVICE_ID(device)) {
|
||||||
case PCI_CHIP_I810:
|
case PCI_CHIP_I810:
|
||||||
|
|
@ -530,7 +499,6 @@ static Bool intel_pci_probe(DriverPtr driver,
|
||||||
#if USE_SNA
|
#if USE_SNA
|
||||||
case SNA: return sna_init_scrn(scrn, entity_num);
|
case SNA: return sna_init_scrn(scrn, entity_num);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USE_UXA
|
#if USE_UXA
|
||||||
case UXA: return intel_init_scrn(scrn);
|
case UXA: return intel_init_scrn(scrn);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -542,6 +510,37 @@ static Bool intel_pci_probe(DriverPtr driver,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* intel_pci_probe --
|
||||||
|
*
|
||||||
|
* Look through the PCI bus to find cards that are intel boards.
|
||||||
|
* Setup the dispatch table for the rest of the driver functions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
static Bool intel_pci_probe(DriverPtr driver,
|
||||||
|
int entity_num,
|
||||||
|
struct pci_device *device,
|
||||||
|
intptr_t match_data)
|
||||||
|
{
|
||||||
|
if (!has_kernel_mode_setting(device)) {
|
||||||
|
#if KMS_ONLY
|
||||||
|
return FALSE;
|
||||||
|
#else
|
||||||
|
switch (DEVICE_ID(device)) {
|
||||||
|
case PCI_CHIP_I810:
|
||||||
|
case PCI_CHIP_I810_DC100:
|
||||||
|
case PCI_CHIP_I810_E:
|
||||||
|
case PCI_CHIP_I815:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return intel_scrn_create(driver, entity_num, match_data, 0);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XSERVER_PLATFORM_BUS
|
#ifdef XSERVER_PLATFORM_BUS
|
||||||
static Bool
|
static Bool
|
||||||
intel_platform_probe(DriverPtr driver,
|
intel_platform_probe(DriverPtr driver,
|
||||||
|
|
@ -549,7 +548,6 @@ intel_platform_probe(DriverPtr driver,
|
||||||
struct xf86_platform_device *dev,
|
struct xf86_platform_device *dev,
|
||||||
intptr_t match_data)
|
intptr_t match_data)
|
||||||
{
|
{
|
||||||
ScrnInfoPtr scrn = NULL;
|
|
||||||
char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
|
char *path = xf86_get_platform_device_attrib(dev, ODEV_ATTRIB_PATH);
|
||||||
unsigned scrn_flags = 0;
|
unsigned scrn_flags = 0;
|
||||||
|
|
||||||
|
|
@ -569,37 +567,10 @@ intel_platform_probe(DriverPtr driver,
|
||||||
if (flags)
|
if (flags)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
scrn = xf86AllocateScreen(driver, scrn_flags);
|
|
||||||
if (scrn == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
scrn->driverVersion = INTEL_VERSION;
|
|
||||||
scrn->driverName = INTEL_DRIVER_NAME;
|
|
||||||
scrn->name = INTEL_NAME;
|
|
||||||
scrn->driverPrivate = (void *)(match_data | 1);
|
|
||||||
scrn->Probe = NULL;
|
|
||||||
|
|
||||||
if (xf86IsEntitySharable(entity_num))
|
|
||||||
xf86SetEntityShared(entity_num);
|
|
||||||
xf86AddEntityToScreen(scrn, entity_num);
|
|
||||||
|
|
||||||
xf86DrvMsg(scrn->scrnIndex, X_INFO,
|
xf86DrvMsg(scrn->scrnIndex, X_INFO,
|
||||||
"using device path '%s'\n", path ? path : "Default device");
|
"using device path '%s'\n", path ? path : "Default device");
|
||||||
|
|
||||||
#if !UMS_ONLY
|
return intel_scrn_create(driver, entity_num, match_data, scrn_flags);
|
||||||
switch (get_accel_method()) {
|
|
||||||
#if USE_SNA
|
|
||||||
case SNA: return sna_init_scrn(scrn, entity_num);
|
|
||||||
#endif
|
|
||||||
#if USE_UXA
|
|
||||||
case UXA: return intel_init_scrn(scrn);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue