Commit 9f79e93b authored by Peter Hutterer's avatar Peter Hutterer Committed by Keith Packard
Browse files

Short-cut the input device cleanup process during AbortServer()



If we're about to abort, we're already in the signal handler and cannot call
down to the default device cleanup routines (which reset, free, alloc, and
do a bunch of other things).

Add a new DEVICE_ABORT mode to signal a driver's DeviceProc that it must
reset the hardware if needed but do nothing else. An actual HW reset is only
required for some drivers dealing with the HW directly.

This is largely backwards-compatible, hence the input ABI minor bump only.

Drivers we care about either return BadValue on a mode that's not
DEVICE_{INIT|ON|OFF|CLOSE} or print an error and return BadValue. Exception
here is vmmouse, which currently ignores it and would not reset anything.
This should be fixed if the reset is required.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent b58221f9
......@@ -1055,6 +1055,25 @@ CloseDownDevices(void)
OsReleaseSignals();
}
/**
* Signal all devices that we're in the process of aborting.
* This function is called from a signal handler.
*/
void
AbortDevices(void)
{
DeviceIntPtr dev;
nt_list_for_each_entry(dev, inputInfo.devices, next) {
if (!IsMaster(dev))
(*dev->deviceProc) (dev, DEVICE_ABORT);
}
nt_list_for_each_entry(dev, inputInfo.off_devices, next) {
if (!IsMaster(dev))
(*dev->deviceProc) (dev, DEVICE_ABORT);
}
}
/**
* Remove the cursor sprite for all devices. This needs to be done before any
* resources are freed or any device is deleted.
......
......@@ -81,7 +81,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(14, 1)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(19, 0)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(19, 1)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(7, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
......
......@@ -62,6 +62,7 @@ SOFTWARE.
#define DEVICE_ON 1
#define DEVICE_OFF 2
#define DEVICE_CLOSE 3
#define DEVICE_ABORT 4
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
......@@ -269,6 +270,7 @@ extern void DisableAllDevices(void);
extern int InitAndStartDevices(void);
extern void CloseDownDevices(void);
extern void AbortDevices(void);
extern void UndisplayDevices(void);
......
......@@ -663,7 +663,7 @@ AbortServer(void)
#endif
CloseWellKnownConnections();
OsCleanup(TRUE);
CloseDownDevices();
AbortDevices();
AbortDDX(EXIT_ERR_ABORT);
fflush(stderr);
if (CoreDump)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment