summaryrefslogtreecommitdiff
path: root/src/i830_driver.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-04-27 17:45:02 -0700
committerCarl Worth <cworth@cworth.org>2009-05-26 16:12:16 -0700
commit1a039f4371bec455cad43f0fb7b329f2ee09a974 (patch)
treec111471061b3e9dbc0444b9406427c2de8059246 /src/i830_driver.c
parenta04a51c9bb6066454e0fda3c7897f97dab436358 (diff)
Fold GEM detection into DRM master open.
We don't have anything to do with the DRM unless it's GEM-enabled, unless we were to support GEM-but-not-DRI2, which doesn't seem useful. Compilation fixes by Carl Worth <cworth@cworth.org>
Diffstat (limited to 'src/i830_driver.c')
-rw-r--r--src/i830_driver.c17
1 files changed, 16 insertions, 1 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;
}