diff options
author | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-12 16:45:42 +0100 |
commit | cc6db22a772cc52ead6a5c11d7d02e7364f6326c (patch) | |
tree | d80b42172d703ec20ccd99c68a067505e2706899 /xorg-server/hw/xfree86/common | |
parent | 2112b7dec49833ba872bd3ebcd7288930fec0796 (diff) | |
parent | cd8b0d0de3fcb53f6d3ece8ce26d97aaab2c0914 (diff) | |
download | vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.gz vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.tar.bz2 vcxsrv-cc6db22a772cc52ead6a5c11d7d02e7364f6326c.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa xserver xkbcomp git update 12 Mar 2014
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.c | 22 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86platformBus.c | 28 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86str.h | 3 |
3 files changed, 40 insertions, 13 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index 7c3e479e5..36b92a9f7 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -81,6 +81,7 @@ #include <stdarg.h> #include <stdint.h> /* for int64_t */ +#include <sys/stat.h> #include <unistd.h> #include "mi.h" @@ -804,6 +805,18 @@ xf86InputDevicePostInit(DeviceIntPtr dev) return Success; } +static void +xf86stat(const char *path, int *maj, int *min) +{ + struct stat st; + + if (stat(path, &st) == -1) + return; + + *maj = major(st.st_rdev); + *min = minor(st.st_rdev); +} + /** * Create a new input device, activate and enable it. * @@ -828,6 +841,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) DeviceIntPtr dev = NULL; Bool paused; int rval; + const char *path; /* Memory leak for every attached device if we don't * test if the module is already loaded first */ @@ -841,9 +855,13 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) goto unwind; } - if (drv->capabilities & XI86_DRV_CAP_SERVER_FD) { + path = xf86CheckStrOption(pInfo->options, "Device", NULL); + if (path && pInfo->major == 0 && pInfo->minor == 0) + xf86stat(path, &pInfo->major, &pInfo->minor); + + if (path && (drv->capabilities & XI86_DRV_CAP_SERVER_FD)){ int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor, - pInfo->attrs->device, &paused); + path, &paused); if (fd != -1) { if (paused) { /* Put on new_input_devices list for delayed probe */ diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c index 4447e19df..4e80f9ee3 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.c +++ b/xorg-server/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,15 +311,15 @@ 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->screen == 0 && !xf86_check_platform_slot(dev)) + if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev)) return FALSE; entity = xf86ClaimPlatformSlot(dev, drvp, 0, - gdev, gdev->active); + gdev, gdev ? gdev->active : 0); - if ((entity == -1) && (gdev->screen > 0)) { + if ((entity == -1) && gdev && (gdev->screen > 0)) { unsigned nent; for (nent = 0; nent < xf86NumEntities; nent++) { @@ -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 @@ -420,7 +432,6 @@ xf86platformAddDevice(int index) { int i, old_screens, scr_index; DriverPtr drvp = NULL; - int entity; screenLayoutPtr layout; static const char *hotplug_driver_name = "modesetting"; @@ -440,11 +451,8 @@ xf86platformAddDevice(int index) return -1; old_screens = xf86NumGPUScreens; - entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index], - drvp, 0, 0, 0); - if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) { - xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL); - } + doPlatformProbe(&xf86_platform_devices[index], drvp, NULL, + PLATFORM_PROBE_GPU_SCREEN, 0); if (old_screens == xf86NumGPUScreens) return -1; i = old_screens; diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h index b164b7f21..a81e88614 100644 --- a/xorg-server/hw/xfree86/common/xf86str.h +++ b/xorg-server/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 *); |