diff options
author | Hans de Goede <hdegoede@redhat.com> | 2014-03-03 16:58:54 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2014-03-10 09:08:46 +0100 |
commit | 7f15e5aed79803fa6057fbfda7dfbacacc2e019d (patch) | |
tree | 4ddffda0c6cfce667e223743b31e79f154b0eda7 | |
parent | 76af81bdf8ade158d7cef718ff6cf31cbf641a9a (diff) |
Require video drivers to report that they support server managed fds
This makes how we handle video drivers identical to what we do for input
drivers, and this should make live easier for old non kms drivers.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r-- | hw/xfree86/common/xf86platformBus.c | 14 | ||||
-rw-r--r-- | hw/xfree86/common/xf86str.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 564567efc..4e80f9ee3 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -38,6 +38,7 @@ #include <unistd.h> #include "os.h" #include "hotplug.h" +#include "systemd-logind.h" #include "xf86.h" #include "xf86_OSproc.h" @@ -310,7 +311,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, GDevPtr gdev, int flags, intptr_t match_data) { Bool foundScreen = FALSE; - int entity; + int entity, fd, major, minor; if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; @@ -334,6 +335,17 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp, } } if (entity != -1) { + if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc || + !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) { + fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1); + major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0); + minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0); + systemd_logind_release_fd(major, minor); + close(fd); + config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1); + dev->flags &= ~XF86_PDEV_SERVER_FD; + } + if (drvp->platformProbe(drvp, entity, flags, dev, match_data)) foundScreen = TRUE; else diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index b164b7f21..a81e88614 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -256,7 +256,8 @@ typedef enum { RR_GET_INFO, RR_SET_CONFIG, RR_GET_MODE_MM, - GET_REQUIRED_HW_INTERFACES = 10 + GET_REQUIRED_HW_INTERFACES = 10, + SUPPORTS_SERVER_FDS = 11, } xorgDriverFuncOp; typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *); |