From 43ba22ef4a4142f334e9ae2d926250988ecbe8bc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 17 Feb 2013 09:25:38 +0000 Subject: [PATCH] Confirm that i915.ko has KMS enabled before binding to the device If the kernel has the module, but the KMS module option is not enabled, we cannot function. So after checking to see if the i915.ko is bound, then querying whether it provides any KMS resources. If it has no CRTCs attached, then we need to failover to the VESA/fbdev drivers. Note that this should have been detected by drmCheckModesettingSupported() References: https://bugs.freedesktop.org/show_bug.cgi?id=60987 Signed-off-by: Chris Wilson --- src/intel_module.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/intel_module.c b/src/intel_module.c index 141f77af..bd9b9bb6 100644 --- a/src/intel_module.c +++ b/src/intel_module.c @@ -419,6 +419,15 @@ static Bool has_kernel_mode_setting(const struct pci_device *dev) if (drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp)) ret = FALSE; } + if (ret) { + struct drm_mode_card_res res; + + memset(&res, 0, sizeof(res)); + if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res) == 0) + ret = res.count_crtcs != 0; + else + ret = FALSE; + } close(fd); }