diff options
-rw-r--r-- | src/i830_driver.c | 17 | ||||
-rw-r--r-- | src/i830_memory.c | 16 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index ef4d5758..0b6bb718 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1420,7 +1420,8 @@ i830_open_drm_master(ScrnInfoPtr scrn) struct pci_device *dev = i830->PciInfo; char *busid; drmSetVersion sv; - int err; + struct drm_i915_getparam gp; + int err, has_gem; /* We wish we had asprintf, but all we get is XNFprintf. */ busid = XNFprintf("pci:%04x:%02x:%02x.%d", @@ -1428,6 +1429,7 @@ i830_open_drm_master(ScrnInfoPtr scrn) i830->drmSubFD = drmOpen("i915", busid); if (i830->drmSubFD == -1) { + xfree(busid); xf86DrvMsg(scrn->scrnIndex, X_ERROR, "[drm] Failed to open DRM device for %s\n", busid); return FALSE; @@ -1449,6 +1451,19 @@ i830_open_drm_master(ScrnInfoPtr scrn) return FALSE; } + has_gem = FALSE; + gp.param = I915_PARAM_HAS_GEM; + gp.value = &has_gem; + (void)drmCommandWriteRead(i830->drmSubFD, DRM_I915_GETPARAM, + &gp, sizeof(gp)); + if (!has_gem) { + xf86DrvMsg(scrn->scrnIndex, X_ERROR, + "[drm] Failed to detect GEM. Kernel 2.6.28 required.\n"); + drmClose(i830->drmSubFD); + i830->drmSubFD = -1; + return FALSE; + } + return TRUE; } diff --git a/src/i830_memory.c b/src/i830_memory.c index 99b9fc85..5e07213d 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -368,9 +368,7 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size) { I830Ptr pI830 = I830PTR(pScrn); i830_memory *start, *end; - struct drm_i915_getparam gp; struct drm_i915_setparam sp; - int has_gem; start = xcalloc(1, sizeof(*start)); if (start == NULL) @@ -407,24 +405,12 @@ i830_allocator_init(ScrnInfoPtr pScrn, unsigned long size) pI830->memory_list = start; - has_gem = FALSE; - - if (pI830->directRenderingType >= DRI_DRI2) - { - has_gem = FALSE; - gp.param = I915_PARAM_HAS_GEM; - gp.value = &has_gem; - - (void)drmCommandWriteRead(pI830->drmSubFD, DRM_I915_GETPARAM, - &gp, sizeof(gp)); - } - /* Now that we have our manager set up, initialize the kernel MM if * possible, covering almost all of the aperture. We need libdri interface * 5.4 or newer so we can rely on the lock being held after DRIScreenInit, * rather than after DRIFinishScreenInit. */ - if (pI830->directRenderingType == DRI_DRI2 && has_gem) { + if (pI830->directRenderingType == DRI_DRI2) { int mmsize; /* Take over all of the graphics aperture minus enough to for |