sna: Allow booting on older kernels by disabling HW acceleration

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-07-03 10:21:06 +01:00
parent affdebcb2d
commit e3bc91842b
2 changed files with 16 additions and 15 deletions

View File

@ -595,6 +595,20 @@ static bool __kgem_throttle(struct kgem *kgem)
return drmIoctl(kgem->fd, DRM_IOCTL_I915_GEM_THROTTLE, NULL) == -EIO;
}
static bool is_hw_supported(struct kgem *kgem)
{
if (DBG_NO_HW)
return false;
if (kgem->gen >= 60) /* Only if the kernel supports the BLT ring */
return gem_param(kgem, I915_PARAM_HAS_BLT) > 0;
if (kgem->gen <= 20) /* dynamic GTT is fubar */
return false;
return true;
}
void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
{
struct drm_i915_gem_get_aperture aperture;
@ -607,7 +621,7 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
kgem->fd = fd;
kgem->gen = gen;
kgem->wedged = __kgem_throttle(kgem);
kgem->wedged |= DBG_NO_HW;
kgem->wedged |= !is_hw_supported(kgem);
kgem->batch_size = ARRAY_SIZE(kgem->batch);
if (gen == 22)

View File

@ -294,8 +294,7 @@ static int sna_open_drm_master(ScrnInfoPtr scrn)
struct sna *sna = to_sna(scrn);
struct pci_device *pci = sna->PciInfo;
drmSetVersion sv;
struct drm_i915_getparam gp;
int err, val;
int err;
char busid[20];
int fd;
@ -335,18 +334,6 @@ static int sna_open_drm_master(ScrnInfoPtr scrn)
return -1;
}
val = FALSE;
VG_CLEAR(gp);
gp.param = I915_PARAM_HAS_BLT;
gp.value = &val;
if (drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to detect BLT. Kernel 2.6.37 required.\n");
drmClose(fd);
return -1;
}
dev = malloc(sizeof(*dev));
if (dev) {
int flags;