summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-04-27 16:00:05 -0700
committerEric Anholt <eric@anholt.net>2009-04-27 16:32:25 -0700
commitab878118b9fb46c437a02f824d29f4a206e7fd80 (patch)
tree24b9f9783d99b3ae6bee8d11f6c0ce0f1001334f /src
parent385ac2197b64574f30620a203e675d8da0e1472f (diff)
Don't initialize DRI2 if the fd we get is not master-capable.
Diffstat (limited to 'src')
-rw-r--r--src/i830_dri.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c
index 70b76aed..93bb3409 100644
--- a/src/i830_dri.c
+++ b/src/i830_dri.c
@@ -1829,8 +1829,22 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen)
info.fd = pI830->drmSubFD;
#endif
- if (info.fd < 0)
+ if (info.fd < 0) {
info.fd = drmOpen("i915", buf);
+ drmSetVersion sv;
+ int err;
+
+ /* Check that what we opened was a master or a master-capable FD,
+ * by setting the version of the interface we'll use to talk to it.
+ * (see DRIOpenDRMMaster() in DRI1)
+ */
+ sv.drm_di_major = 1;
+ sv.drm_di_minor = 1;
+ sv.drm_dd_major = -1;
+ err = drmSetInterfaceVersion(info.fd, &sv);
+ if (err != 0)
+ return FALSE;
+ }
if (info.fd < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Failed to open DRM device\n");