diff options
author | Eric Anholt <eric@anholt.net> | 2009-04-27 17:29:36 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-05-26 16:12:16 -0700 |
commit | a04a51c9bb6066454e0fda3c7897f97dab436358 (patch) | |
tree | 65e44ad0a63ad1d3b34042209c30deea79d3f018 /src/i830_dri.c | |
parent | c3bf8b980134a2761701e4bc18235695a1cb07a4 (diff) |
Open the DRM and keep the handle throughout server startup to finish.
This will let us configure the server from start to finish with the
most pertinent information available (KMS vs UMS, DRI2 vs non-DRI). Also,
we now close the DRI2 fd at terminate, which we didn't before.
This duplicates some code from DRI1 for getting a master FD like I'd done in
DRI2, but given that we weren't loading DRI1 ourselves, this is also a
bogosity cleanup, and avoids allocating the extra DRI1 private.
Diffstat (limited to 'src/i830_dri.c')
-rw-r--r-- | src/i830_dri.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/src/i830_dri.c b/src/i830_dri.c index 0648249a..fc059dfe 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -329,7 +329,7 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I830Ptr pI830 = I830PTR(pScrn); DRI2InfoRec info; - char *p, buf[64]; + char *p; int i; struct stat sbuf; dev_t d; @@ -355,36 +355,7 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen) } #endif - sprintf(buf, "pci:%04x:%02x:%02x.%d", - pI830->PciInfo->domain, - pI830->PciInfo->bus, - pI830->PciInfo->dev, - pI830->PciInfo->func); - - /* Use the already opened (master) fd from modesetting */ - if (pI830->use_drm_mode) { - info.fd = pI830->drmSubFD; - } else { - 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"); - return FALSE; - } + info.fd = pI830->drmSubFD; /* The whole drmOpen thing is a fiasco and we need to find a way * back to just using open(2). For now, however, lets just make @@ -423,8 +394,6 @@ Bool I830DRI2ScreenInit(ScreenPtr pScreen) info.CopyRegion = I830DRI2CopyRegion; - pI830->drmSubFD = info.fd; - return DRI2ScreenInit(pScreen, &info); } |