[PATCH xserver 00/11] Eliminate fd_set from server ABI/API

Keith Packard keithp at keithp.com
Wed May 18 21:51:47 UTC 2016


This series builds on the input-thread changes and eliminates the
'fd_set' type outside of the OS layer, along with the AddEnabledDevice
and AddGeneralSocket APIs.

My eventual goal is to replace select with epoll on linux and the
equvalent for BSD so that we no longer care what fd values are used by
clients, and to improve performance within the server.

The series has a sequenc eof small logic changes and larger mechanical
changes to try and make it easier to understand. Of course, some of
the changes don't seem to make much sense in isolation so I'll explain
the relationship here

Many of these changes relate to how alternate input is handled in the
X server. In the original API, the only way to deal with non-client
file descriptors was to merged them into the select mask and then
check that in a wakeup handler. With the NotifyFd interface, we've an
alternative.

    [PATCH xserver 01/11] hw/xfree86: Use NotifyFd for other input fd

A large monolithic change is to switch the font API to version 2. That
interface passed fd_set references between the X server and the font
server. This has naturally been changed to use the NotifyFd interface.
Given the chance to fix the API, the new font library also eliminates
explicit referances to functions in the X server. Now, the font
library is provided with a vector of functions at initialization time.

    [PATCH xserver 02/11] dix: Switch to the libXfont2 API (v2)

Ajax found a few places where the NotifyFd callbacks could be
"improved" by using the fd provided to the callback rather than
fetching the fd from some module-specific location.

    [PATCH xserver 03/11] hw/kdrive: Use passed-in fd for kdrive/linux
    [PATCH xserver 04/11] modesetting: Use passed-in fd for drm event

With all users of the readmask in block/wakeup handlers gone, there
are two large mechanical patches which adjust the API.

    [PATCH xserver 05/11] Remove readmask from screen block/wakeup
    [PATCH xserver 06/11] Remove fd_set from Block/Wakeup handler API

While fixing the block&wakeup handler API, I discovered that block
handlers were called in an ill-defined order, causing ephyr (at least)
to need a polling kludge in case additional data arrived from the host
X server. Fixing the order to call the screen block handlers last
meant that Xephyr can now reliably flush the X event queue before
select is called.

    [PATCH xserver 07/11] dix: Call screen block/wakeup handlers closest
    [PATCH xserver 08/11] kdrive/ephyr: Poll for events in block handler

dmx and xnest weren't using the readmask in their wakeup handlers, but
were using AddEnabledDevice to cause the server to wakeup when input
happened. Both dmx and xnest would then just poll their inputs to see
where the data was. This is terribly inefficient, but using NotifyFd
doesn't make it any worse. If anyone is interested, it should be
pretty easy to fix.

    [PATCH xserver 09/11] dmx: Eliminate use of AddEnabledDevice
    [PATCH xserver 10/11] xnest: Use SetNotifyFd to receive events

And, with no calls to AddEnableDevice or AddGeneralSocket, we can
remove them from the server.

    [PATCH xserver 11/11] Remove AddEnabledDevice and AddGeneralSocket


More information about the xorg-devel mailing list