diff options
author | Keith Packard <keithp@keithp.com> | 2015-12-08 14:39:46 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2016-05-26 16:07:54 -0700 |
commit | 6a5a4e60373c1386b311b2a8bb666c32d68a9d99 (patch) | |
tree | 1643ea974c60cefb7dbd6d646e40d77263babaa3 /hw/xfree86/common | |
parent | 8cf832c288dec13cbf3c25478a8ccef52d61f3db (diff) |
Remove SIGIO support for input [v5]
This removes all of the SIGIO handling support used for input
throughout the X server, preparing the way for using threads for input
handling instead.
Places calling OsBlockSIGIO and OsReleaseSIGIO are marked with calls
to stub functions input_lock/input_unlock so that we don't lose this
information.
xfree86 SIGIO support is reworked to use internal versions of
OsBlockSIGIO and OsReleaseSIGIO.
v2: Don't change locking order (Peter Hutterer)
v3: Comment weird && FALSE in xf86Helper.c
Leave errno save/restore in xf86ReadInput
Squash with stub adding patch (Peter Hutterer)
v4: Leave UseSIGIO config parameter so that
existing config files don't break (Peter Hutterer)
v5: Split a couple of independent patch bits out
of kinput.c (Peter Hutterer)
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'hw/xfree86/common')
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 21 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Cursor.c | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Events.c | 29 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 6 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Init.c | 6 | ||||
-rw-r--r-- | hw/xfree86/common/xf86PM.c | 8 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.c | 8 |
7 files changed, 33 insertions, 53 deletions
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 07f8fb41a..5a9f8d2fd 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -807,27 +807,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); } - if (xf86SIGIOSupported()) { - xf86Info.useSIGIO = - xf86ReturnOptValBool(FlagOptions, FLAG_USE_SIGIO, - USE_SIGIO_BY_DEFAULT); - if (xf86IsOptionSet(FlagOptions, FLAG_USE_SIGIO)) { - from = X_CONFIG; - } - else { - from = X_DEFAULT; - } - if (!xf86Info.useSIGIO) { - xf86Msg(from, "Disabling SIGIO handlers for input devices\n"); - } - else if (from == X_CONFIG) { - xf86Msg(from, "Enabling SIGIO handlers for input devices\n"); - } - } - else { - xf86Info.useSIGIO = FALSE; - } - if (xf86IsOptionSet(FlagOptions, FLAG_AUTO_ADD_DEVICES)) { xf86GetOptValBool(FlagOptions, FLAG_AUTO_ADD_DEVICES, &xf86Info.autoAddDevices); diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 92c08af9e..de054fbc9 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -221,7 +221,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (pScreen == pCursorScreen) miPointerGetPosition(dev, &px, &py); - OsBlockSIGIO(); + input_lock(); Switched = (*pScr->SwitchMode) (pScr, mode); if (Switched) { pScr->currentMode = mode; @@ -260,7 +260,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) pScr->frameY1 = pScr->virtualY - 1; } } - OsReleaseSIGIO(); + input_unlock(); if (pScr->AdjustFrame) (*pScr->AdjustFrame) (pScr, pScr->frameX0, pScr->frameY0); @@ -452,11 +452,11 @@ xf86CrossScreen(ScreenPtr pScreen, Bool entering) static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - OsBlockSIGIO(); + input_lock(); miPointerWarpCursor(pDev, pScreen, x, y); xf86Info.currentScreen = pScreen; - OsReleaseSIGIO(); + input_unlock(); } void * diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 709afd6f9..81416ed1d 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -259,7 +259,7 @@ xf86Wakeup(void *blockData, int err, void *pReadmask) while (pInfo) { if (pInfo->read_input && pInfo->fd >= 0 && (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { - OsBlockSIGIO(); + input_lock(); /* * Remove the descriptior from the set because more than one @@ -268,7 +268,7 @@ xf86Wakeup(void *blockData, int err, void *pReadmask) FD_CLR(pInfo->fd, &devicesWithInput); pInfo->read_input(pInfo); - OsReleaseSIGIO(); + input_unlock(); } pInfo = pInfo->next; } @@ -291,11 +291,12 @@ xf86Wakeup(void *blockData, int err, void *pReadmask) } /* - * xf86SigioReadInput -- - * signal handler for the SIGIO signal. + * xf86ReadInput -- + * input thread handler */ + static void -xf86SigioReadInput(int fd, void *closure) +xf86ReadInput(int fd, int ready, void *closure) { int errno_save = errno; InputInfoPtr pInfo = closure; @@ -312,9 +313,7 @@ xf86SigioReadInput(int fd, void *closure) void xf86AddEnabledDevice(InputInfoPtr pInfo) { - if (!xf86InstallSIGIOHandler(pInfo->fd, xf86SigioReadInput, pInfo)) { - AddEnabledDevice(pInfo->fd); - } + SetNotifyFd(pInfo->fd, xf86ReadInput, X_NOTIFY_READ, pInfo); } /* @@ -324,9 +323,7 @@ xf86AddEnabledDevice(InputInfoPtr pInfo) void xf86RemoveEnabledDevice(InputInfoPtr pInfo) { - if (!xf86RemoveSIGIOHandler(pInfo->fd)) { - RemoveEnabledDevice(pInfo->fd); - } + RemoveNotifyFd(pInfo->fd); } static int *xf86SignalIntercept = NULL; @@ -402,9 +399,9 @@ xf86ReleaseKeys(DeviceIntPtr pDev) for (i = keyc->xkbInfo->desc->min_key_code; i < keyc->xkbInfo->desc->max_key_code; i++) { if (key_is_down(pDev, i, KEY_POSTED)) { - OsBlockSIGIO(); + input_lock(); QueueKeyboardEvents(pDev, KeyRelease, i); - OsReleaseSIGIO(); + input_unlock(); } } } @@ -487,7 +484,7 @@ xf86VTLeave(void) for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) xf86DisableInputDeviceForVTSwitch(pInfo); - OsBlockSIGIO(); + input_lock(); for (i = 0; i < xf86NumScreens; i++) xf86Screens[i]->LeaveVT(xf86Screens[i]); for (i = 0; i < xf86NumGPUScreens; i++) @@ -545,7 +542,7 @@ switch_failed: else xf86EnableGeneralHandler(ih); } - OsReleaseSIGIO(); + input_unlock(); } void @@ -603,7 +600,7 @@ xf86VTEnter(void) xf86UpdateHasVTProperty(TRUE); - OsReleaseSIGIO(); + input_unlock(); } /* diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 1d4b431af..284858bfc 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1723,7 +1723,11 @@ xf86SetSilkenMouse(ScreenPtr pScreen) * yet. Should handle this differently so that alternate async methods * work correctly with this too. */ - pScrn->silkenMouse = useSM && xf86Info.useSIGIO && xf86SIGIOSupported(); + /* Disable this completely when removing SIGIO support. It + * will get re-enabled correctly when we add threaded input + * support + */ + pScrn->silkenMouse = useSM && FALSE; if (serverGeneration == 1) xf86DrvMsg(pScreen->myNum, from, "Silken mouse %s\n", pScrn->silkenMouse ? "enabled" : "disabled"); diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 66c668980..cf726d4a0 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -762,7 +762,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); #endif xf86AccessEnter(); - OsBlockSIGIO(); + input_lock(); sigio_blocked = TRUE; } } @@ -864,7 +864,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) xf86VGAarbiterWrapFunctions(); if (sigio_blocked) - OsReleaseSIGIO(); + input_unlock(); xf86InitOrigins(); @@ -1010,7 +1010,7 @@ AbortDDX(enum ExitCode error) { int i; - OsBlockSIGIO(); + input_lock(); /* * try to restore the original video state diff --git a/hw/xfree86/common/xf86PM.c b/hw/xfree86/common/xf86PM.c index 9e49e8eaf..3f08c8166 100644 --- a/hw/xfree86/common/xf86PM.c +++ b/hw/xfree86/common/xf86PM.c @@ -107,7 +107,7 @@ suspend(pmEvent event, Bool undo) DisableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } - OsBlockSIGIO(); + input_lock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); @@ -135,7 +135,7 @@ resume(pmEvent event, Bool undo) xf86Screens[i]->EnterVT(xf86Screens[i]); } } - OsReleaseSIGIO(); + input_unlock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (xf86Screens[i], TRUE); @@ -182,13 +182,13 @@ DoApmEvent(pmEvent event, Bool undo) } break; default: - OsBlockSIGIO(); + input_lock(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { xf86Screens[i]->PMEvent(xf86Screens[i], event, undo); } } - OsReleaseSIGIO(); + input_unlock(); break; } } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index b02a162b3..9ed88f202 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -931,7 +931,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) /* Enable it if it's properly initialised and we're currently in the VT */ if (enable && dev->inited && dev->startup && xf86VTOwner()) { - OsBlockSignals(); + input_lock(); EnableDevice(dev, TRUE); if (!dev->enabled) { OsReleaseSignals(); @@ -942,7 +942,7 @@ xf86NewInputDevice(InputInfoPtr pInfo, DeviceIntPtr *pdev, BOOL enable) } /* send enter/leave event, update sprite window */ CheckMotion(NULL, dev); - OsReleaseSignals(); + input_unlock(); } *pdev = dev; @@ -1075,7 +1075,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) if (pInfo) /* need to get these before RemoveDevice */ drv = pInfo->drv; - OsBlockSignals(); + input_lock(); RemoveDevice(pDev, TRUE); if (!isMaster && pInfo != NULL) { @@ -1084,7 +1084,7 @@ DeleteInputDeviceRequest(DeviceIntPtr pDev) else xf86DeleteInput(pInfo, 0); } - OsReleaseSignals(); + input_unlock(); } /* |