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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-02-17 09:25:38 +00:00
parent 5a5943e237
commit 43ba22ef4a
1 changed files with 9 additions and 0 deletions

View File

@ -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);
}