summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-02 13:32:58 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-10-02 13:32:58 +0100
commit455f2939a661764ebb8d1747d44e16a0a8937808 (patch)
tree395f7d286638161c1f8d9100f8d3d88eb1ffce92
parent97fea2fd0c36d78f4e940b124a7886c4a3f3dfc7 (diff)
Do not claim the PCI device if !KMS
By returning FALSE whilst probing if we can't find a KMS driver, we allow X to fallback to trying the VESA driver -- rather than failing. The initial idea for this was by Julien Cristau. Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/intel_driver.c35
-rw-r--r--src/intel_module.c46
2 files changed, 42 insertions, 39 deletions
diff --git a/src/intel_driver.c b/src/intel_driver.c
index 79c850b5..43916726 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -262,33 +262,6 @@ static void PreInitCleanup(ScrnInfoPtr scrn)
scrn->driverPrivate = NULL;
}
-/*
- * DRM mode setting Linux only at this point... later on we could
- * add a wrapper here.
- */
-static Bool intel_kernel_mode_enabled(ScrnInfoPtr scrn)
-{
- struct pci_device *dev;
- char id[20];
- int ret;
-
- dev = xf86GetPciInfoForEntity(xf86GetEntityInfo(scrn->entityList[0])->index);
- snprintf(id, sizeof(id),
- "pci:%04x:%02x:%02x.%d",
- dev->domain, dev->bus, dev->dev, dev->func);
-
- ret = drmCheckModesettingSupported(id);
- if (ret) {
- if (xf86LoadKernelModule("i915"))
- ret = drmCheckModesettingSupported(id);
- }
- /* Be nice to the user and load fbcon too */
- if (!ret)
- (void)xf86LoadKernelModule("fbcon");
-
- return ret == 0;
-}
-
static void intel_check_chipset_option(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
@@ -513,18 +486,10 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
EntityInfoPtr pEnt;
int flags24;
Gamma zeros = { 0.0, 0.0, 0.0 };
- int drm_mode_setting;
if (scrn->numEntities != 1)
return FALSE;
- drm_mode_setting = intel_kernel_mode_enabled(scrn);
- if (!drm_mode_setting) {
- xf86DrvMsg(scrn->scrnIndex, X_ERROR,
- "No kernel modesetting driver detected.\n");
- return FALSE;
- }
-
pEnt = xf86GetEntityInfo(scrn->entityList[0]);
if (flags & PROBE_DETECT)
diff --git a/src/intel_module.c b/src/intel_module.c
index 53e1cb62..8fd55edc 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -37,6 +37,8 @@
#include "intel_driver.h"
#include "legacy/legacy.h"
+#include <xf86drmMode.h>
+
static const SymTabRec _intel_chipsets[] = {
{PCI_CHIP_I810, "i810"},
{PCI_CHIP_I810_DC100, "i810-dc100"},
@@ -361,6 +363,27 @@ static Bool intel_driver_func(ScrnInfoPtr pScrn,
}
}
+static Bool has_kernel_mode_setting(struct pci_device *dev)
+{
+ char id[20];
+ int ret;
+
+ snprintf(id, sizeof(id),
+ "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func);
+
+ ret = drmCheckModesettingSupported(id);
+ if (ret) {
+ if (xf86LoadKernelModule("i915"))
+ ret = drmCheckModesettingSupported(id);
+ }
+ /* Be nice to the user and load fbcon too */
+ if (!ret)
+ (void)xf86LoadKernelModule("fbcon");
+
+ return ret == 0;
+}
+
/*
* intel_pci_probe --
*
@@ -373,11 +396,26 @@ static Bool intel_pci_probe (DriverPtr driver,
struct pci_device *device,
intptr_t match_data)
{
- ScrnInfoPtr scrn = NULL;
+ ScrnInfoPtr scrn;
- scrn = xf86ConfigPciEntity(scrn, 0, entity_num, intel_pci_chipsets,
- NULL,
- NULL, NULL, NULL, NULL);
+ 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
+ }
+
+ scrn = xf86ConfigPciEntity(NULL, 0, entity_num, intel_pci_chipsets,
+ NULL, NULL, NULL, NULL, NULL);
if (scrn != NULL) {
scrn->driverVersion = INTEL_VERSION;
scrn->driverName = INTEL_DRIVER_NAME;