Features/OneSecondX

= One Second X =

Summary
X takes too long to start up, even on reasonable hardware. We should be able to get from exec to ready to accept clients in under one second. X server shutdown should be similarly fast.

Owner

 * Name: AdamJackson

Current status

 * Targeted release:  Fedora 9
 * Last updated: 2008-04-11
 * Percentage of completion: 100%

Good progress has been made over the Fedora 9 cycle. Didn't quite get to 1 second, but quite close, and quite a big improvement. Detailed results still needed, but improvement should already be seen on every platform.

Detailed Description
X does some dumb things during startup and shutdown that take far longer than is reasonable. Some of them have already been fixed, some still need addressing.

Things already fixed

 * Removed arbitrary 1 second delay in keyboard driver on VT switch, ostensibly to avoid spurious key events.
 * Mouse driver no longer attempts to probe the protocol on /dev/input/mice, since the kernel always upconverts to the ExplorerPS/2 protocol.
 * Mouse driver no longer sleeps for 0.3 seconds on shutdown for no reason.
 * Core server no longer sleeps for 1 second on shutdown for no reason.
 * Radeon driver no longer does brutally slow DDC setup for really rare old monitors.
 * File descriptor cache added to libpciaccess; good for about 0.25 second speedup on Intel chips.
 * Mouse driver traded for evdev, skips lots of PS/2 protocol detection and associated sleeps.
 * libpciaccess file descriptor cache added to improve PCI configuration speed.
 * Kernel-based modesetting on intel (optional) removes some startup latency since the kernel's already done it for us.

Things still to do

 * DDC probe itself could probably be made faster. I2C has three speeds, right now we're only doing the slowest.
 * Forking xkbcomp is a terrible idea.
 * Module loader is doing something inefficient in directory scanning, far more stats than should be necessary.
 * More per-driver analysis. Essential to review: radeon, intel, nv.  Would be nice: mga, savage, tdfx, via, mach64, misc, other.

Benefit to Fedora
Faster bootup means happier users. There are secondary effects in that it makes fast user switching (and slow user switching, i.e. logout) faster as well.

Scope
Small changes but over many packages, at least initially. Some problems may require architectural changes, like the xkbcomp disaster.

Test Plan
The reference machine is a Thinkpad T42 with an ATI Radeon Mobility M7 chip. Not fast, therefore a good target for tuning. Secondary testing with the vast pile of video cards in my cubicle.

Currently the reference machine starts and stops X in about 3.5 seconds. Radeon memory map setup is unfortunately quite finicky to solve properly without kernel support. XXX compare this time with F8.

A "pogo" option has been added to the X server to skip the dispatch loop entirely, meaning, just initialize and then immediately shut down. This allows rapid performance testing and easy timing comparison between configurations. The target is under one second for combined initialization and teardown.

To test this for yourself, run  from text mode. Unfortunately there's no corresponding option in F8, yet. Dear ajax: fix that in an update please?

User Experience
"Huh, feels faster for some reason."

Dependencies
X is rebasing to (what will eventually be) xserver 1.5 anyway. This pulls in some fixes for free, but does require that every driver be updated for the new PCI infrastructure.

Most changes are small and easy to merge with upstream as we go.

Contingency Plan
Since this is a collection of fixes, each one can be managed individually. In the worst case none of them make it in and X stays slow to launch.

Documentation
Not yet.

Release Notes
Fedora 9 features a number of changes designed to make X faster in starting and shutting down. Noticeable improvements have been made in Fedora 9. Full details of the project can be found through this feature page:

http://fedoraproject.org/wiki/Features/OneSecondX