diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2009-11-30 10:27:42 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2009-11-30 10:27:50 -0500 |
commit | 2d434eed09936328a52cb942450a95aedc3eac63 (patch) | |
tree | 2466def304164d53d44727fa2f5de0c7219b790a | |
parent | cfcabc45140d19bfbfa4737c0a11cdbb042d11eb (diff) |
Use new drmGetDeviceNameFromFd() for mapping to drm device name
Should have been in libdrm to begin with.
-rw-r--r-- | src/i830.h | 2 | ||||
-rw-r--r-- | src/i830_dri.c | 29 |
2 files changed, 4 insertions, 27 deletions
@@ -369,7 +369,7 @@ typedef struct intel_screen_private { Bool directRenderingOpen; int drmSubFD; - char deviceName[64]; + char *deviceName; /* Broken-out options. */ OptionInfoPtr Options; diff --git a/src/i830_dri.c b/src/i830_dri.c index 64ee4540..440748bc 100644 --- a/src/i830_dri.c +++ b/src/i830_dri.c @@ -366,10 +366,6 @@ Bool I830DRI2ScreenInit(ScreenPtr screen) ScrnInfoPtr scrn = xf86Screens[screen->myNum]; intel_screen_private *intel = intel_get_screen_private(scrn); DRI2InfoRec info; - char *p; - int i; - struct stat sbuf; - dev_t d; #ifdef USE_DRI2_1_1_0 int dri2_major = 1; int dri2_minor = 0; @@ -387,30 +383,10 @@ Bool I830DRI2ScreenInit(ScreenPtr screen) } #endif + intel->deviceName = drmGetDeviceNameFromFd(intel->drmSubFD); info.fd = intel->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 - * things worse with even more ad hoc directory walking code to - * discover the device file name. */ - - fstat(info.fd, &sbuf); - d = sbuf.st_rdev; - - p = intel->deviceName; - for (i = 0; i < DRM_MAX_MINOR; i++) { - sprintf(p, DRM_DEV_NAME, DRM_DIR_NAME, i); - if (stat(p, &sbuf) == 0 && sbuf.st_rdev == d) - break; - } - if (i == DRM_MAX_MINOR) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "DRI2: failed to open drm device\n"); - return FALSE; - } - info.driverName = IS_I965G(intel) ? "i965" : "i915"; - info.deviceName = p; + info.deviceName = intel->deviceName; #if DRI2INFOREC_VERSION >= 3 info.version = 3; @@ -442,4 +418,5 @@ void I830DRI2CloseScreen(ScreenPtr screen) DRI2CloseScreen(screen); intel->directRenderingType = DRI_NONE; + drmFree(intel->deviceName); } |