Revert "hw/xfree86: Use NotifyFd for device and other input fd wakeups"

Reported to break libinput:

http://lists.freedesktop.org/archives/xorg-devel/2015-December/048091.html

This reverts commit 1df07dc36c.
This commit is contained in:
Adam Jackson 2015-12-02 10:42:36 -05:00
parent 7b02f0b87e
commit 2e3d9623ae

View File

@ -101,6 +101,8 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
switches when using the DRI switches when using the DRI
automatic full screen mode.*/ automatic full screen mode.*/
extern fd_set EnabledDevices;
#ifdef XF86PM #ifdef XF86PM
extern void (*xf86OSPMClose) (void); extern void (*xf86OSPMClose) (void);
#endif #endif
@ -245,6 +247,45 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
void void
xf86Wakeup(void *blockData, int err, void *pReadmask) xf86Wakeup(void *blockData, int err, void *pReadmask)
{ {
fd_set *LastSelectMask = (fd_set *) pReadmask;
fd_set devicesWithInput;
InputInfoPtr pInfo;
if (err >= 0) {
XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesWithInput)) {
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0 &&
(FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
OsBlockSIGIO();
/*
* Remove the descriptior from the set because more than one
* device may share the same file descriptor.
*/
FD_CLR(pInfo->fd, &devicesWithInput);
pInfo->read_input(pInfo);
OsReleaseSIGIO();
}
pInfo = pInfo->next;
}
}
}
if (err >= 0) { /* we don't want the handlers called if select() */
IHPtr ih, ih_tmp; /* returned with an error condition, do we? */
nt_list_for_each_entry_safe(ih, ih_tmp, InputHandlers, next) {
if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
(FD_ISSET(ih->fd, ((fd_set *) pReadmask)) != 0)) {
ih->ihproc(ih->fd, ih->data);
}
}
}
if (xf86VTSwitchPending()) if (xf86VTSwitchPending())
xf86VTSwitch(); xf86VTSwitch();
} }
@ -264,15 +305,6 @@ xf86SigioReadInput(int fd, void *closure)
errno = errno_save; errno = errno_save;
} }
static void
xf86NotifyReadInput(int fd, int ready, void *closure)
{
InputInfoPtr pInfo = closure;
OsBlockSIGIO();
pInfo->read_input(pInfo);
OsReleaseSIGIO();
}
/* /*
* xf86AddEnabledDevice -- * xf86AddEnabledDevice --
* *
@ -282,7 +314,6 @@ xf86AddEnabledDevice(InputInfoPtr pInfo)
{ {
if (!xf86InstallSIGIOHandler(pInfo->fd, xf86SigioReadInput, pInfo)) { if (!xf86InstallSIGIOHandler(pInfo->fd, xf86SigioReadInput, pInfo)) {
AddEnabledDevice(pInfo->fd); AddEnabledDevice(pInfo->fd);
SetNotifyFd(pInfo->fd, xf86NotifyReadInput, X_NOTIFY_READ, pInfo);
} }
} }
@ -295,7 +326,6 @@ xf86RemoveEnabledDevice(InputInfoPtr pInfo)
{ {
if (!xf86RemoveSIGIOHandler(pInfo->fd)) { if (!xf86RemoveSIGIOHandler(pInfo->fd)) {
RemoveEnabledDevice(pInfo->fd); RemoveEnabledDevice(pInfo->fd);
RemoveNotifyFd(pInfo->fd);
} }
} }
@ -606,16 +636,6 @@ xf86VTSwitch(void)
/* Input handler registration */ /* Input handler registration */
static void
xf86InputHandlerNotify(int fd, int ready, void *data)
{
IHPtr ih = data;
if (ih->enabled && ih->fd >= 0 && ih->ihproc) {
ih->ihproc(ih->fd, ih->data);
}
}
static void * static void *
addInputHandler(int fd, InputHandlerProc proc, void *data) addInputHandler(int fd, InputHandlerProc proc, void *data)
{ {
@ -633,11 +653,6 @@ addInputHandler(int fd, InputHandlerProc proc, void *data)
ih->data = data; ih->data = data;
ih->enabled = TRUE; ih->enabled = TRUE;
if (!SetNotifyFd(fd, xf86InputHandlerNotify, X_NOTIFY_READ, ih)) {
free(ih);
return NULL;
}
ih->next = InputHandlers; ih->next = InputHandlers;
InputHandlers = ih; InputHandlers = ih;