I've just noticed that my previous patch-set for server managed fds misses out on adding server managed fds support to uxa, because uxa does its own /dev/dri/... device node management. This commit switches uxa over to using intel_device.c device node management. This is a nice cleanup and as an added bonus adds server managed fd support. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- src/intel_device.c | 14 -------------- src/intel_driver.h | 2 -- src/uxa/intel_driver.c | 44 +++----------------------------------------- 3 files changed, 3 insertions(+), 57 deletions(-) diff --git a/src/intel_device.c b/src/intel_device.c index 2d31ec8..11118c2 100644 --- a/src/intel_device.c +++ b/src/intel_device.c @@ -442,20 +442,6 @@ int intel_put_master(ScrnInfoPtr scrn) return ret; } -void __intel_uxa_release_device(ScrnInfoPtr scrn) -{ - struct intel_device *dev = intel_device(scrn); - if (dev && dev->open_count == 0) { - intel_set_device(scrn, NULL); - - drmClose(dev->fd); - if (dev->render_node != dev->master_node) - free(dev->render_node); - free(dev->master_node); - free(dev); - } -} - void intel_put_device(ScrnInfoPtr scrn) { struct intel_device *dev = intel_device(scrn); diff --git a/src/intel_driver.h b/src/intel_driver.h index b2cb1b9..182a30e 100644 --- a/src/intel_driver.h +++ b/src/intel_driver.h @@ -132,8 +132,6 @@ int intel_get_master(ScrnInfoPtr scrn); int intel_put_master(ScrnInfoPtr scrn); void intel_put_device(ScrnInfoPtr scrn); -void __intel_uxa_release_device(ScrnInfoPtr scrn); - #define hosted() (0) #endif /* INTEL_DRIVER_H */ diff --git a/src/uxa/intel_driver.c b/src/uxa/intel_driver.c index 7ea3b63..a0b0a48 100644 --- a/src/uxa/intel_driver.c +++ b/src/uxa/intel_driver.c @@ -248,38 +248,12 @@ static Bool intel_open_drm_master(ScrnInfoPtr scrn) { intel_screen_private *intel = intel_get_screen_private(scrn); struct pci_device *dev = intel->PciInfo; - drmSetVersion sv; struct drm_i915_getparam gp; int err, has_gem; - char busid[20]; - snprintf(busid, sizeof(busid), "pci:%04x:%02x:%02x.%d", - dev->domain, dev->bus, dev->dev, dev->func); - - intel->drmSubFD = drmOpen(NULL, busid); - if (intel->drmSubFD == -1) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[drm] Failed to open DRM device for %s: %s\n", - busid, strerror(errno)); + intel->drmSubFD = intel_get_device(scrn); + if (intel->drmSubFD == -1) return FALSE; - } - - /* 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; - sv.drm_dd_minor = -1; - err = drmSetInterfaceVersion(intel->drmSubFD, &sv); - if (err != 0) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[drm] failed to set drm interface version.\n"); - drmClose(intel->drmSubFD); - intel->drmSubFD = -1; - return FALSE; - } has_gem = FALSE; gp.param = I915_PARAM_HAS_GEM; @@ -289,22 +263,12 @@ static Bool intel_open_drm_master(ScrnInfoPtr scrn) if (!has_gem) { xf86DrvMsg(scrn->scrnIndex, X_ERROR, "[drm] Failed to detect GEM. Kernel 2.6.28 required.\n"); - drmClose(intel->drmSubFD); - intel->drmSubFD = -1; return FALSE; } return TRUE; } -static void intel_close_drm_master(intel_screen_private *intel) -{ - if (intel && intel->drmSubFD > 0) { - drmClose(intel->drmSubFD); - intel->drmSubFD = -1; - } -} - static int intel_init_bufmgr(intel_screen_private *intel) { int batch_size; @@ -1090,7 +1054,7 @@ static void I830FreeScreen(FREE_SCREEN_ARGS_DECL) if (intel && !((uintptr_t)intel & 1)) { intel_mode_fini(intel); - intel_close_drm_master(intel); + intel_put_device(scrn); intel_bufmgr_fini(intel); free(intel); @@ -1293,8 +1257,6 @@ static Bool I830PMEvent(SCRN_ARG_TYPE arg, pmEvent event, Bool undo) Bool intel_init_scrn(ScrnInfoPtr scrn) { - __intel_uxa_release_device(scrn); - scrn->PreInit = I830PreInit; scrn->ScreenInit = I830ScreenInit; scrn->SwitchMode = I830SwitchMode; -- 1.9.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx