diff options
author | marha <marha@users.sourceforge.net> | 2014-03-09 22:56:02 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-03-09 22:56:02 +0100 |
commit | 2112b7dec49833ba872bd3ebcd7288930fec0796 (patch) | |
tree | 407c80c9a70f590af2d4c3e5c14678827e189331 /xorg-server/hw/xfree86/common | |
parent | 8badbdef38ce843dc443ddee219eda4040ef2cd5 (diff) | |
parent | 3dd4b6420f686b0147d5b8136268cc63196e253b (diff) | |
download | vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.tar.gz vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.tar.bz2 vcxsrv-2112b7dec49833ba872bd3ebcd7288930fec0796.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
fontconfig mesa xserver git update 9 Mar 2014
Conflicts:
mesalib/src/mapi/glapi/glapi.h
xorg-server/hw/kdrive/ephyr/hostx.c
Diffstat (limited to 'xorg-server/hw/xfree86/common')
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Events.c | 15 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Init.c | 3 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Module.h | 4 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.c | 65 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86Xinput.h | 8 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86platformBus.c | 60 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/common/xf86platformBus.h | 15 |
7 files changed, 145 insertions, 25 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c index 7b53949fa..06af73903 100644 --- a/xorg-server/hw/xfree86/common/xf86Events.c +++ b/xorg-server/hw/xfree86/common/xf86Events.c @@ -85,6 +85,8 @@ #endif #include "xf86platformBus.h" +#include "systemd-logind.h" + /* * This is a toggling variable: * FALSE = No VT switching keys have been pressed last time around @@ -556,8 +558,11 @@ xf86VTEnter(void) /* Turn screen saver off when switching back */ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); - for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) - xf86EnableInputDeviceForVTSwitch(pInfo); + /* If we use systemd-logind it will enable input devices for us */ + if (!systemd_logind_controls_session()) + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + xf86EnableInputDeviceForVTSwitch(pInfo); + for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) xf86EnableInputHandler(ih); @@ -589,10 +594,14 @@ xf86VTSwitch(void) /* * Since all screens are currently all in the same state it is sufficient * check the first. This might change in future. + * + * VTLeave is always handled here (VT_PROCESS guarantees this is safe), + * if we use systemd_logind xf86VTEnter() gets called by systemd-logind.c + * once it has resumed all drm nodes. */ if (xf86VTOwner()) xf86VTLeave(); - else + else if (!systemd_logind_controls_session()) xf86VTEnter(); } diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index ff4d38f28..4579ff591 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -54,6 +54,7 @@ #include "site.h" #include "mi.h" #include "dbus-core.h" +#include "systemd-logind.h" #include "compiler.h" @@ -458,6 +459,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) DoShowOptions(); dbus_core_init(); + systemd_logind_init(); /* Do a general bus probe. This will be a PCI probe for x86 platforms */ xf86BusProbe(); @@ -1062,6 +1064,7 @@ ddxGiveUp(enum ExitCode error) if (xorgHWOpenConsole) xf86CloseConsole(); + systemd_logind_fini(); dbus_core_fini(); xf86CloseLog(error); diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h index b6ec19d13..e8c24f26c 100644 --- a/xorg-server/hw/xfree86/common/xf86Module.h +++ b/xorg-server/hw/xfree86/common/xf86Module.h @@ -80,8 +80,8 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(15, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(20, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(16, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(21, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(8, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index f6f2b90dd..7c3e479e5 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -63,6 +63,7 @@ #include "mipointer.h" #include "extinit.h" #include "loaderProcs.h" +#include "systemd-logind.h" #include "exevents.h" /* AddInputDevice */ #include "exglobals.h" @@ -80,6 +81,7 @@ #include <stdarg.h> #include <stdint.h> /* for int64_t */ +#include <unistd.h> #include "mi.h" @@ -103,6 +105,9 @@ static int xf86InputDevicePostInit(DeviceIntPtr dev); +static InputInfoPtr *new_input_devices; +static int new_input_devices_count; + /** * Eval config and modify DeviceVelocityRec accordingly */ @@ -773,6 +778,11 @@ xf86DeleteInput(InputInfoPtr pInp, int flags) /* Else the entry wasn't in the xf86InputDevs list (ignore this). */ } + if (pInp->flags & XI86_SERVER_FD) { + systemd_logind_release_fd(pInp->major, pInp->minor); + close(pInp->fd); + } + free((void *) pInp->driver); free((void *) pInp->name); xf86optionListFree(pInp->options); @@ -816,6 +826,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) { InputDriverPtr drv = NULL; DeviceIntPtr dev = NULL; + Bool paused; int rval; /* Memory leak for every attached device if we don't @@ -830,6 +841,26 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) goto unwind; } + if (drv->capabilities & XI86_DRV_CAP_SERVER_FD) { + int fd = systemd_logind_take_fd(pInfo->major, pInfo->minor, + pInfo->attrs->device, &paused); + if (fd != -1) { + if (paused) { + /* Put on new_input_devices list for delayed probe */ + new_input_devices = xnfrealloc(new_input_devices, + sizeof(pInfo) * (new_input_devices_count + 1)); + new_input_devices[new_input_devices_count] = pInfo; + new_input_devices_count++; + systemd_logind_release_fd(pInfo->major, pInfo->minor); + close(fd); + return BadMatch; + } + pInfo->fd = fd; + pInfo->flags |= XI86_SERVER_FD; + pInfo->options = xf86ReplaceIntOption(pInfo->options, "fd", fd); + } + } + xf86Msg(X_INFO, "Using input driver '%s' for '%s'\n", drv->driverName, pInfo->name); @@ -949,6 +980,12 @@ NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, goto unwind; } } + + if (strcmp(key, "major") == 0) + pInfo->major = atoi(value); + + if (strcmp(key, "minor") == 0) + pInfo->minor = atoi(value); } nt_list_for_each_entry(option, options, list.next) { @@ -1469,4 +1506,32 @@ xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t type, QueueTouchEvents(dev, type, touchid, flags, mask); } +void +xf86InputEnableVTProbe(void) +{ + int i, is_auto = 0; + InputOption *option = NULL; + DeviceIntPtr pdev; + + for (i = 0; i < new_input_devices_count; i++) { + InputInfoPtr pInfo = new_input_devices[i]; + + is_auto = 0; + nt_list_for_each_entry(option, pInfo->options, list.next) { + const char *key = input_option_get_key(option); + const char *value = input_option_get_value(option); + + if (strcmp(key, "_source") == 0 && + (strcmp(value, "server/hal") == 0 || + strcmp(value, "server/udev") == 0 || + strcmp(value, "server/wscons") == 0)) + is_auto = 1; + } + xf86NewInputDevice(pInfo, &pdev, + (!is_auto || + (is_auto && xf86Info.autoEnableDevices))); + } + new_input_devices_count = 0; +} + /* end of xf86Xinput.c */ diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h index b6d125128..9fe8c87b6 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.h +++ b/xorg-server/hw/xfree86/common/xf86Xinput.h @@ -64,6 +64,10 @@ /* 0x08 is reserved for legacy XI86_SEND_DRAG_EVENTS, do not use for now */ /* server-internal only */ #define XI86_DEVICE_DISABLED 0x10 /* device was disabled before vt switch */ +#define XI86_SERVER_FD 0x20 /* fd is managed by xserver */ + +/* Input device driver capabilities */ +#define XI86_DRV_CAP_SERVER_FD 0x01 /* This holds the input driver entry and module information. */ typedef struct _InputDriverRec { @@ -76,6 +80,7 @@ typedef struct _InputDriverRec { struct _InputInfoRec * pInfo, int flags); void *module; const char **default_options; + int capabilities; } InputDriverRec, *InputDriverPtr; /* This is to input devices what the ScrnInfoRec is to screens. */ @@ -96,6 +101,8 @@ typedef struct _InputInfoRec { int *valuators, int first_valuator, int num_valuators); int fd; + int major; + int minor; DeviceIntPtr dev; void *private; const char *type_name; @@ -172,6 +179,7 @@ extern _X_EXPORT void xf86AddEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86RemoveEnabledDevice(InputInfoPtr pInfo); extern _X_EXPORT void xf86DisableDevice(DeviceIntPtr dev, Bool panic); extern _X_EXPORT void xf86EnableDevice(DeviceIntPtr dev); +extern _X_EXPORT void xf86InputEnableVTProbe(void); /* not exported */ int xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL is_auto); diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.c b/xorg-server/hw/xfree86/common/xf86platformBus.c index 5875a9136..4447e19df 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.c +++ b/xorg-server/hw/xfree86/common/xf86platformBus.c @@ -52,10 +52,10 @@ int platformSlotClaimed; int xf86_num_platform_devices; -static struct xf86_platform_device *xf86_platform_devices; +struct xf86_platform_device *xf86_platform_devices; int -xf86_add_platform_device(struct OdevAttributes *attribs) +xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned) { xf86_platform_devices = xnfrealloc(xf86_platform_devices, (sizeof(struct xf86_platform_device) @@ -63,6 +63,8 @@ xf86_add_platform_device(struct OdevAttributes *attribs) xf86_platform_devices[xf86_num_platform_devices].attribs = attribs; xf86_platform_devices[xf86_num_platform_devices].pdev = NULL; + xf86_platform_devices[xf86_num_platform_devices].flags = + unowned ? XF86_PDEV_UNOWNED : 0; xf86_num_platform_devices++; return 0; @@ -89,35 +91,55 @@ xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_name) return config_odev_add_attribute(device->attribs, attrib_id, attrib_name); } +Bool +xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value) +{ + return config_odev_add_int_attribute(xf86_platform_devices[index].attribs, attrib_id, attrib_value); +} + char * xf86_get_platform_attrib(int index, int attrib_id) { - struct xf86_platform_device *device = &xf86_platform_devices[index]; - struct OdevAttribute *oa; - - xorg_list_for_each_entry(oa, &device->attribs->list, member) { - if (oa->attrib_id == attrib_id) - return oa->attrib_name; - } - return NULL; + return config_odev_get_attribute(xf86_platform_devices[index].attribs, attrib_id); } char * xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id) { - struct OdevAttribute *oa; + return config_odev_get_attribute(device->attribs, attrib_id); +} - xorg_list_for_each_entry(oa, &device->attribs->list, member) { - if (oa->attrib_id == attrib_id) - return oa->attrib_name; - } - return NULL; +int +xf86_get_platform_int_attrib(int index, int attrib_id, int def) +{ + return config_odev_get_int_attribute(xf86_platform_devices[index].attribs, attrib_id, def); +} + +int +xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def) +{ + return config_odev_get_int_attribute(device->attribs, attrib_id, def); } Bool xf86_get_platform_device_unowned(int index) { - return xf86_platform_devices[index].attribs->unowned; + return (xf86_platform_devices[index].flags & XF86_PDEV_UNOWNED) ? + TRUE : FALSE; +} + +struct xf86_platform_device * +xf86_find_platform_device_by_devnum(int major, int minor) +{ + int i, attr_major, attr_minor; + + for (i = 0; i < xf86_num_platform_devices; i++) { + attr_major = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MAJOR, 0); + attr_minor = xf86_get_platform_int_attrib(i, ODEV_ATTRIB_MINOR, 0); + if (attr_major == major && attr_minor == minor) + return &xf86_platform_devices[i]; + } + return NULL; } /* @@ -524,10 +546,10 @@ void xf86platformVTProbe(void) int i; for (i = 0; i < xf86_num_platform_devices; i++) { - if (xf86_platform_devices[i].attribs->unowned == FALSE) + if (!(xf86_platform_devices[i].flags & XF86_PDEV_UNOWNED)) continue; - xf86_platform_devices[i].attribs->unowned = FALSE; + xf86_platform_devices[i].flags &= ~XF86_PDEV_UNOWNED; xf86PlatformReprobeDevice(i, xf86_platform_devices[i].attribs); } } diff --git a/xorg-server/hw/xfree86/common/xf86platformBus.h b/xorg-server/hw/xfree86/common/xf86platformBus.h index 4e1757854..78b5a5bea 100644 --- a/xorg-server/hw/xfree86/common/xf86platformBus.h +++ b/xorg-server/hw/xfree86/common/xf86platformBus.h @@ -30,23 +30,34 @@ struct xf86_platform_device { struct OdevAttributes *attribs; /* for PCI devices */ struct pci_device *pdev; + int flags; }; +/* xf86_platform_device flags */ +#define XF86_PDEV_UNOWNED 0x01 +#define XF86_PDEV_SERVER_FD 0x02 +#define XF86_PDEV_PAUSED 0x04 + #ifdef XSERVER_PLATFORM_BUS int xf86platformProbe(void); int xf86platformProbeDev(DriverPtr drvp); extern int xf86_num_platform_devices; +extern struct xf86_platform_device *xf86_platform_devices; extern char * xf86_get_platform_attrib(int index, int attrib_id); extern int -xf86_add_platform_device(struct OdevAttributes *attribs); +xf86_get_platform_int_attrib(int index, int attrib_id, int def); +extern int +xf86_add_platform_device(struct OdevAttributes *attribs, Bool unowned); extern int xf86_remove_platform_device(int dev_index); extern Bool xf86_add_platform_device_attrib(int index, int attrib_id, char *attrib_str); extern Bool +xf86_add_platform_device_int_attrib(int index, int attrib_id, int attrib_value); +extern Bool xf86_get_platform_device_unowned(int index); extern int @@ -56,6 +67,8 @@ xf86platformRemoveDevice(int index); extern _X_EXPORT char * xf86_get_platform_device_attrib(struct xf86_platform_device *device, int attrib_id); +extern _X_EXPORT int +xf86_get_platform_device_int_attrib(struct xf86_platform_device *device, int attrib_id, int def); extern _X_EXPORT Bool xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *busid); |