1706f2543SmrgDistributed Multihead X design
2706f2543Smrg
3706f2543SmrgKevin E. Martin
4706f2543Smrg
5706f2543SmrgDavid H. Dawes
6706f2543Smrg
7706f2543SmrgRickard E. Faith
8706f2543Smrg
9706f2543Smrg   29 June 2004 (created 25 July 2001)
10706f2543Smrg
11706f2543Smrg   This document covers the motivation, background, design, and
12706f2543Smrg   implementation of the distributed multihead X (DMX) system. It
13706f2543Smrg   is a living document and describes the current design and
14706f2543Smrg   implementation details of the DMX system. As the project
15706f2543Smrg   progresses, this document will be continually updated to
16706f2543Smrg   reflect the changes in the code and/or design. Copyright 2001
17706f2543Smrg   by VA Linux Systems, Inc., Fremont, California. Copyright
18706f2543Smrg   2001-2004 by Red Hat, Inc., Raleigh, North Carolina
19706f2543Smrg     __________________________________________________________
20706f2543Smrg
21706f2543Smrg   Table of Contents
22706f2543Smrg
23706f2543Smrg   Introduction
24706f2543Smrg
25706f2543Smrg        The Distributed Multihead X Server
26706f2543Smrg        Layout of Paper
27706f2543Smrg
28706f2543Smrg   Development plan
29706f2543Smrg
30706f2543Smrg        Bootstrap code
31706f2543Smrg        Input device handling
32706f2543Smrg        Output device handling
33706f2543Smrg        Optimizing DMX
34706f2543Smrg        DMX X extension support
35706f2543Smrg        Common X extension support
36706f2543Smrg        OpenGL support
37706f2543Smrg
38706f2543Smrg   Current issues
39706f2543Smrg
40706f2543Smrg        Fonts
41706f2543Smrg        Zero width rendering primitives
42706f2543Smrg        Output scaling
43706f2543Smrg        Per-screen colormaps
44706f2543Smrg
45706f2543Smrg   A. Appendix
46706f2543Smrg
47706f2543Smrg        Background
48706f2543Smrg
49706f2543Smrg              Core input device handling
50706f2543Smrg              Output handling
51706f2543Smrg              Xinerama
52706f2543Smrg
53706f2543Smrg        Development Results
54706f2543Smrg
55706f2543Smrg              Phase I
56706f2543Smrg              Phase II
57706f2543Smrg              Phase III
58706f2543Smrg              Phase IV
59706f2543Smrg
60706f2543SmrgIntroduction
61706f2543Smrg
62706f2543SmrgThe Distributed Multihead X Server
63706f2543Smrg
64706f2543Smrg   Current Open Source multihead solutions are limited to a single
65706f2543Smrg   physical machine. A single X server controls multiple display
66706f2543Smrg   devices, which can be arranged as independent heads or unified
67706f2543Smrg   into a single desktop (with Xinerama). These solutions are
68706f2543Smrg   limited to the number of physical devices that can co-exist in
69706f2543Smrg   a single machine (e.g., due to the number of AGP/PCI slots
70706f2543Smrg   available for graphics cards). Thus, large tiled displays are
71706f2543Smrg   not currently possible. The work described in this paper will
72706f2543Smrg   eliminate the requirement that the display devices reside in
73706f2543Smrg   the same physical machine. This will be accomplished by
74706f2543Smrg   developing a front-end proxy X server that will control
75706f2543Smrg   multiple back-end X servers that make up the large display.
76706f2543Smrg
77706f2543Smrg   The overall structure of the distributed multihead X (DMX)
78706f2543Smrg   project is as follows: A single front-end X server will act as
79706f2543Smrg   a proxy to a set of back-end X servers, which handle all of the
80706f2543Smrg   visible rendering. X clients will connect to the front-end
81706f2543Smrg   server just as they normally would to a regular X server. The
82706f2543Smrg   front-end server will present an abstracted view to the client
83706f2543Smrg   of a single large display. This will ensure that all standard X
84706f2543Smrg   clients will continue to operate without modification (limited,
85706f2543Smrg   as always, by the visuals and extensions provided by the X
86706f2543Smrg   server). Clients that are DMX-aware will be able to use an
87706f2543Smrg   extension to obtain information about the back-end servers
88706f2543Smrg   (e.g., for placement of pop-up windows, window alignments by
89706f2543Smrg   the window manager, etc.).
90706f2543Smrg
91706f2543Smrg   The architecture of the DMX server is divided into two main
92706f2543Smrg   sections: input (e.g., mouse and keyboard events) and output
93706f2543Smrg   (e.g., rendering and windowing requests). Each of these are
94706f2543Smrg   describe briefly below, and the rest of this design document
95706f2543Smrg   will describe them in greater detail.
96706f2543Smrg
97706f2543Smrg   The DMX server can receive input from three general types of
98706f2543Smrg   input devices: "local" devices that are physically attached to
99706f2543Smrg   the machine on which DMX is running, "backend" devices that are
100706f2543Smrg   physically attached to one or more of the back-end X servers
101706f2543Smrg   (and that generate events via the X protocol stream from the
102706f2543Smrg   backend), and "console" devices that can be abstracted from any
103706f2543Smrg   non-back-end X server. Backend and console devices are treated
104706f2543Smrg   differently because the pointer device on the back-end X server
105706f2543Smrg   also controls the location of the hardware X cursor. Full
106706f2543Smrg   support for XInput extension devices is provided.
107706f2543Smrg
108706f2543Smrg   Rendering requests will be accepted by the front-end server;
109706f2543Smrg   however, rendering to visible windows will be broken down as
110706f2543Smrg   needed and sent to the appropriate back-end server(s) via X11
111706f2543Smrg   library calls for actual rendering. The basic framework will
112706f2543Smrg   follow a Xnest-style approach. GC state will be managed in the
113706f2543Smrg   front-end server and sent to the appropriate back-end server(s)
114706f2543Smrg   as required. Pixmap rendering will (at least initially) be
115706f2543Smrg   handled by the front-end X server. Windowing requests (e.g.,
116706f2543Smrg   ordering, mapping, moving, etc.) will handled in the front-end
117706f2543Smrg   server. If the request requires a visible change, the windowing
118706f2543Smrg   operation will be translated into requests for the appropriate
119706f2543Smrg   back-end server(s). Window state will be mirrored in the
120706f2543Smrg   back-end server(s) as needed.
121706f2543Smrg
122706f2543SmrgLayout of Paper
123706f2543Smrg
124706f2543Smrg   The next section describes the general development plan that
125706f2543Smrg   was actually used for implementation. The final section
126706f2543Smrg   discusses outstanding issues at the conclusion of development.
127706f2543Smrg   The first appendix provides low-level technical detail that may
128706f2543Smrg   be of interest to those intimately familiar with the X server
129706f2543Smrg   architecture. The final appendix describes the four phases of
130706f2543Smrg   development that were performed during the first two years of
131706f2543Smrg   development.
132706f2543Smrg
133706f2543Smrg   The final year of work was divided into 9 tasks that are not
134706f2543Smrg   described in specific sections of this document. The major
135706f2543Smrg   tasks during that time were the enhancement of the
136706f2543Smrg   reconfiguration ability added in Phase IV, addition of support
137706f2543Smrg   for a dynamic number of back-end displays (instead of a
138706f2543Smrg   hard-coded limit), and the support for back-end display and
139706f2543Smrg   input removal and addition. This work is mentioned in this
140706f2543Smrg   paper, but is not covered in detail.
141706f2543Smrg
142706f2543SmrgDevelopment plan
143706f2543Smrg
144706f2543Smrg   This section describes the development plan from approximately
145706f2543Smrg   June 2001 through July 2003.
146706f2543Smrg
147706f2543SmrgBootstrap code
148706f2543Smrg
149706f2543Smrg   To allow for rapid development of the DMX server by multiple
150706f2543Smrg   developers during the first development stage, the problem will
151706f2543Smrg   be broken down into three tasks: the overall DMX framework,
152706f2543Smrg   back-end rendering services and input device handling services.
153706f2543Smrg   However, before the work begins on these tasks, a simple
154706f2543Smrg   framework that each developer could use was implemented to
155706f2543Smrg   bootstrap the development effort. This framework renders to a
156706f2543Smrg   single back-end server and provides dummy input devices (i.e.,
157706f2543Smrg   the keyboard and mouse). The simple back-end rendering service
158706f2543Smrg   was implemented using the shadow framebuffer support currently
159706f2543Smrg   available in the XFree86 environment.
160706f2543Smrg
161706f2543Smrg   Using this bootstrapping framework, each developer has been
162706f2543Smrg   able to work on each of the tasks listed above independently as
163706f2543Smrg   follows: the framework will be extended to handle arbitrary
164706f2543Smrg   back-end server configurations; the back-end rendering services
165706f2543Smrg   will be transitioned to the more efficient Xnest-style
166706f2543Smrg   implementation; and, an input device framework to handle
167706f2543Smrg   various input devices via the input extension will be
168706f2543Smrg   developed.
169706f2543Smrg
170706f2543Smrg   Status: The boot strap code is complete.
171706f2543Smrg
172706f2543SmrgInput device handling
173706f2543Smrg
174706f2543Smrg   An X server (including the front-end X server) requires two
175706f2543Smrg   core input devices -- a keyboard and a pointer (mouse). These
176706f2543Smrg   core devices are handled and required by the core X11 protocol.
177706f2543Smrg   Additional types of input devices may be attached and utilized
178706f2543Smrg   via the XInput extension. These are usually referred to as
179706f2543Smrg   ``XInput extension devices'',
180706f2543Smrg
181706f2543Smrg   There are some options as to how the front-end X server gets
182706f2543Smrg   its core input devices:
183706f2543Smrg    1. Local Input. The physical input devices (e.g., keyboard and
184706f2543Smrg       mouse) can be attached directly to the front-end X server.
185706f2543Smrg       In this case, the keyboard and mouse on the machine running
186706f2543Smrg       the front-end X server will be used. The front-end will
187706f2543Smrg       have drivers to read the raw input from those devices and
188706f2543Smrg       convert it into the required X input events (e.g., key
189706f2543Smrg       press/release, pointer button press/release, pointer
190706f2543Smrg       motion). The front-end keyboard driver will keep track of
191706f2543Smrg       keyboard properties such as key and modifier mappings,
192706f2543Smrg       autorepeat state, keyboard sound and led state. Similarly
193706f2543Smrg       the front-end pointer driver will keep track if pointer
194706f2543Smrg       properties such as the button mapping and movement
195706f2543Smrg       acceleration parameters. With this option, input is handled
196706f2543Smrg       fully in the front-end X server, and the back-end X servers
197706f2543Smrg       are used in a display-only mode. This option was
198706f2543Smrg       implemented and works for a limited number of
199706f2543Smrg       Linux-specific devices. Adding additional local input
200706f2543Smrg       devices for other architectures is expected to be
201706f2543Smrg       relatively simple.
202706f2543Smrg       The following options are available for implementing local
203706f2543Smrg       input devices:
204706f2543Smrg         a. The XFree86 X server has modular input drivers that
205706f2543Smrg            could be adapted for this purpose. The mouse driver
206706f2543Smrg            supports a wide range of mouse types and interfaces,
207706f2543Smrg            as well as a range of Operating System platforms. The
208706f2543Smrg            keyboard driver in XFree86 is not currently as modular
209706f2543Smrg            as the mouse driver, but could be made so. The XFree86
210706f2543Smrg            X server also has a range of other input drivers for
211706f2543Smrg            extended input devices such as tablets and touch
212706f2543Smrg            screens. Unfortunately, the XFree86 drivers are
213706f2543Smrg            generally complex, often simultaneously providing
214706f2543Smrg            support for multiple devices across multiple
215706f2543Smrg            architectures; and rely so heavily on XFree86-specific
216706f2543Smrg            helper-functions, that this option was not pursued.
217706f2543Smrg         b. The kdrive X server in XFree86 has built-in drivers
218706f2543Smrg            that support PS/2 mice and keyboard under Linux. The
219706f2543Smrg            mouse driver can indirectly handle other mouse types
220706f2543Smrg            if the Linux utility gpm is used as to translate the
221706f2543Smrg            native mouse protocol into PS/2 mouse format. These
222706f2543Smrg            drivers could be adapted and built in to the front-end
223706f2543Smrg            X server if this range of hardware and OS support is
224706f2543Smrg            sufficient. While much simpler than the XFree86
225706f2543Smrg            drivers, the kdrive drivers were not used for the DMX
226706f2543Smrg            implementation.
227706f2543Smrg         c. Reimplementation of keyboard and mouse drivers from
228706f2543Smrg            scratch for the DMX framework. Because keyboard and
229706f2543Smrg            mouse drivers are relatively trivial to implement,
230706f2543Smrg            this pathway was selected. Other drivers in the X
231706f2543Smrg            source tree were referenced, and significant
232706f2543Smrg            contributions from other drivers are noted in the DMX
233706f2543Smrg            source code.
234706f2543Smrg    2. Backend Input. The front-end can make use of the core input
235706f2543Smrg       devices attached to one or more of the back-end X servers.
236706f2543Smrg       Core input events from multiple back-ends are merged into a
237706f2543Smrg       single input event stream. This can work sanely when only a
238706f2543Smrg       single set of input devices is used at any given time. The
239706f2543Smrg       keyboard and pointer state will be handled in the
240706f2543Smrg       front-end, with changes propagated to the back-end servers
241706f2543Smrg       as needed. This option was implemented and works well.
242706f2543Smrg       Because the core pointer on a back-end controls the
243706f2543Smrg       hardware mouse on that back-end, core pointers cannot be
244706f2543Smrg       treated as XInput extension devices. However, all back-end
245706f2543Smrg       XInput extensions devices can be mapped to either DMX core
246706f2543Smrg       or DMX XInput extension devices.
247706f2543Smrg    3. Console Input. The front-end server could create a console
248706f2543Smrg       window that is displayed on an X server independent of the
249706f2543Smrg       back-end X servers. This console window could display
250706f2543Smrg       things like the physical screen layout, and the front-end
251706f2543Smrg       could get its core input events from events delivered to
252706f2543Smrg       the console window. This option was implemented and works
253706f2543Smrg       well. To help the human navigate, window outlines are also
254706f2543Smrg       displayed in the console window. Further, console windows
255706f2543Smrg       can be used as either core or XInput extension devices.
256706f2543Smrg    4. Other options were initially explored, but they were all
257706f2543Smrg       partial subsets of the options listed above and, hence, are
258706f2543Smrg       irrelevant.
259706f2543Smrg
260706f2543Smrg   Although extended input devices are not specifically mentioned
261706f2543Smrg   in the Distributed X requirements, the options above were all
262706f2543Smrg   implemented so that XInput extension devices were supported.
263706f2543Smrg
264706f2543Smrg   The bootstrap code (Xdmx) had dummy input devices, and these
265706f2543Smrg   are still supported in the final version. These do the
266706f2543Smrg   necessary initialization to satisfy the X server's requirements
267706f2543Smrg   for core pointer and keyboard devices, but no input events are
268706f2543Smrg   ever generated.
269706f2543Smrg
270706f2543Smrg   Status: The input code is complete. Because of the complexity
271706f2543Smrg   of the XFree86 input device drivers (and their heavy reliance
272706f2543Smrg   on XFree86 infrastructure), separate low-level device drivers
273706f2543Smrg   were implemented for Xdmx. The following kinds of drivers are
274706f2543Smrg   supported (in general, the devices can be treated arbitrarily
275706f2543Smrg   as "core" input devices or as XInput "extension" devices; and
276706f2543Smrg   multiple instances of different kinds of devices can be
277706f2543Smrg   simultaneously available):
278706f2543Smrg    1. A "dummy" device drive that never generates events.
279706f2543Smrg    2. "Local" input is from the low-level hardware on which the
280706f2543Smrg       Xdmx binary is running. This is the only area where using
281706f2543Smrg       the XFree86 driver infrastructure would have been helpful,
282706f2543Smrg       and then only partially, since good support for generic USB
283706f2543Smrg       devices does not yet exist in XFree86 (in any case, XFree86
284706f2543Smrg       and kdrive driver code was used where possible). Currently,
285706f2543Smrg       the following local devices are supported under Linux
286706f2543Smrg       (porting to other operating systems should be fairly
287706f2543Smrg       straightforward):
288706f2543Smrg          + Linux keyboard
289706f2543Smrg          + Linux serial mouse (MS)
290706f2543Smrg          + Linux PS/2 mouse
291706f2543Smrg          + USB keyboard
292706f2543Smrg          + USB mouse
293706f2543Smrg          + USB generic device (e.g., joystick, gamepad, etc.)
294706f2543Smrg    3. "Backend" input is taken from one or more of the back-end
295706f2543Smrg       displays. In this case, events are taken from the back-end
296706f2543Smrg       X server and are converted to Xdmx events. Care must be
297706f2543Smrg       taken so that the sprite moves properly on the display from
298706f2543Smrg       which input is being taken.
299706f2543Smrg    4. "Console" input is taken from an X window that Xdmx creates
300706f2543Smrg       on the operator's display (i.e., on the machine running the
301706f2543Smrg       Xdmx binary). When the operator's mouse is inside the
302706f2543Smrg       console window, then those events are converted to Xdmx
303706f2543Smrg       events. Several special features are available: the console
304706f2543Smrg       can display outlines of windows that are on the Xdmx
305706f2543Smrg       display (to facilitate navigation), the cursor can be
306706f2543Smrg       confined to the console, and a "fine" mode can be activated
307706f2543Smrg       to allow very precise cursor positioning.
308706f2543Smrg
309706f2543SmrgOutput device handling
310706f2543Smrg
311706f2543Smrg   The output of the DMX system displays rendering and windowing
312706f2543Smrg   requests across multiple screens. The screens are typically
313706f2543Smrg   arranged in a grid such that together they represent a single
314706f2543Smrg   large display.
315706f2543Smrg
316706f2543Smrg   The output section of the DMX code consists of two parts. The
317706f2543Smrg   first is in the front-end proxy X server (Xdmx), which accepts
318706f2543Smrg   client connections, manages the windows, and potentially
319706f2543Smrg   renders primitives but does not actually display any of the
320706f2543Smrg   drawing primitives. The second part is the back-end X
321706f2543Smrg   server(s), which accept commands from the front-end server and
322706f2543Smrg   display the results on their screens.
323706f2543Smrg
324706f2543SmrgInitialization
325706f2543Smrg
326706f2543Smrg   The DMX front-end must first initialize its screens by
327706f2543Smrg   connecting to each of the back-end X servers and collecting
328706f2543Smrg   information about each of these screens. However, the
329706f2543Smrg   information collected from the back-end X servers might be
330706f2543Smrg   inconsistent. Handling these cases can be difficult and/or
331706f2543Smrg   inefficient. For example, a two screen system has one back-end
332706f2543Smrg   X server running at 16bpp while the second is running at 32bpp.
333706f2543Smrg   Converting rendering requests (e.g., XPutImage() or XGetImage()
334706f2543Smrg   requests) to the appropriate bit depth can be very time
335706f2543Smrg   consuming. Analyzing these cases to determine how or even if it
336706f2543Smrg   is possible to handle them is required. The current Xinerama
337706f2543Smrg   code handles many of these cases (e.g., in
338706f2543Smrg   PanoramiXConsolidate()) and will be used as a starting point.
339706f2543Smrg   In general, the best solution is to use homogeneous X servers
340706f2543Smrg   and display devices. Using back-end servers with the same depth
341706f2543Smrg   is a requirement of the final DMX implementation.
342706f2543Smrg
343706f2543Smrg   Once this screen consolidation is finished, the relative
344706f2543Smrg   position of each back-end X server's screen in the unified
345706f2543Smrg   screen is initialized. A full-screen window is opened on each
346706f2543Smrg   of the back-end X servers, and the cursor on each screen is
347706f2543Smrg   turned off. The final DMX implementation can also make use of a
348706f2543Smrg   partial-screen window, or multiple windows per back-end screen.
349706f2543Smrg
350706f2543SmrgHandling rendering requests
351706f2543Smrg
352706f2543Smrg   After initialization, X applications connect to the front-end
353706f2543Smrg   server. There are two possible implementations of how rendering
354706f2543Smrg   and windowing requests are handled in the DMX system:
355706f2543Smrg    1. A shadow framebuffer is used in the front-end server as the
356706f2543Smrg       render target. In this option, all protocol requests are
357706f2543Smrg       completely handled in the front-end server. All state and
358706f2543Smrg       resources are maintained in the front-end including a
359706f2543Smrg       shadow copy of the entire framebuffer. The framebuffers
360706f2543Smrg       attached to the back-end servers are updated by XPutImage()
361706f2543Smrg       calls with data taken directly from the shadow framebuffer.
362706f2543Smrg       This solution suffers from two main problems. First, it
363706f2543Smrg       does not take advantage of any accelerated hardware
364706f2543Smrg       available in the system. Second, the size of the
365706f2543Smrg       XPutImage() calls can be quite large and thus will be
366706f2543Smrg       limited by the bandwidth available.
367706f2543Smrg       The initial DMX implementation used a shadow framebuffer by
368706f2543Smrg       default.
369706f2543Smrg    2. Rendering requests are sent to each back-end server for
370706f2543Smrg       handling (as is done in the Xnest server described above).
371706f2543Smrg       In this option, certain protocol requests are handled in
372706f2543Smrg       the front-end server and certain requests are repackaged
373706f2543Smrg       and then sent to the back-end servers. The framebuffer is
374706f2543Smrg       distributed across the multiple back-end servers. Rendering
375706f2543Smrg       to the framebuffer is handled on each back-end and can take
376706f2543Smrg       advantage of any acceleration available on the back-end
377706f2543Smrg       servers' graphics display device. State is maintained both
378706f2543Smrg       in the front and back-end servers.
379706f2543Smrg       This solution suffers from two main drawbacks. First,
380706f2543Smrg       protocol requests are sent to all back-end servers -- even
381706f2543Smrg       those that will completely clip the rendering primitive --
382706f2543Smrg       which wastes bandwidth and processing time. Second, state
383706f2543Smrg       is maintained both in the front- and back-end servers.
384706f2543Smrg       These drawbacks are not as severe as in option 1 (above)
385706f2543Smrg       and can either be overcome through optimizations or are
386706f2543Smrg       acceptable. Therefore, this option will be used in the
387706f2543Smrg       final implementation.
388706f2543Smrg       The final DMX implementation defaults to this mechanism,
389706f2543Smrg       but also supports the shadow framebuffer mechanism. Several
390706f2543Smrg       optimizations were implemented to eliminate the drawbacks
391706f2543Smrg       of the default mechanism. These optimizations are described
392706f2543Smrg       the section below and in Phase II of the Development
393706f2543Smrg       Results (see appendix).
394706f2543Smrg
395706f2543Smrg   Status: Both the shadow framebuffer and Xnest-style code is
396706f2543Smrg   complete.
397706f2543Smrg
398706f2543SmrgOptimizing DMX
399706f2543Smrg
400706f2543Smrg   Initially, the Xnest-style solution's performance will be
401706f2543Smrg   measured and analyzed to determine where the performance
402706f2543Smrg   bottlenecks exist. There are four main areas that will be
403706f2543Smrg   addressed.
404706f2543Smrg
405706f2543Smrg   First, to obtain reasonable interactivity with the first
406706f2543Smrg   development phase, XSync() was called after each protocol
407706f2543Smrg   request. The XSync() function flushes any pending protocol
408706f2543Smrg   requests. It then waits for the back-end to process the request
409706f2543Smrg   and send a reply that the request has completed. This happens
410706f2543Smrg   with each back-end server and performance greatly suffers. As a
411706f2543Smrg   result of the way XSync() is called in the first development
412706f2543Smrg   phase, the batching that the X11 library performs is
413706f2543Smrg   effectively defeated. The XSync() call usage will be analyzed
414706f2543Smrg   and optimized by batching calls and performing them at regular
415706f2543Smrg   intervals, except where interactivity will suffer (e.g., on
416706f2543Smrg   cursor movements).
417706f2543Smrg
418706f2543Smrg   Second, the initial Xnest-style solution described above sends
419706f2543Smrg   the repackaged protocol requests to all back-end servers
420706f2543Smrg   regardless of whether or not they would be completely clipped
421706f2543Smrg   out. The requests that are trivially rejected on the back-end
422706f2543Smrg   server wastes the limited bandwidth available. By tracking
423706f2543Smrg   clipping changes in the DMX X server's windowing code (e.g., by
424706f2543Smrg   opening, closing, moving or resizing windows), we can determine
425706f2543Smrg   whether or not back-end windows are visible so that trivial
426706f2543Smrg   tests in the front-end server's GC ops drawing functions can
427706f2543Smrg   eliminate these unnecessary protocol requests.
428706f2543Smrg
429706f2543Smrg   Third, each protocol request will be analyzed to determine if
430706f2543Smrg   it is possible to break the request into smaller pieces at
431706f2543Smrg   display boundaries. The initial ones to be analyzed are put and
432706f2543Smrg   get image requests since they will require the greatest
433706f2543Smrg   bandwidth to transmit data between the front and back-end
434706f2543Smrg   servers. Other protocol requests will be analyzed and those
435706f2543Smrg   that will benefit from breaking them into smaller requests will
436706f2543Smrg   be implemented.
437706f2543Smrg
438706f2543Smrg   Fourth, an extension is being considered that will allow font
439706f2543Smrg   glyphs to be transferred from the front-end DMX X server to
440706f2543Smrg   each back-end server. This extension will permit the front-end
441706f2543Smrg   to handle all font requests and eliminate the requirement that
442706f2543Smrg   all back-end X servers share the exact same fonts as the
443706f2543Smrg   front-end server. We are investigating the feasibility of this
444706f2543Smrg   extension during this development phase.
445706f2543Smrg
446706f2543Smrg   Other potential optimizations will be determined from the
447706f2543Smrg   performance analysis.
448706f2543Smrg
449706f2543Smrg   Please note that in our initial design, we proposed optimizing
450706f2543Smrg   BLT operations (e.g., XCopyArea() and window moves) by
451706f2543Smrg   developing an extension that would allow individual back-end
452706f2543Smrg   servers to directly copy pixel data to other back-end servers.
453706f2543Smrg   This potential optimization was in response to the simple image
454706f2543Smrg   movement implementation that required potentially many calls to
455706f2543Smrg   GetImage() and PutImage(). However, the current Xinerama
456706f2543Smrg   implementation handles these BLT operations differently.
457706f2543Smrg   Instead of copying data to and from screens, they generate
458706f2543Smrg   expose events -- just as happens in the case when a window is
459706f2543Smrg   moved from off a screen to on screen. This approach saves the
460706f2543Smrg   limited bandwidth available between front and back-end servers
461706f2543Smrg   and is being standardized with Xinerama. It also eliminates the
462706f2543Smrg   potential setup problems and security issues resulting from
463706f2543Smrg   having each back-end server open connections to all other
464706f2543Smrg   back-end servers. Therefore, we suggest accepting Xinerama's
465706f2543Smrg   expose event solution.
466706f2543Smrg
467706f2543Smrg   Also note that the approach proposed in the second and third
468706f2543Smrg   optimizations might cause backing store algorithms in the
469706f2543Smrg   back-end to be defeated, so a DMX X server configuration flag
470706f2543Smrg   will be added to disable these optimizations.
471706f2543Smrg
472706f2543Smrg   Status: The optimizations proposed above are complete. It was
473706f2543Smrg   determined that the using the xfs font server was sufficient
474706f2543Smrg   and creating a new mechanism to pass glyphs was redundant;
475706f2543Smrg   therefore, the fourth optimization proposed above was not
476706f2543Smrg   included in DMX.
477706f2543Smrg
478706f2543SmrgDMX X extension support
479706f2543Smrg
480706f2543Smrg   The DMX X server keeps track of all the windowing information
481706f2543Smrg   on the back-end X servers, but does not currently export this
482706f2543Smrg   information to any client applications. An extension will be
483706f2543Smrg   developed to pass the screen information and back-end window
484706f2543Smrg   IDs to DMX-aware clients. These clients can then use this
485706f2543Smrg   information to directly connect to and render to the back-end
486706f2543Smrg   windows. Bypassing the DMX X server allows DMX-aware clients to
487706f2543Smrg   break up complex rendering requests on their own and send them
488706f2543Smrg   directly to the windows on the back-end server's screens. An
489706f2543Smrg   example of a client that can make effective use of this
490706f2543Smrg   extension is Chromium.
491706f2543Smrg
492706f2543Smrg   Status: The extension, as implemented, is fully documented in
493706f2543Smrg   "Client-to-Server DMX Extension to the X Protocol". Future
494706f2543Smrg   changes might be required based on feedback and other proposed
495706f2543Smrg   enhancements to DMX. Currently, the following facilities are
496706f2543Smrg   supported:
497706f2543Smrg    1. Screen information (clipping rectangle for each screen
498706f2543Smrg       relative to the virtual screen)
499706f2543Smrg    2. Window information (window IDs and clipping information for
500706f2543Smrg       each back-end window that corresponds to each DMX window)
501706f2543Smrg    3. Input device information (mappings from DMX device IDs to
502706f2543Smrg       back-end device IDs)
503706f2543Smrg    4. Force window creation (so that a client can override the
504706f2543Smrg       server-side lazy window creation optimization)
505706f2543Smrg    5. Reconfiguration (so that a client can request that a screen
506706f2543Smrg       position be changed)
507706f2543Smrg    6. Addition and removal of back-end servers and back-end and
508706f2543Smrg       console inputs.
509706f2543Smrg
510706f2543SmrgCommon X extension support
511706f2543Smrg
512706f2543Smrg   The XInput, XKeyboard and Shape extensions are commonly used
513706f2543Smrg   extensions to the base X11 protocol. XInput allows multiple and
514706f2543Smrg   non-standard input devices to be accessed simultaneously. These
515706f2543Smrg   input devices can be connected to either the front-end or
516706f2543Smrg   back-end servers. XKeyboard allows much better keyboard
517706f2543Smrg   mappings control. Shape adds support for arbitrarily shaped
518706f2543Smrg   windows and is used by various window managers. Nearly all
519706f2543Smrg   potential back-end X servers make these extensions available,
520706f2543Smrg   and support for each one will be added to the DMX system.
521706f2543Smrg
522706f2543Smrg   In addition to the extensions listed above, support for the X
523706f2543Smrg   Rendering extension (Render) is being developed. Render adds
524706f2543Smrg   digital image composition to the rendering model used by the X
525706f2543Smrg   Window System. While this extension is still under development
526706f2543Smrg   by Keith Packard of HP, support for the current version will be
527706f2543Smrg   added to the DMX system.
528706f2543Smrg
529706f2543Smrg   Support for the XTest extension was added during the first
530706f2543Smrg   development phase.
531706f2543Smrg
532706f2543Smrg   Status: The following extensions are supported and are
533706f2543Smrg   discussed in more detail in Phase IV of the Development Results
534706f2543Smrg   (see appendix): BIG-REQUESTS, DEC-XTRAP, DMX, DPMS,
535706f2543Smrg   Extended-Visual-Information, GLX, LBX, RECORD, RENDER,
536706f2543Smrg   SECURITY, SHAPE, SYNC, X-Resource, XC-APPGROUP, XC-MISC,
537706f2543Smrg   XFree86-Bigfont, XINERAMA, XInputExtension, XKEYBOARD, and
538706f2543Smrg   XTEST.
539706f2543Smrg
540706f2543SmrgOpenGL support
541706f2543Smrg
542706f2543Smrg   OpenGL support using the Mesa code base exists in XFree86
543706f2543Smrg   release 4 and later. Currently, the direct rendering
544706f2543Smrg   infrastructure (DRI) provides accelerated OpenGL support for
545706f2543Smrg   local clients and unaccelerated OpenGL support (i.e., software
546706f2543Smrg   rendering) is provided for non-local clients.
547706f2543Smrg
548706f2543Smrg   The single head OpenGL support in XFree86 4.x will be extended
549706f2543Smrg   to use the DMX system. When the front and back-end servers are
550706f2543Smrg   on the same physical hardware, it is possible to use the DRI to
551706f2543Smrg   directly render to the back-end servers. First, the existing
552706f2543Smrg   DRI will be extended to support multiple display heads, and
553706f2543Smrg   then to support the DMX system. OpenGL rendering requests will
554706f2543Smrg   be direct rendering to each back-end X server. The DRI will
555706f2543Smrg   request the screen layout (either from the existing Xinerama
556706f2543Smrg   extension or a DMX-specific extension). Support for
557706f2543Smrg   synchronized swap buffers will also be added (on hardware that
558706f2543Smrg   supports it). Note that a single front-end server with a single
559706f2543Smrg   back-end server on the same physical machine can emulate
560706f2543Smrg   accelerated indirect rendering.
561706f2543Smrg
562706f2543Smrg   When the front and back-end servers are on different physical
563706f2543Smrg   hardware or are using non-XFree86 4.x X servers, a mechanism to
564706f2543Smrg   render primitives across the back-end servers will be provided.
565706f2543Smrg   There are several options as to how this can be implemented.
566706f2543Smrg    1. The existing OpenGL support in each back-end server can be
567706f2543Smrg       used by repackaging rendering primitives and sending them
568706f2543Smrg       to each back-end server. This option is similar to the
569706f2543Smrg       unoptimized Xnest-style approach mentioned above.
570706f2543Smrg       Optimization of this solution is beyond the scope of this
571706f2543Smrg       project and is better suited to other distributed rendering
572706f2543Smrg       systems.
573706f2543Smrg    2. Rendering to a pixmap in the front-end server using the
574706f2543Smrg       current XFree86 4.x code, and then displaying to the
575706f2543Smrg       back-ends via calls to XPutImage() is another option. This
576706f2543Smrg       option is similar to the shadow frame buffer approach
577706f2543Smrg       mentioned above. It is slower and bandwidth intensive, but
578706f2543Smrg       has the advantage that the back-end servers are not
579706f2543Smrg       required to have OpenGL support.
580706f2543Smrg
581706f2543Smrg   These, and other, options will be investigated in this phase of
582706f2543Smrg   the work.
583706f2543Smrg
584706f2543Smrg   Work by others have made Chromium DMX-aware. Chromium will use
585706f2543Smrg   the DMX X protocol extension to obtain information about the
586706f2543Smrg   back-end servers and will render directly to those servers,
587706f2543Smrg   bypassing DMX.
588706f2543Smrg
589706f2543Smrg   Status: OpenGL support by the glxProxy extension was
590706f2543Smrg   implemented by SGI and has been integrated into the DMX code
591706f2543Smrg   base.
592706f2543Smrg
593706f2543SmrgCurrent issues
594706f2543Smrg
595706f2543Smrg   In this sections the current issues are outlined that require
596706f2543Smrg   further investigation.
597706f2543Smrg
598706f2543SmrgFonts
599706f2543Smrg
600706f2543Smrg   The font path and glyphs need to be the same for the front-end
601706f2543Smrg   and each of the back-end servers. Font glyphs could be sent to
602706f2543Smrg   the back-end servers as necessary but this would consume a
603706f2543Smrg   significant amount of available bandwidth during font rendering
604706f2543Smrg   for clients that use many different fonts (e.g., Netscape).
605706f2543Smrg   Initially, the font server (xfs) will be used to provide the
606706f2543Smrg   fonts to both the front-end and back-end servers. Other
607706f2543Smrg   possibilities will be investigated during development.
608706f2543Smrg
609706f2543SmrgZero width rendering primitives
610706f2543Smrg
611706f2543Smrg   To allow pixmap and on-screen rendering to be pixel perfect,
612706f2543Smrg   all back-end servers must render zero width primitives exactly
613706f2543Smrg   the same as the front-end renders the primitives to pixmaps.
614706f2543Smrg   For those back-end servers that do not exactly match, zero
615706f2543Smrg   width primitives will be automatically converted to one width
616706f2543Smrg   primitives. This can be handled in the front-end server via the
617706f2543Smrg   GC state.
618706f2543Smrg
619706f2543SmrgOutput scaling
620706f2543Smrg
621706f2543Smrg   With very large tiled displays, it might be difficult to read
622706f2543Smrg   the information on the standard X desktop. In particular, the
623706f2543Smrg   cursor can be easily lost and fonts could be difficult to read.
624706f2543Smrg   Automatic primitive scaling might prove to be very useful. We
625706f2543Smrg   will investigate the possibility of scaling the cursor and
626706f2543Smrg   providing a set of alternate pre-scaled fonts to replace the
627706f2543Smrg   standard fonts that many applications use (e.g., fixed). Other
628706f2543Smrg   options for automatic scaling will also be investigated.
629706f2543Smrg
630706f2543SmrgPer-screen colormaps
631706f2543Smrg
632706f2543Smrg   Each screen's default colormap in the set of back-end X servers
633706f2543Smrg   should be able to be adjusted via a configuration utility. This
634706f2543Smrg   support is would allow the back-end screens to be calibrated
635706f2543Smrg   via custom gamma tables. On 24-bit systems that support a
636706f2543Smrg   DirectColor visual, this type of correction can be
637706f2543Smrg   accommodated. One possible implementation would be to advertise
638706f2543Smrg   to X client of the DMX server a TrueColor visual while using
639706f2543Smrg   DirectColor visuals on the back-end servers to implement this
640706f2543Smrg   type of color correction. Other options will be investigated.
641706f2543Smrg
642706f2543SmrgA. Appendix
643706f2543Smrg
644706f2543SmrgBackground
645706f2543Smrg
646706f2543Smrg   This section describes the existing Open Source architectures
647706f2543Smrg   that can be used to handle multiple screens and upon which this
648706f2543Smrg   development project is based. This section was written before
649706f2543Smrg   the implementation was finished, and may not reflect actual
650706f2543Smrg   details of the implementation. It is left for historical
651706f2543Smrg   interest only.
652706f2543Smrg
653706f2543SmrgCore input device handling
654706f2543Smrg
655706f2543Smrg   The following is a description of how core input devices are
656706f2543Smrg   handled by an X server.
657706f2543Smrg
658706f2543SmrgInitInput()
659706f2543Smrg
660706f2543Smrg   InitInput() is a DDX function that is called at the start of
661706f2543Smrg   each server generation from the X server's main() function. Its
662706f2543Smrg   purpose is to determine what input devices are connected to the
663706f2543Smrg   X server, register them with the DIX and MI layers, and
664706f2543Smrg   initialize the input event queue. InitInput() does not have a
665706f2543Smrg   return value, but the X server will abort if either a core
666706f2543Smrg   keyboard device or a core pointer device are not registered.
667706f2543Smrg   Extended input (XInput) devices can also be registered in
668706f2543Smrg   InitInput().
669706f2543Smrg
670706f2543Smrg   InitInput() usually has implementation specific code to
671706f2543Smrg   determine which input devices are available. For each input
672706f2543Smrg   device it will be using, it calls AddInputDevice():
673706f2543Smrg
674706f2543Smrg   AddInputDevice()
675706f2543Smrg
676706f2543Smrg   This DIX function allocates the device structure, registers a
677706f2543Smrg   callback function (which handles device init, close, on and
678706f2543Smrg   off), and returns the input handle, which can be treated as
679706f2543Smrg   opaque. It is called once for each input device.
680706f2543Smrg
681706f2543Smrg   Once input handles for core keyboard and core pointer devices
682706f2543Smrg   have been obtained from AddInputDevice(). If both core devices
683706f2543Smrg   are not registered, then the X server will exit with a fatal
684706f2543Smrg   error when it attempts to start the input devices in
685706f2543Smrg   InitAndStartDevices(), which is called directly after
686706f2543Smrg   InitInput() (see below).
687706f2543Smrg
688706f2543Smrg   The core pointer device is then registered with the miPointer
689706f2543Smrg   code (which does the high level cursor handling). While this
690706f2543Smrg   registration is not necessary for correct miPointer operation
691706f2543Smrg   in the current XFree86 code, it is still done mostly for
692706f2543Smrg   compatibility reasons.
693706f2543Smrg
694706f2543Smrg   miRegisterPointerDevice()
695706f2543Smrg
696706f2543Smrg   This MI function registers the core pointer's input handle with
697706f2543Smrg   with the miPointer code.
698706f2543Smrg
699706f2543Smrg   The final part of InitInput() is the initialization of the
700706f2543Smrg   input event queue handling. In most cases, the event queue
701706f2543Smrg   handling provided in the MI layer is used. The primary XFree86
702706f2543Smrg   X server uses its own event queue handling to support some
703706f2543Smrg   special cases related to the XInput extension and the
704706f2543Smrg   XFree86-specific DGA extension. For our purposes, the MI event
705706f2543Smrg   queue handling should be suitable. It is initialized by calling
706706f2543Smrg   mieqInit():
707706f2543Smrg
708706f2543Smrg   mieqInit()
709706f2543Smrg
710706f2543Smrg   This MI function initializes the MI event queue for the core
711706f2543Smrg   devices, and is passed the public component of the input
712706f2543Smrg   handles for the two core devices.
713706f2543Smrg
714706f2543Smrg   If a wakeup handler is required to deliver synchronous input
715706f2543Smrg   events, it can be registered here by calling the DIX function
716706f2543Smrg   RegisterBlockAndWakeupHandlers(). (See the devReadInput()
717706f2543Smrg   description below.)
718706f2543Smrg
719706f2543SmrgInitAndStartDevices()
720706f2543Smrg
721706f2543Smrg   InitAndStartDevices() is a DIX function that is called
722706f2543Smrg   immediately after InitInput() from the X server's main()
723706f2543Smrg   function. Its purpose is to initialize each input device that
724706f2543Smrg   was registered with AddInputDevice(), enable each input device
725706f2543Smrg   that was successfully initialized, and create the list of
726706f2543Smrg   enabled input devices. Once each registered device is processed
727706f2543Smrg   in this way, the list of enabled input devices is checked to
728706f2543Smrg   make sure that both a core keyboard device and core pointer
729706f2543Smrg   device were registered and successfully enabled. If not,
730706f2543Smrg   InitAndStartDevices() returns failure, and results in the the X
731706f2543Smrg   server exiting with a fatal error.
732706f2543Smrg
733706f2543Smrg   Each registered device is initialized by calling its callback
734706f2543Smrg   (dev->deviceProc) with the DEVICE_INIT argument:
735706f2543Smrg
736706f2543Smrg   (*dev->deviceProc)(dev, DEVICE_INIT)
737706f2543Smrg
738706f2543Smrg   This function initializes the device structs with core
739706f2543Smrg   information relevant to the device.
740706f2543Smrg
741706f2543Smrg   For pointer devices, this means specifying the number of
742706f2543Smrg   buttons, default button mapping, the function used to get
743706f2543Smrg   motion events (usually miPointerGetMotionEvents()), the
744706f2543Smrg   function used to change/control the core pointer motion
745706f2543Smrg   parameters (acceleration and threshold), and the motion buffer
746706f2543Smrg   size.
747706f2543Smrg
748706f2543Smrg   For keyboard devices, this means specifying the keycode range,
749706f2543Smrg   default keycode to keysym mapping, default modifier mapping,
750706f2543Smrg   and the functions used to sound the keyboard bell and
751706f2543Smrg   modify/control the keyboard parameters (LEDs, bell pitch and
752706f2543Smrg   duration, key click, which keys are auto-repeating, etc).
753706f2543Smrg
754706f2543Smrg   Each initialized device is enabled by calling EnableDevice():
755706f2543Smrg
756706f2543Smrg   EnableDevice()
757706f2543Smrg
758706f2543Smrg   EnableDevice() calls the device callback with DEVICE_ON:
759706f2543Smrg
760706f2543Smrg   (*dev->deviceProc)(dev, DEVICE_ON)
761706f2543Smrg
762706f2543Smrg   This typically opens and initializes the relevant physical
763706f2543Smrg   device, and when appropriate, registers the device's file
764706f2543Smrg   descriptor (or equivalent) as a valid input source.
765706f2543Smrg
766706f2543Smrg   EnableDevice() then adds the device handle to the X server's
767706f2543Smrg   global list of enabled devices.
768706f2543Smrg
769706f2543Smrg   InitAndStartDevices() then verifies that a valid core keyboard
770706f2543Smrg   and pointer has been initialized and enabled. It returns
771706f2543Smrg   failure if either are missing.
772706f2543Smrg
773706f2543SmrgdevReadInput()
774706f2543Smrg
775706f2543Smrg   Each device will have some function that gets called to read
776706f2543Smrg   its physical input. These may be called in a number of
777706f2543Smrg   different ways. In the case of synchronous I/O, they will be
778706f2543Smrg   called from a DDX wakeup-handler that gets called after the
779706f2543Smrg   server detects that new input is available. In the case of
780706f2543Smrg   asynchronous I/O, they will be called from a (SIGIO) signal
781706f2543Smrg   handler triggered when new input is available. This function
782706f2543Smrg   should do at least two things: make sure that input events get
783706f2543Smrg   enqueued, and make sure that the cursor gets moved for motion
784706f2543Smrg   events (except if these are handled later by the driver's own
785706f2543Smrg   event queue processing function, which cannot be done when
786706f2543Smrg   using the MI event queue handling).
787706f2543Smrg
788706f2543Smrg   Events are queued by calling mieqEnqueue():
789706f2543Smrg
790706f2543Smrg   mieqEnqueue()
791706f2543Smrg
792706f2543Smrg   This MI function is used to add input events to the event
793706f2543Smrg   queue. It is simply passed the event to be queued.
794706f2543Smrg
795706f2543Smrg   The cursor position should be updated when motion events are
796706f2543Smrg   enqueued, by calling either miPointerAbsoluteCursor() or
797706f2543Smrg   miPointerDeltaCursor():
798706f2543Smrg
799706f2543Smrg   miPointerAbsoluteCursor()
800706f2543Smrg
801706f2543Smrg   This MI function is used to move the cursor to the absolute
802706f2543Smrg   coordinates provided.
803706f2543Smrg
804706f2543Smrg   miPointerDeltaCursor()
805706f2543Smrg
806706f2543Smrg   This MI function is used to move the cursor relative to its
807706f2543Smrg   current position.
808706f2543Smrg
809706f2543SmrgProcessInputEvents()
810706f2543Smrg
811706f2543Smrg   ProcessInputEvents() is a DDX function that is called from the
812706f2543Smrg   X server's main dispatch loop when new events are available in
813706f2543Smrg   the input event queue. It typically processes the enqueued
814706f2543Smrg   events, and updates the cursor/pointer position. It may also do
815706f2543Smrg   other DDX-specific event processing.
816706f2543Smrg
817706f2543Smrg   Enqueued events are processed by mieqProcessInputEvents() and
818706f2543Smrg   passed to the DIX layer for transmission to clients:
819706f2543Smrg
820706f2543Smrg   mieqProcessInputEvents()
821706f2543Smrg
822706f2543Smrg   This function processes each event in the event queue, and
823706f2543Smrg   passes it to the device's input processing function. The DIX
824706f2543Smrg   layer provides default functions to do this processing, and
825706f2543Smrg   they handle the task of getting the events passed back to the
826706f2543Smrg   relevant clients.
827706f2543Smrg
828706f2543Smrg   miPointerUpdate()
829706f2543Smrg
830706f2543Smrg   This function resynchronized the cursor position with the new
831706f2543Smrg   pointer position. It also takes care of moving the cursor
832706f2543Smrg   between screens when needed in multi-head configurations.
833706f2543Smrg
834706f2543SmrgDisableDevice()
835706f2543Smrg
836706f2543Smrg   DisableDevice is a DIX function that removes an input device
837706f2543Smrg   from the list of enabled devices. The result of this is that
838706f2543Smrg   the device no longer generates input events. The device's data
839706f2543Smrg   structures are kept in place, and disabling a device like this
840706f2543Smrg   can be reversed by calling EnableDevice(). DisableDevice() may
841706f2543Smrg   be called from the DDX when it is desirable to do so (e.g., the
842706f2543Smrg   XFree86 server does this when VT switching). Except for special
843706f2543Smrg   cases, this is not normally called for core input devices.
844706f2543Smrg
845706f2543Smrg   DisableDevice() calls the device's callback function with
846706f2543Smrg   DEVICE_OFF:
847706f2543Smrg
848706f2543Smrg   (*dev->deviceProc)(dev, DEVICE_OFF)
849706f2543Smrg
850706f2543Smrg   This typically closes the relevant physical device, and when
851706f2543Smrg   appropriate, unregisters the device's file descriptor (or
852706f2543Smrg   equivalent) as a valid input source.
853706f2543Smrg
854706f2543Smrg   DisableDevice() then removes the device handle from the X
855706f2543Smrg   server's global list of enabled devices.
856706f2543Smrg
857706f2543SmrgCloseDevice()
858706f2543Smrg
859706f2543Smrg   CloseDevice is a DIX function that removes an input device from
860706f2543Smrg   the list of available devices. It disables input from the
861706f2543Smrg   device and frees all data structures associated with the
862706f2543Smrg   device. This function is usually called from
863706f2543Smrg   CloseDownDevices(), which is called from main() at the end of
864706f2543Smrg   each server generation to close all input devices.
865706f2543Smrg
866706f2543Smrg   CloseDevice() calls the device's callback function with
867706f2543Smrg   DEVICE_CLOSE:
868706f2543Smrg
869706f2543Smrg   (*dev->deviceProc)(dev, DEVICE_CLOSE)
870706f2543Smrg
871706f2543Smrg   This typically closes the relevant physical device, and when
872706f2543Smrg   appropriate, unregisters the device's file descriptor (or
873706f2543Smrg   equivalent) as a valid input source. If any device specific
874706f2543Smrg   data structures were allocated when the device was initialized,
875706f2543Smrg   they are freed here.
876706f2543Smrg
877706f2543Smrg   CloseDevice() then frees the data structures that were
878706f2543Smrg   allocated for the device when it was registered/initialized.
879706f2543Smrg
880706f2543SmrgLegalModifier()
881706f2543Smrg
882706f2543Smrg   LegalModifier() is a required DDX function that can be used to
883706f2543Smrg   restrict which keys may be modifier keys. This seems to be
884706f2543Smrg   present for historical reasons, so this function should simply
885706f2543Smrg   return TRUE unconditionally.
886706f2543Smrg
887706f2543SmrgOutput handling
888706f2543Smrg
889706f2543Smrg   The following sections describe the main functions required to
890706f2543Smrg   initialize, use and close the output device(s) for each screen
891706f2543Smrg   in the X server.
892706f2543Smrg
893706f2543SmrgInitOutput()
894706f2543Smrg
895706f2543Smrg   This DDX function is called near the start of each server
896706f2543Smrg   generation from the X server's main() function. InitOutput()'s
897706f2543Smrg   main purpose is to initialize each screen and fill in the
898706f2543Smrg   global screenInfo structure for each screen. It is passed three
899706f2543Smrg   arguments: a pointer to the screenInfo struct, which it is to
900706f2543Smrg   initialize, and argc and argv from main(), which can be used to
901706f2543Smrg   determine additional configuration information.
902706f2543Smrg
903706f2543Smrg   The primary tasks for this function are outlined below:
904706f2543Smrg    1. Parse configuration info: The first task of InitOutput() is
905706f2543Smrg       to parses any configuration information from the
906706f2543Smrg       configuration file. In addition to the XF86Config file,
907706f2543Smrg       other configuration information can be taken from the
908706f2543Smrg       command line. The command line options can be gathered
909706f2543Smrg       either in InitOutput() or earlier in the
910706f2543Smrg       ddxProcessArgument() function, which is called by
911706f2543Smrg       ProcessCommandLine(). The configuration information
912706f2543Smrg       determines the characteristics of the screen(s). For
913706f2543Smrg       example, in the XFree86 X server, the XF86Config file
914706f2543Smrg       specifies the monitor information, the screen resolution,
915706f2543Smrg       the graphics devices and slots in which they are located,
916706f2543Smrg       and, for Xinerama, the screens' layout.
917706f2543Smrg    2. Initialize screen info: The next task is to initialize the
918706f2543Smrg       screen-dependent internal data structures. For example,
919706f2543Smrg       part of what the XFree86 X server does is to allocate its
920706f2543Smrg       screen and pixmap private indices, probe for graphics
921706f2543Smrg       devices, compare the probed devices to the ones listed in
922706f2543Smrg       the XF86Config file, and add the ones that match to the
923706f2543Smrg       internal xf86Screens[] structure.
924706f2543Smrg    3. Set pixmap formats: The next task is to initialize the
925706f2543Smrg       screenInfo's image byte order, bitmap bit order and bitmap
926706f2543Smrg       scanline unit/pad. The screenInfo's pixmap format's depth,
927706f2543Smrg       bits per pixel and scanline padding is also initialized at
928706f2543Smrg       this stage.
929706f2543Smrg    4. Unify screen info: An optional task that might be done at
930706f2543Smrg       this stage is to compare all of the information from the
931706f2543Smrg       various screens and determines if they are compatible
932706f2543Smrg       (i.e., if the set of screens can be unified into a single
933706f2543Smrg       desktop). This task has potential to be useful to the DMX
934706f2543Smrg       front-end server, if Xinerama's PanoramiXConsolidate()
935706f2543Smrg       function is not sufficient.
936706f2543Smrg
937706f2543Smrg   Once these tasks are complete, the valid screens are known and
938706f2543Smrg   each of these screens can be initialized by calling
939706f2543Smrg   AddScreen().
940706f2543Smrg
941706f2543SmrgAddScreen()
942706f2543Smrg
943706f2543Smrg   This DIX function is called from InitOutput(), in the DDX
944706f2543Smrg   layer, to add each new screen to the screenInfo structure. The
945706f2543Smrg   DDX screen initialization function and command line arguments
946706f2543Smrg   (i.e., argc and argv) are passed to it as arguments.
947706f2543Smrg
948706f2543Smrg   This function first allocates a new Screen structure and any
949706f2543Smrg   privates that are required. It then initializes some of the
950706f2543Smrg   fields in the Screen struct and sets up the pixmap padding
951706f2543Smrg   information. Finally, it calls the DDX screen initialization
952706f2543Smrg   function ScreenInit(), which is described below. It returns the
953706f2543Smrg   number of the screen that were just added, or -1 if there is
954706f2543Smrg   insufficient memory to add the screen or if the DDX screen
955706f2543Smrg   initialization fails.
956706f2543Smrg
957706f2543SmrgScreenInit()
958706f2543Smrg
959706f2543Smrg   This DDX function initializes the rest of the Screen structure
960706f2543Smrg   with either generic or screen-specific functions (as
961706f2543Smrg   necessary). It also fills in various screen attributes (e.g.,
962706f2543Smrg   width and height in millimeters, black and white pixel values).
963706f2543Smrg
964706f2543Smrg   The screen init function usually calls several functions to
965706f2543Smrg   perform certain screen initialization functions. They are
966706f2543Smrg   described below:
967706f2543Smrg
968706f2543Smrg   {mi,*fb}ScreenInit()
969706f2543Smrg
970706f2543Smrg   The DDX layer's ScreenInit() function usually calls another
971706f2543Smrg   layer's ScreenInit() function (e.g., miScreenInit() or
972706f2543Smrg   fbScreenInit()) to initialize the fallbacks that the DDX driver
973706f2543Smrg   does not specifically handle.
974706f2543Smrg
975706f2543Smrg   After calling another layer's ScreenInit() function, any
976706f2543Smrg   screen-specific functions either wrap or replace the other
977706f2543Smrg   layer's function pointers. If a function is to be wrapped, each
978706f2543Smrg   of the old function pointers from the other layer are stored in
979706f2543Smrg   a screen private area. Common functions to wrap are
980706f2543Smrg   CloseScreen() and SaveScreen().
981706f2543Smrg
982706f2543Smrg   miInitializeBackingStore()
983706f2543Smrg
984706f2543Smrg   This MI function initializes the screen's backing storage
985706f2543Smrg   functions, which are used to save areas of windows that are
986706f2543Smrg   currently covered by other windows.
987706f2543Smrg
988706f2543Smrg   miDCInitialize()
989706f2543Smrg
990706f2543Smrg   This MI function initializes the MI cursor display structures
991706f2543Smrg   and function pointers. If a hardware cursor is used, the DDX
992706f2543Smrg   layer's ScreenInit() function will wrap additional screen and
993706f2543Smrg   the MI cursor display function pointers.
994706f2543Smrg
995706f2543Smrg   Another common task for ScreenInit() function is to initialize
996706f2543Smrg   the output device state. For example, in the XFree86 X server,
997706f2543Smrg   the ScreenInit() function saves the original state of the video
998706f2543Smrg   card and then initializes the video mode of the graphics
999706f2543Smrg   device.
1000706f2543Smrg
1001706f2543SmrgCloseScreen()
1002706f2543Smrg
1003706f2543Smrg   This function restores any wrapped screen functions (and in
1004706f2543Smrg   particular the wrapped CloseScreen() function) and restores the
1005706f2543Smrg   state of the output device to its original state. It should
1006706f2543Smrg   also free any private data it created during the screen
1007706f2543Smrg   initialization.
1008706f2543Smrg
1009706f2543SmrgGC operations
1010706f2543Smrg
1011706f2543Smrg   When the X server is requested to render drawing primitives, it
1012706f2543Smrg   does so by calling drawing functions through the graphics
1013706f2543Smrg   context's operation function pointer table (i.e., the GCOps
1014706f2543Smrg   functions). These functions render the basic graphics
1015706f2543Smrg   operations such as drawing rectangles, lines, text or copying
1016706f2543Smrg   pixmaps. Default routines are provided either by the MI layer,
1017706f2543Smrg   which draws indirectly through a simple span interface, or by
1018706f2543Smrg   the framebuffer layers (e.g., CFB, MFB, FB), which draw
1019706f2543Smrg   directly to a linearly mapped frame buffer.
1020706f2543Smrg
1021706f2543Smrg   To take advantage of special hardware on the graphics device,
1022706f2543Smrg   specific GCOps functions can be replaced by device specific
1023706f2543Smrg   code. However, many times the graphics devices can handle only
1024706f2543Smrg   a subset of the possible states of the GC, so during graphics
1025706f2543Smrg   context validation, appropriate routines are selected based on
1026706f2543Smrg   the state and capabilities of the hardware. For example, some
1027706f2543Smrg   graphics hardware can accelerate single pixel width lines with
1028706f2543Smrg   certain dash patterns. Thus, for dash patterns that are not
1029706f2543Smrg   supported by hardware or for width 2 or greater lines, the
1030706f2543Smrg   default routine is chosen during GC validation.
1031706f2543Smrg
1032706f2543Smrg   Note that some pointers to functions that draw to the screen
1033706f2543Smrg   are stored in the Screen structure. They include GetImage(),
1034706f2543Smrg   GetSpans(), CopyWindow() and RestoreAreas().
1035706f2543Smrg
1036706f2543SmrgXnest
1037706f2543Smrg
1038706f2543Smrg   The Xnest X server is a special proxy X server that relays the
1039706f2543Smrg   X protocol requests that it receives to a ``real'' X server
1040706f2543Smrg   that then processes the requests and displays the results, if
1041706f2543Smrg   applicable. To the X applications, Xnest appears as if it is a
1042706f2543Smrg   regular X server. However, Xnest is both server to the X
1043706f2543Smrg   application and client of the real X server, which will
1044706f2543Smrg   actually handle the requests.
1045706f2543Smrg
1046706f2543Smrg   The Xnest server implements all of the standard input and
1047706f2543Smrg   output initialization steps outlined above.
1048706f2543Smrg
1049706f2543Smrg   InitOutput()
1050706f2543Smrg
1051706f2543Smrg   Xnest takes its configuration information from command line
1052706f2543Smrg   arguments via ddxProcessArguments(). This information includes
1053706f2543Smrg   the real X server display to connect to, its default visual
1054706f2543Smrg   class, the screen depth, the Xnest window's geometry, etc.
1055706f2543Smrg   Xnest then connects to the real X server and gathers visual,
1056706f2543Smrg   colormap, depth and pixmap information about that server's
1057706f2543Smrg   display, creates a window on that server, which will be used as
1058706f2543Smrg   the root window for Xnest.
1059706f2543Smrg
1060706f2543Smrg   Next, Xnest initializes its internal data structures and uses
1061706f2543Smrg   the data from the real X server's pixmaps to initialize its own
1062706f2543Smrg   pixmap formats. Finally, it calls AddScreen(xnestOpenScreen,
1063706f2543Smrg   argc, argv) to initialize each of its screens.
1064706f2543Smrg
1065706f2543Smrg   ScreenInit()
1066706f2543Smrg
1067706f2543Smrg   Xnest's ScreenInit() function is called xnestOpenScreen(). This
1068706f2543Smrg   function initializes its screen's depth and visual information,
1069706f2543Smrg   and then calls miScreenInit() to set up the default screen
1070706f2543Smrg   functions. It then calls miInitializeBackingStore() and
1071706f2543Smrg   miDCInitialize() to initialize backing store and the software
1072706f2543Smrg   cursor. Finally, it replaces many of the screen functions with
1073706f2543Smrg   its own functions that repackage and send the requests to the
1074706f2543Smrg   real X server to which Xnest is attached.
1075706f2543Smrg
1076706f2543Smrg   CloseScreen()
1077706f2543Smrg
1078706f2543Smrg   This function frees its internal data structure allocations.
1079706f2543Smrg   Since it replaces instead of wrapping screen functions, there
1080706f2543Smrg   are no function pointers to unwrap. This can potentially lead
1081706f2543Smrg   to problems during server regeneration.
1082706f2543Smrg
1083706f2543Smrg   GC operations
1084706f2543Smrg
1085706f2543Smrg   The GC operations in Xnest are very simple since they leave all
1086706f2543Smrg   of the drawing to the real X server to which Xnest is attached.
1087706f2543Smrg   Each of the GCOps takes the request and sends it to the real X
1088706f2543Smrg   server using standard Xlib calls. For example, the X
1089706f2543Smrg   application issues a XDrawLines() call. This function turns
1090706f2543Smrg   into a protocol request to Xnest, which calls the
1091706f2543Smrg   xnestPolylines() function through Xnest's GCOps function
1092706f2543Smrg   pointer table. The xnestPolylines() function is only a single
1093706f2543Smrg   line, which calls XDrawLines() using the same arguments that
1094706f2543Smrg   were passed into it. Other GCOps functions are very similar.
1095706f2543Smrg   Two exceptions to the simple GCOps functions described above
1096706f2543Smrg   are the image functions and the BLT operations.
1097706f2543Smrg
1098706f2543Smrg   The image functions, GetImage() and PutImage(), must use a
1099706f2543Smrg   temporary image to hold the image to be put of the image that
1100706f2543Smrg   was just grabbed from the screen while it is in transit to the
1101706f2543Smrg   real X server or the client. When the image has been
1102706f2543Smrg   transmitted, the temporary image is destroyed.
1103706f2543Smrg
1104706f2543Smrg   The BLT operations, CopyArea() and CopyPlane(), handle not only
1105706f2543Smrg   the copy function, which is the same as the simple cases
1106706f2543Smrg   described above, but also the graphics exposures that result
1107706f2543Smrg   when the GC's graphics exposure bit is set to True. Graphics
1108706f2543Smrg   exposures are handled in a helper function,
1109706f2543Smrg   xnestBitBlitHelper(). This function collects the exposure
1110706f2543Smrg   events from the real X server and, if any resulting in regions
1111706f2543Smrg   being exposed, then those regions are passed back to the MI
1112706f2543Smrg   layer so that it can generate exposure events for the X
1113706f2543Smrg   application.
1114706f2543Smrg
1115706f2543Smrg   The Xnest server takes its input from the X server to which it
1116706f2543Smrg   is connected. When the mouse is in the Xnest server's window,
1117706f2543Smrg   keyboard and mouse events are received by the Xnest server,
1118706f2543Smrg   repackaged and sent back to any client that requests those
1119706f2543Smrg   events.
1120706f2543Smrg
1121706f2543SmrgShadow framebuffer
1122706f2543Smrg
1123706f2543Smrg   The most common type of framebuffer is a linear array memory
1124706f2543Smrg   that maps to the video memory on the graphics device. However,
1125706f2543Smrg   accessing that video memory over an I/O bus (e.g., ISA or PCI)
1126706f2543Smrg   can be slow. The shadow framebuffer layer allows the developer
1127706f2543Smrg   to keep the entire framebuffer in main memory and copy it back
1128706f2543Smrg   to video memory at regular intervals. It also has been extended
1129706f2543Smrg   to handle planar video memory and rotated framebuffers.
1130706f2543Smrg
1131706f2543Smrg   There are two main entry points to the shadow framebuffer code:
1132706f2543Smrg
1133706f2543Smrg   shadowAlloc(width, height, bpp)
1134706f2543Smrg
1135706f2543Smrg   This function allocates the in memory copy of the framebuffer
1136706f2543Smrg   of size width*height*bpp. It returns a pointer to that memory,
1137706f2543Smrg   which will be used by the framebuffer ScreenInit() code during
1138706f2543Smrg   the screen's initialization.
1139706f2543Smrg
1140706f2543Smrg   shadowInit(pScreen, updateProc, windowProc)
1141706f2543Smrg
1142706f2543Smrg   This function initializes the shadow framebuffer layer. It
1143706f2543Smrg   wraps several screen drawing functions, and registers a block
1144706f2543Smrg   handler that will update the screen. The updateProc is a
1145706f2543Smrg   function that will copy the damaged regions to the screen, and
1146706f2543Smrg   the windowProc is a function that is used when the entire
1147706f2543Smrg   linear video memory range cannot be accessed simultaneously so
1148706f2543Smrg   that only a window into that memory is available (e.g., when
1149706f2543Smrg   using the VGA aperture).
1150706f2543Smrg
1151706f2543Smrg   The shadow framebuffer code keeps track of the damaged area of
1152706f2543Smrg   each screen by calculating the bounding box of all drawing
1153706f2543Smrg   operations that have occurred since the last screen update.
1154706f2543Smrg   Then, when the block handler is next called, only the damaged
1155706f2543Smrg   portion of the screen is updated.
1156706f2543Smrg
1157706f2543Smrg   Note that since the shadow framebuffer is kept in main memory,
1158706f2543Smrg   all drawing operations are performed by the CPU and, thus, no
1159706f2543Smrg   accelerated hardware drawing operations are possible.
1160706f2543Smrg
1161706f2543SmrgXinerama
1162706f2543Smrg
1163706f2543Smrg   Xinerama is an X extension that allows multiple physical
1164706f2543Smrg   screens controlled by a single X server to appear as a single
1165706f2543Smrg   screen. Although the extension allows clients to find the
1166706f2543Smrg   physical screen layout via extension requests, it is completely
1167706f2543Smrg   transparent to clients at the core X11 protocol level. The
1168706f2543Smrg   original public implementation of Xinerama came from
1169706f2543Smrg   Digital/Compaq. XFree86 rewrote it, filling in some missing
1170706f2543Smrg   pieces and improving both X11 core protocol compliance and
1171706f2543Smrg   performance. The Xinerama extension will be passing through
1172706f2543Smrg   X.Org's standardization process in the near future, and the
1173706f2543Smrg   sample implementation will be based on this rewritten version.
1174706f2543Smrg
1175706f2543Smrg   The current implementation of Xinerama is based primarily in
1176706f2543Smrg   the DIX (device independent) and MI (machine independent)
1177706f2543Smrg   layers of the X server. With few exceptions the DDX layers do
1178706f2543Smrg   not need any changes to support Xinerama. X server extensions
1179706f2543Smrg   often do need modifications to provide full Xinerama
1180706f2543Smrg   functionality.
1181706f2543Smrg
1182706f2543Smrg   The following is a code-level description of how Xinerama
1183706f2543Smrg   functions.
1184706f2543Smrg
1185706f2543Smrg   Note: Because the Xinerama extension was originally called the
1186706f2543Smrg   PanoramiX extension, many of the Xinerama functions still have
1187706f2543Smrg   the PanoramiX prefix.
1188706f2543Smrg
1189706f2543Smrg   PanoramiXExtensionInit()
1190706f2543Smrg
1191706f2543Smrg   PanoramiXExtensionInit() is a device-independent extension
1192706f2543Smrg   function that is called at the start of each server generation
1193706f2543Smrg   from InitExtensions(), which is called from the X server's
1194706f2543Smrg   main() function after all output devices have been initialized,
1195706f2543Smrg   but before any input devices have been initialized.
1196706f2543Smrg
1197706f2543Smrg   PanoramiXNumScreens is set to the number of physical screens.
1198706f2543Smrg   If only one physical screen is present, the extension is
1199706f2543Smrg   disabled, and PanoramiXExtensionInit() returns without doing
1200706f2543Smrg   anything else.
1201706f2543Smrg
1202706f2543Smrg   The Xinerama extension is registered by calling AddExtension().
1203706f2543Smrg
1204706f2543Smrg   GC and Screen private indexes are allocated, and both GC and
1205706f2543Smrg   Screen private areas are allocated for each physical screen.
1206706f2543Smrg   These hold Xinerama-specific per-GC and per-Screen data. Each
1207706f2543Smrg   screen's CreateGC and CloseScreen functions are wrapped by
1208706f2543Smrg   XineramaCreateGC() and XineramaCloseScreen() respectively. Some
1209706f2543Smrg   new resource classes are created for Xinerama drawables and
1210706f2543Smrg   GCs, and resource types for Xinerama windows, pixmaps and
1211706f2543Smrg   colormaps.
1212706f2543Smrg
1213706f2543Smrg   A region (PanoramiXScreenRegion) is initialized to be the union
1214706f2543Smrg   of the screen regions. The relative positioning information for
1215706f2543Smrg   the physical screens is taken from the ScreenRec x and y
1216706f2543Smrg   members, which the DDX layer must initialize in InitOutput().
1217706f2543Smrg   The bounds of the combined screen is also calculated
1218706f2543Smrg   (PanoramiXPixWidth and PanoramiXPixHeight).
1219706f2543Smrg
1220706f2543Smrg   The DIX layer has a list of function pointers (ProcVector[])
1221706f2543Smrg   that holds the entry points for the functions that process core
1222706f2543Smrg   protocol requests. The requests that Xinerama must intercept
1223706f2543Smrg   and break up into physical screen-specific requests are
1224706f2543Smrg   wrapped. The original set is copied to SavedProcVector[]. The
1225706f2543Smrg   types of requests intercepted are Window requests, GC requests,
1226706f2543Smrg   colormap requests, drawing requests, and some geometry-related
1227706f2543Smrg   requests. This wrapping allows the bulk of the protocol request
1228706f2543Smrg   processing to be handled transparently to the DIX layer. Some
1229706f2543Smrg   operations cannot be dealt with in this way and are handled
1230706f2543Smrg   with Xinerama-specific code within the DIX layer.
1231706f2543Smrg
1232706f2543Smrg   PanoramiXConsolidate()
1233706f2543Smrg
1234706f2543Smrg   PanoramiXConsolidate() is a device-independent extension
1235706f2543Smrg   function that is called directly from the X server's main()
1236706f2543Smrg   function after extensions and input/output devices have been
1237706f2543Smrg   initialized, and before the root windows are defined and
1238706f2543Smrg   initialized.
1239706f2543Smrg
1240706f2543Smrg   This function finds the set of depths (PanoramiXDepths[]) and
1241706f2543Smrg   visuals (PanoramiXVisuals[]) common to all of the physical
1242706f2543Smrg   screens. PanoramiXNumDepths is set to the number of common
1243706f2543Smrg   depths, and PanoramiXNumVisuals is set to the number of common
1244706f2543Smrg   visuals. Resources are created for the single root window and
1245706f2543Smrg   the default colormap. Each of these resources has per-physical
1246706f2543Smrg   screen entries.
1247706f2543Smrg
1248706f2543Smrg   PanoramiXCreateConnectionBlock()
1249706f2543Smrg
1250706f2543Smrg   PanoramiXConsolidate() is a device-independent extension
1251706f2543Smrg   function that is called directly from the X server's main()
1252706f2543Smrg   function after the per-physical screen root windows are
1253706f2543Smrg   created. It is called instead of the standard DIX
1254706f2543Smrg   CreateConnectionBlock() function. If this function returns
1255706f2543Smrg   FALSE, the X server exits with a fatal error. This function
1256706f2543Smrg   will return FALSE if no common depths were found in
1257706f2543Smrg   PanoramiXConsolidate(). With no common depths, Xinerama mode is
1258706f2543Smrg   not possible.
1259706f2543Smrg
1260706f2543Smrg   The connection block holds the information that clients get
1261706f2543Smrg   when they open a connection to the X server. It includes
1262706f2543Smrg   information such as the supported pixmap formats, number of
1263706f2543Smrg   screens and the sizes, depths, visuals, default colormap
1264706f2543Smrg   information, etc, for each of the screens (much of information
1265706f2543Smrg   that xdpyinfo shows). The connection block is initialized with
1266706f2543Smrg   the combined single screen values that were calculated in the
1267706f2543Smrg   above two functions.
1268706f2543Smrg
1269706f2543Smrg   The Xinerama extension allows the registration of connection
1270706f2543Smrg   block callback functions. The purpose of these is to allow
1271706f2543Smrg   other extensions to do processing at this point. These
1272706f2543Smrg   callbacks can be registered by calling
1273706f2543Smrg   XineramaRegisterConnectionBlockCallback() from the other
1274706f2543Smrg   extension's ExtensionInit() function. Each registered
1275706f2543Smrg   connection block callback is called at the end of
1276706f2543Smrg   PanoramiXCreateConnectionBlock().
1277706f2543Smrg
1278706f2543SmrgXinerama-specific changes to the DIX code
1279706f2543Smrg
1280706f2543Smrg   There are a few types of Xinerama-specific changes within the
1281706f2543Smrg   DIX code. The main ones are described here.
1282706f2543Smrg
1283706f2543Smrg   Functions that deal with colormap or GC -related operations
1284706f2543Smrg   outside of the intercepted protocol requests have a test added
1285706f2543Smrg   to only do the processing for screen numbers > 0. This is
1286706f2543Smrg   because they are handled for the single Xinerama screen and the
1287706f2543Smrg   processing is done once for screen 0.
1288706f2543Smrg
1289706f2543Smrg   The handling of motion events does some coordinate translation
1290706f2543Smrg   between the physical screen's origin and screen zero's origin.
1291706f2543Smrg   Also, motion events must be reported relative to the composite
1292706f2543Smrg   screen origin rather than the physical screen origins.
1293706f2543Smrg
1294706f2543Smrg   There is some special handling for cursor, window and event
1295706f2543Smrg   processing that cannot (either not at all or not conveniently)
1296706f2543Smrg   be done via the intercepted protocol requests. A particular
1297706f2543Smrg   case is the handling of pointers moving between physical
1298706f2543Smrg   screens.
1299706f2543Smrg
1300706f2543SmrgXinerama-specific changes to the MI code
1301706f2543Smrg
1302706f2543Smrg   The only Xinerama-specific change to the MI code is in
1303706f2543Smrg   miSendExposures() to handle the coordinate (and window ID)
1304706f2543Smrg   translation for expose events.
1305706f2543Smrg
1306706f2543SmrgIntercepted DIX core requests
1307706f2543Smrg
1308706f2543Smrg   Xinerama breaks up drawing requests for dispatch to each
1309706f2543Smrg   physical screen. It also breaks up windows into pieces for each
1310706f2543Smrg   physical screen. GCs are translated into per-screen GCs.
1311706f2543Smrg   Colormaps are replicated on each physical screen. The functions
1312706f2543Smrg   handling the intercepted requests take care of breaking the
1313706f2543Smrg   requests and repackaging them so that they can be passed to the
1314706f2543Smrg   standard request handling functions for each screen in turn. In
1315706f2543Smrg   addition, and to aid the repackaging, the information from many
1316706f2543Smrg   of the intercepted requests is used to keep up to date the
1317706f2543Smrg   necessary state information for the single composite screen.
1318706f2543Smrg   Requests (usually those with replies) that can be satisfied
1319706f2543Smrg   completely from this stored state information do not call the
1320706f2543Smrg   standard request handling functions.
1321706f2543Smrg
1322706f2543SmrgDevelopment Results
1323706f2543Smrg
1324706f2543Smrg   In this section the results of each phase of development are
1325706f2543Smrg   discussed. This development took place between approximately
1326706f2543Smrg   June 2001 and July 2003.
1327706f2543Smrg
1328706f2543SmrgPhase I
1329706f2543Smrg
1330706f2543Smrg   The initial development phase dealt with the basic
1331706f2543Smrg   implementation including the bootstrap code, which used the
1332706f2543Smrg   shadow framebuffer, and the unoptimized implementation, based
1333706f2543Smrg   on an Xnest-style implementation.
1334706f2543Smrg
1335706f2543SmrgScope
1336706f2543Smrg
1337706f2543Smrg   The goal of Phase I is to provide fundamental functionality
1338706f2543Smrg   that can act as a foundation for ongoing work:
1339706f2543Smrg    1. Develop the proxy X server
1340706f2543Smrg          + The proxy X server will operate on the X11 protocol
1341706f2543Smrg            and relay requests as necessary to correctly perform
1342706f2543Smrg            the request.
1343706f2543Smrg          + Work will be based on the existing work for Xinerama
1344706f2543Smrg            and Xnest.
1345706f2543Smrg          + Input events and windowing operations are handled in
1346706f2543Smrg            the proxy server and rendering requests are repackaged
1347706f2543Smrg            and sent to each of the back-end servers for display.
1348706f2543Smrg          + The multiple screen layout (including support for
1349706f2543Smrg            overlapping screens) will be user configurable via a
1350706f2543Smrg            configuration file or through the configuration tool.
1351706f2543Smrg    2. Develop graphical configuration tool
1352706f2543Smrg          + There will be potentially a large number of X servers
1353706f2543Smrg            to configure into a single display. The tool will
1354706f2543Smrg            allow the user to specify which servers are involved
1355706f2543Smrg            in the configuration and how they should be laid out.
1356706f2543Smrg    3. Pass the X Test Suite
1357706f2543Smrg          + The X Test Suite covers the basic X11 operations. All
1358706f2543Smrg            tests known to succeed must correctly operate in the
1359706f2543Smrg            distributed X environment.
1360706f2543Smrg
1361706f2543Smrg   For this phase, the back-end X servers are assumed to be
1362706f2543Smrg   unmodified X servers that do not support any DMX-related
1363706f2543Smrg   protocol extensions; future optimization pathways are
1364706f2543Smrg   considered, but are not implemented; and the configuration tool
1365706f2543Smrg   is assumed to rely only on libraries in the X source tree
1366706f2543Smrg   (e.g., Xt).
1367706f2543Smrg
1368706f2543SmrgResults
1369706f2543Smrg
1370706f2543Smrg   The proxy X server, Xdmx, was developed to distribute X11
1371706f2543Smrg   protocol requests to the set of back-end X servers. It opens a
1372706f2543Smrg   window on each back-end server, which represents the part of
1373706f2543Smrg   the front-end's root window that is visible on that screen. It
1374706f2543Smrg   mirrors window, pixmap and other state in each back-end server.
1375706f2543Smrg   Drawing requests are sent to either windows or pixmaps on each
1376706f2543Smrg   back-end server. This code is based on Xnest and uses the
1377706f2543Smrg   existing Xinerama extension.
1378706f2543Smrg
1379706f2543Smrg   Input events can be taken from (1) devices attached to the
1380706f2543Smrg   back-end server, (2) core devices attached directly to the Xdmx
1381706f2543Smrg   server, or (3) from a ``console'' window on another X server.
1382706f2543Smrg   Events for these devices are gathered, processed and delivered
1383706f2543Smrg   to clients attached to the Xdmx server.
1384706f2543Smrg
1385706f2543Smrg   An intuitive configuration format was developed to help the
1386706f2543Smrg   user easily configure the multiple back-end X servers. It was
1387706f2543Smrg   defined (see grammar in Xdmx man page) and a parser was
1388706f2543Smrg   implemented that is used by the Xdmx server and by a standalone
1389706f2543Smrg   xdmxconfig utility. The parsing support was implemented such
1390706f2543Smrg   that it can be easily factored out of the X source tree for use
1391706f2543Smrg   with other tools (e.g., vdl). Support for converting legacy
1392706f2543Smrg   vdl-format configuration files to the DMX format is provided by
1393706f2543Smrg   the vdltodmx utility.
1394706f2543Smrg
1395706f2543Smrg   Originally, the configuration file was going to be a subsection
1396706f2543Smrg   of XFree86's XF86Config file, but that was not possible since
1397706f2543Smrg   Xdmx is a completely separate X server. Thus, a separate config
1398706f2543Smrg   file format was developed. In addition, a graphical
1399706f2543Smrg   configuration tool, xdmxconfig, was developed to allow the user
1400706f2543Smrg   to create and arrange the screens in the configuration file.
1401706f2543Smrg   The -configfile and -config command-line options can be used to
1402706f2543Smrg   start Xdmx using a configuration file.
1403706f2543Smrg
1404706f2543Smrg   An extension that enables remote input testing is required for
1405706f2543Smrg   the X Test Suite to function. During this phase, this extension
1406706f2543Smrg   (XTEST) was implemented in the Xdmx server. The results from
1407706f2543Smrg   running the X Test Suite are described in detail below.
1408706f2543Smrg
1409706f2543SmrgX Test Suite
1410706f2543Smrg
1411706f2543SmrgIntroduction
1412706f2543Smrg
1413706f2543Smrg   The X Test Suite contains tests that verify Xlib functions
1414706f2543Smrg   operate correctly. The test suite is designed to run on a
1415706f2543Smrg   single X server; however, since X applications will not be able
1416706f2543Smrg   to tell the difference between the DMX server and a standard X
1417706f2543Smrg   server, the X Test Suite should also run on the DMX server.
1418706f2543Smrg
1419706f2543Smrg   The Xdmx server was tested with the X Test Suite, and the
1420706f2543Smrg   existing failures are noted in this section. To put these
1421706f2543Smrg   results in perspective, we first discuss expected X Test
1422706f2543Smrg   failures and how errors in underlying systems can impact Xdmx
1423706f2543Smrg   test results.
1424706f2543Smrg
1425706f2543SmrgExpected Failures for a Single Head
1426706f2543Smrg
1427706f2543Smrg   A correctly implemented X server with a single screen is
1428706f2543Smrg   expected to fail certain X Test tests. The following well-known
1429706f2543Smrg   errors occur because of rounding error in the X server code:
1430706f2543Smrg
1431706f2543Smrg   XDrawArc: Tests 42, 63, 66, 73
1432706f2543Smrg   XDrawArcs: Tests 45, 66, 69, 76
1433706f2543Smrg
1434706f2543Smrg   The following failures occur because of the high-level X server
1435706f2543Smrg   implementation:
1436706f2543Smrg
1437706f2543Smrg   XLoadQueryFont: Test 1
1438706f2543Smrg   XListFontsWithInfo: Tests 3, 4
1439706f2543Smrg   XQueryFont: Tests 1, 2
1440706f2543Smrg
1441706f2543Smrg   The following test fails when running the X server as root
1442706f2543Smrg   under Linux because of the way directory modes are interpreted:
1443706f2543Smrg
1444706f2543Smrg   XWriteBitmapFile: Test 3
1445706f2543Smrg
1446706f2543Smrg   Depending on the video card used for the back-end, other
1447706f2543Smrg   failures may also occur because of bugs in the low-level driver
1448706f2543Smrg   implementation. Over time, failures of this kind are usually
1449706f2543Smrg   fixed by XFree86, but will show up in Xdmx testing until then.
1450706f2543Smrg
1451706f2543SmrgExpected Failures for Xinerama
1452706f2543Smrg
1453706f2543Smrg   Xinerama fails several X Test Suite tests because of design
1454706f2543Smrg   decisions made for the current implementation of Xinerama. Over
1455706f2543Smrg   time, many of these errors will be corrected by XFree86 and the
1456706f2543Smrg   group working on a new Xinerama implementation. Therefore, Xdmx
1457706f2543Smrg   will also share X Suite Test failures with Xinerama.
1458706f2543Smrg
1459706f2543Smrg   We may be able to fix or work-around some of these failures at
1460706f2543Smrg   the Xdmx level, but this will require additional exploration
1461706f2543Smrg   that was not part of Phase I.
1462706f2543Smrg
1463706f2543Smrg   Xinerama is constantly improving, and the list of
1464706f2543Smrg   Xinerama-related failures depends on XFree86 version and the
1465706f2543Smrg   underlying graphics hardware. We tested with a variety of
1466706f2543Smrg   hardware, including nVidia, S3, ATI Radeon, and Matrox G400 (in
1467706f2543Smrg   dual-head mode). The list below includes only those failures
1468706f2543Smrg   that appear to be from the Xinerama layer, and does not include
1469706f2543Smrg   failures listed in the previous section, or failures that
1470706f2543Smrg   appear to be from the low-level graphics driver itself:
1471706f2543Smrg
1472706f2543Smrg   These failures were noted with multiple Xinerama
1473706f2543Smrg   configurations:
1474706f2543Smrg
1475706f2543Smrg   XCopyPlane: Tests 13, 22, 31 (well-known Xinerama implementatio
1476706f2543Smrg   n issue)
1477706f2543Smrg   XSetFontPath: Test 4
1478706f2543Smrg   XGetDefault: Test 5
1479706f2543Smrg   XMatchVisualInfo: Test 1
1480706f2543Smrg
1481706f2543Smrg   These failures were noted only when using one dual-head video
1482706f2543Smrg   card with a 4.2.99.x XFree86 server:
1483706f2543Smrg
1484706f2543Smrg   XListPixmapFormats: Test 1
1485706f2543Smrg   XDrawRectangles: Test 45
1486706f2543Smrg
1487706f2543Smrg   These failures were noted only when using two video cards from
1488706f2543Smrg   different vendors with a 4.1.99.x XFree86 server:
1489706f2543Smrg
1490706f2543Smrg   XChangeWindowAttributes: Test 32
1491706f2543Smrg   XCreateWindow: Test 30
1492706f2543Smrg   XDrawLine: Test 22
1493706f2543Smrg   XFillArc: Test 22
1494706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
1495706f2543Smrg   XRebindKeysym: Test 1
1496706f2543Smrg
1497706f2543SmrgAdditional Failures from Xdmx
1498706f2543Smrg
1499706f2543Smrg   When running Xdmx, no unexpected failures were noted. Since the
1500706f2543Smrg   Xdmx server is based on Xinerama, we expect to have most of the
1501706f2543Smrg   Xinerama failures present in the Xdmx server. Similarly, since
1502706f2543Smrg   the Xdmx server must rely on the low-level device drivers on
1503706f2543Smrg   each back-end server, we also expect that Xdmx will exhibit
1504706f2543Smrg   most of the back-end failures. Here is a summary:
1505706f2543Smrg
1506706f2543Smrg   XListPixmapFormats: Test 1 (configuration dependent)
1507706f2543Smrg   XChangeWindowAttributes: Test 32
1508706f2543Smrg   XCreateWindow: Test 30
1509706f2543Smrg   XCopyPlane: Test 13, 22, 31
1510706f2543Smrg   XSetFontPath: Test 4
1511706f2543Smrg   XGetDefault: Test 5 (configuration dependent)
1512706f2543Smrg   XMatchVisualInfo: Test 1
1513706f2543Smrg   XRebindKeysym: Test 1 (configuration dependent)
1514706f2543Smrg
1515706f2543Smrg   Note that this list is shorter than the combined list for
1516706f2543Smrg   Xinerama because Xdmx uses different code paths to perform some
1517706f2543Smrg   Xinerama operations. Further, some Xinerama failures have been
1518706f2543Smrg   fixed in the XFree86 4.2.99.x CVS repository.
1519706f2543Smrg
1520706f2543SmrgSummary and Future Work
1521706f2543Smrg
1522706f2543Smrg   Running the X Test Suite on Xdmx does not produce any failures
1523706f2543Smrg   that cannot be accounted for by the underlying Xinerama
1524706f2543Smrg   subsystem used by the front-end or by the low-level
1525706f2543Smrg   device-driver code running on the back-end X servers. The Xdmx
1526706f2543Smrg   server therefore is as ``correct'' as possible with respect to
1527706f2543Smrg   the standard set of X Test Suite tests.
1528706f2543Smrg
1529706f2543Smrg   During the following phases, we will continue to verify Xdmx
1530706f2543Smrg   correctness using the X Test Suite. We may also use other tests
1531706f2543Smrg   suites or write additional tests that run under the X Test
1532706f2543Smrg   Suite that specifically verify the expected behavior of DMX.
1533706f2543Smrg
1534706f2543SmrgFonts
1535706f2543Smrg
1536706f2543Smrg   In Phase I, fonts are handled directly by both the front-end
1537706f2543Smrg   and the back-end servers, which is required since we must treat
1538706f2543Smrg   each back-end server during this phase as a ``black box''. What
1539706f2543Smrg   this requires is that the front- and back-end servers must
1540706f2543Smrg   share the exact same font path. There are two ways to help make
1541706f2543Smrg   sure that all servers share the same font path:
1542706f2543Smrg    1. First, each server can be configured to use the same font
1543706f2543Smrg       server. The font server, xfs, can be configured to serve
1544706f2543Smrg       fonts to multiple X servers via TCP.
1545706f2543Smrg    2. Second, each server can be configured to use the same font
1546706f2543Smrg       path and either those font paths can be copied to each
1547706f2543Smrg       back-end machine or they can be mounted (e.g., via NFS) on
1548706f2543Smrg       each back-end machine.
1549706f2543Smrg
1550706f2543Smrg   One additional concern is that a client program can set its own
1551706f2543Smrg   font path, and if it does so, then that font path must be
1552706f2543Smrg   available on each back-end machine.
1553706f2543Smrg
1554706f2543Smrg   The -fontpath command line option was added to allow users to
1555706f2543Smrg   initialize the font path of the front end server. This font
1556706f2543Smrg   path is propagated to each back-end server when the default
1557706f2543Smrg   font is loaded. If there are any problems, an error message is
1558706f2543Smrg   printed, which will describe the problem and list the current
1559706f2543Smrg   font path. For more information about setting the font path,
1560706f2543Smrg   see the -fontpath option description in the man page.
1561706f2543Smrg
1562706f2543SmrgPerformance
1563706f2543Smrg
1564706f2543Smrg   Phase I of development was not intended to optimize
1565706f2543Smrg   performance. Its focus was on completely and correctly handling
1566706f2543Smrg   the base X11 protocol in the Xdmx server. However, several
1567706f2543Smrg   insights were gained during Phase I, which are listed here for
1568706f2543Smrg   reference during the next phase of development.
1569706f2543Smrg    1. Calls to XSync() can slow down rendering since it requires
1570706f2543Smrg       a complete round trip to and from a back-end server. This
1571706f2543Smrg       is especially problematic when communicating over long haul
1572706f2543Smrg       networks.
1573706f2543Smrg    2. Sending drawing requests to only the screens that they
1574706f2543Smrg       overlap should improve performance.
1575706f2543Smrg
1576706f2543SmrgPixmaps
1577706f2543Smrg
1578706f2543Smrg   Pixmaps were originally expected to be handled entirely in the
1579706f2543Smrg   front-end X server; however, it was found that this overly
1580706f2543Smrg   complicated the rendering code and would have required sending
1581706f2543Smrg   potentially large images to each back server that required them
1582706f2543Smrg   when copying from pixmap to screen. Thus, pixmap state is
1583706f2543Smrg   mirrored in the back-end server just as it is with regular
1584706f2543Smrg   window state. With this implementation, the same rendering code
1585706f2543Smrg   that draws to windows can be used to draw to pixmaps on the
1586706f2543Smrg   back-end server, and no large image transfers are required to
1587706f2543Smrg   copy from pixmap to window.
1588706f2543Smrg
1589706f2543SmrgPhase II
1590706f2543Smrg
1591706f2543Smrg   The second phase of development concentrates on performance
1592706f2543Smrg   optimizations. These optimizations are documented here, with
1593706f2543Smrg   x11perf data to show how the optimizations improve performance.
1594706f2543Smrg
1595706f2543Smrg   All benchmarks were performed by running Xdmx on a dual
1596706f2543Smrg   processor 1.4GHz AMD Athlon machine with 1GB of RAM connecting
1597706f2543Smrg   over 100baseT to two single-processor 1GHz Pentium III machines
1598706f2543Smrg   with 256MB of RAM and ATI Rage 128 (RF) video cards. The front
1599706f2543Smrg   end was running Linux 2.4.20-pre1-ac1 and the back ends were
1600706f2543Smrg   running Linux 2.4.7-10 and version 4.2.99.1 of XFree86 pulled
1601706f2543Smrg   from the XFree86 CVS repository on August 7, 2002. All systems
1602706f2543Smrg   were running Red Hat Linux 7.2.
1603706f2543Smrg
1604706f2543SmrgMoving from XFree86 4.1.99.1 to 4.2.0.0
1605706f2543Smrg
1606706f2543Smrg   For phase II, the working source tree was moved to the branch
1607706f2543Smrg   tagged with dmx-1-0-branch and was updated from version
1608706f2543Smrg   4.1.99.1 (20 August 2001) of the XFree86 sources to version
1609706f2543Smrg   4.2.0.0 (18 January 2002). After this update, the following
1610706f2543Smrg   tests were noted to be more than 10% faster:
1611706f2543Smrg1.13   Fill 300x300 opaque stippled trapezoid (161x145 stipple)
1612706f2543Smrg1.16   Fill 1x1 tiled trapezoid (161x145 tile)
1613706f2543Smrg1.13   Fill 10x10 tiled trapezoid (161x145 tile)
1614706f2543Smrg1.17   Fill 100x100 tiled trapezoid (161x145 tile)
1615706f2543Smrg1.16   Fill 1x1 tiled trapezoid (216x208 tile)
1616706f2543Smrg1.20   Fill 10x10 tiled trapezoid (216x208 tile)
1617706f2543Smrg1.15   Fill 100x100 tiled trapezoid (216x208 tile)
1618706f2543Smrg1.37   Circulate Unmapped window (200 kids)
1619706f2543Smrg
1620706f2543Smrg   And the following tests were noted to be more than 10% slower:
1621706f2543Smrg0.88   Unmap window via parent (25 kids)
1622706f2543Smrg0.75   Circulate Unmapped window (4 kids)
1623706f2543Smrg0.79   Circulate Unmapped window (16 kids)
1624706f2543Smrg0.80   Circulate Unmapped window (25 kids)
1625706f2543Smrg0.82   Circulate Unmapped window (50 kids)
1626706f2543Smrg0.85   Circulate Unmapped window (75 kids)
1627706f2543Smrg
1628706f2543Smrg   These changes were not caused by any changes in the DMX system,
1629706f2543Smrg   and may point to changes in the XFree86 tree or to tests that
1630706f2543Smrg   have more "jitter" than most other x11perf tests.
1631706f2543Smrg
1632706f2543SmrgGlobal changes
1633706f2543Smrg
1634706f2543Smrg   During the development of the Phase II DMX server, several
1635706f2543Smrg   global changes were made. These changes were also compared with
1636706f2543Smrg   the Phase I server. The following tests were noted to be more
1637706f2543Smrg   than 10% faster:
1638706f2543Smrg1.13   Fill 300x300 opaque stippled trapezoid (161x145 stipple)
1639706f2543Smrg1.15   Fill 1x1 tiled trapezoid (161x145 tile)
1640706f2543Smrg1.13   Fill 10x10 tiled trapezoid (161x145 tile)
1641706f2543Smrg1.17   Fill 100x100 tiled trapezoid (161x145 tile)
1642706f2543Smrg1.16   Fill 1x1 tiled trapezoid (216x208 tile)
1643706f2543Smrg1.19   Fill 10x10 tiled trapezoid (216x208 tile)
1644706f2543Smrg1.15   Fill 100x100 tiled trapezoid (216x208 tile)
1645706f2543Smrg1.15   Circulate Unmapped window (4 kids)
1646706f2543Smrg
1647706f2543Smrg   The following tests were noted to be more than 10% slower:
1648706f2543Smrg0.69   Scroll 10x10 pixels
1649706f2543Smrg0.68   Scroll 100x100 pixels
1650706f2543Smrg0.68   Copy 10x10 from window to window
1651706f2543Smrg0.68   Copy 100x100 from window to window
1652706f2543Smrg0.76   Circulate Unmapped window (75 kids)
1653706f2543Smrg0.83   Circulate Unmapped window (100 kids)
1654706f2543Smrg
1655706f2543Smrg   For the remainder of this analysis, the baseline of comparison
1656706f2543Smrg   will be the Phase II deliverable with all optimizations
1657706f2543Smrg   disabled (unless otherwise noted). This will highlight how the
1658706f2543Smrg   optimizations in isolation impact performance.
1659706f2543Smrg
1660706f2543SmrgXSync() Batching
1661706f2543Smrg
1662706f2543Smrg   During the Phase I implementation, XSync() was called after
1663706f2543Smrg   every protocol request made by the DMX server. This provided
1664706f2543Smrg   the DMX server with an interactive feel, but defeated X11's
1665706f2543Smrg   protocol buffering system and introduced round-trip wire
1666706f2543Smrg   latency into every operation. During Phase II, DMX was changed
1667706f2543Smrg   so that protocol requests are no longer followed by calls to
1668706f2543Smrg   XSync(). Instead, the need for an XSync() is noted, and XSync()
1669706f2543Smrg   calls are only made every 100mS or when the DMX server
1670706f2543Smrg   specifically needs to make a call to guarantee interactivity.
1671706f2543Smrg   With this new system, X11 buffers protocol as much as possible
1672706f2543Smrg   during a 100mS interval, and many unnecessary XSync() calls are
1673706f2543Smrg   avoided.
1674706f2543Smrg
1675706f2543Smrg   Out of more than 300 x11perf tests, 8 tests became more than
1676706f2543Smrg   100 times faster, with 68 more than 50X faster, 114 more than
1677706f2543Smrg   10X faster, and 181 more than 2X faster. See table below for
1678706f2543Smrg   summary.
1679706f2543Smrg
1680706f2543Smrg   The following tests were noted to be more than 10% slower with
1681706f2543Smrg   XSync() batching on:
1682706f2543Smrg0.88   500x500 tiled rectangle (161x145 tile)
1683706f2543Smrg0.89   Copy 500x500 from window to window
1684706f2543Smrg
1685706f2543SmrgOffscreen Optimization
1686706f2543Smrg
1687706f2543Smrg   Windows span one or more of the back-end servers' screens;
1688706f2543Smrg   however, during Phase I development, windows were created on
1689706f2543Smrg   every back-end server and every rendering request was sent to
1690706f2543Smrg   every window regardless of whether or not that window was
1691706f2543Smrg   visible. With the offscreen optimization, the DMX server tracks
1692706f2543Smrg   when a window is completely off of a back-end server's screen
1693706f2543Smrg   and, in that case, it does not send rendering requests to those
1694706f2543Smrg   back-end windows. This optimization saves bandwidth between the
1695706f2543Smrg   front and back-end servers, and it reduces the number of
1696706f2543Smrg   XSync() calls. The performance tests were run on a DMX system
1697706f2543Smrg   with only two back-end servers. Greater performance gains will
1698706f2543Smrg   be had as the number of back-end servers increases.
1699706f2543Smrg
1700706f2543Smrg   Out of more than 300 x11perf tests, 3 tests were at least twice
1701706f2543Smrg   as fast, and 146 tests were at least 10% faster. Two tests were
1702706f2543Smrg   more than 10% slower with the offscreen optimization:
1703706f2543Smrg0.88   Hide/expose window via popup (4 kids)
1704706f2543Smrg0.89   Resize unmapped window (75 kids)
1705706f2543Smrg
1706706f2543SmrgLazy Window Creation Optimization
1707706f2543Smrg
1708706f2543Smrg   As mentioned above, during Phase I, windows were created on
1709706f2543Smrg   every back-end server even if they were not visible on that
1710706f2543Smrg   back-end. With the lazy window creation optimization, the DMX
1711706f2543Smrg   server does not create windows on a back-end server until they
1712706f2543Smrg   are either visible or they become the parents of a visible
1713706f2543Smrg   window. This optimization builds on the offscreen optimization
1714706f2543Smrg   (described above) and requires it to be enabled.
1715706f2543Smrg
1716706f2543Smrg   The lazy window creation optimization works by creating the
1717706f2543Smrg   window data structures in the front-end server when a client
1718706f2543Smrg   creates a window, but delays creation of the window on the
1719706f2543Smrg   back-end server(s). A private window structure in the DMX
1720706f2543Smrg   server saves the relevant window data and tracks changes to the
1721706f2543Smrg   window's attributes and stacking order for later use. The only
1722706f2543Smrg   times a window is created on a back-end server are (1) when it
1723706f2543Smrg   is mapped and is at least partially overlapping the back-end
1724706f2543Smrg   server's screen (tracked by the offscreen optimization), or (2)
1725706f2543Smrg   when the window becomes the parent of a previously visible
1726706f2543Smrg   window. The first case occurs when a window is mapped or when a
1727706f2543Smrg   visible window is copied, moved or resized and now overlaps the
1728706f2543Smrg   back-end server's screen. The second case occurs when starting
1729706f2543Smrg   a window manager after having created windows to which the
1730706f2543Smrg   window manager needs to add decorations.
1731706f2543Smrg
1732706f2543Smrg   When either case occurs, a window on the back-end server is
1733706f2543Smrg   created using the data saved in the DMX server's window private
1734706f2543Smrg   data structure. The stacking order is then adjusted to
1735706f2543Smrg   correctly place the window on the back-end and lastly the
1736706f2543Smrg   window is mapped. From this time forward, the window is handled
1737706f2543Smrg   exactly as if the window had been created at the time of the
1738706f2543Smrg   client's request.
1739706f2543Smrg
1740706f2543Smrg   Note that when a window is no longer visible on a back-end
1741706f2543Smrg   server's screen (e.g., it is moved offscreen), the window is
1742706f2543Smrg   not destroyed; rather, it is kept and reused later if the
1743706f2543Smrg   window once again becomes visible on the back-end server's
1744706f2543Smrg   screen. Originally with this optimization, destroying windows
1745706f2543Smrg   was implemented but was later rejected because it increased
1746706f2543Smrg   bandwidth when windows were opaquely moved or resized, which is
1747706f2543Smrg   common in many window managers.
1748706f2543Smrg
1749706f2543Smrg   The performance tests were run on a DMX system with only two
1750706f2543Smrg   back-end servers. Greater performance gains will be had as the
1751706f2543Smrg   number of back-end servers increases.
1752706f2543Smrg
1753706f2543Smrg   This optimization improved the following x11perf tests by more
1754706f2543Smrg   than 10%:
1755706f2543Smrg1.10   500x500 rectangle outline
1756706f2543Smrg1.12   Fill 100x100 stippled trapezoid (161x145 stipple)
1757706f2543Smrg1.20   Circulate Unmapped window (50 kids)
1758706f2543Smrg1.19   Circulate Unmapped window (75 kids)
1759706f2543Smrg
1760706f2543SmrgSubdividing Rendering Primitives
1761706f2543Smrg
1762706f2543Smrg   X11 imaging requests transfer significant data between the
1763706f2543Smrg   client and the X server. During Phase I, the DMX server would
1764706f2543Smrg   then transfer the image data to each back-end server. Even with
1765706f2543Smrg   the offscreen optimization (above), these requests still
1766706f2543Smrg   required transferring significant data to each back-end server
1767706f2543Smrg   that contained a visible portion of the window. For example, if
1768706f2543Smrg   the client uses XPutImage() to copy an image to a window that
1769706f2543Smrg   overlaps the entire DMX screen, then the entire image is copied
1770706f2543Smrg   by the DMX server to every back-end server.
1771706f2543Smrg
1772706f2543Smrg   To reduce the amount of data transferred between the DMX server
1773706f2543Smrg   and the back-end servers when XPutImage() is called, the image
1774706f2543Smrg   data is subdivided and only the data that will be visible on a
1775706f2543Smrg   back-end server's screen is sent to that back-end server.
1776706f2543Smrg   Xinerama already implements a subdivision algorithm for
1777706f2543Smrg   XGetImage() and no further optimization was needed.
1778706f2543Smrg
1779706f2543Smrg   Other rendering primitives were analyzed, but the time required
1780706f2543Smrg   to subdivide these primitives was a significant proportion of
1781706f2543Smrg   the time required to send the entire rendering request to the
1782706f2543Smrg   back-end server, so this optimization was rejected for the
1783706f2543Smrg   other rendering primitives.
1784706f2543Smrg
1785706f2543Smrg   Again, the performance tests were run on a DMX system with only
1786706f2543Smrg   two back-end servers. Greater performance gains will be had as
1787706f2543Smrg   the number of back-end servers increases.
1788706f2543Smrg
1789706f2543Smrg   This optimization improved the following x11perf tests by more
1790706f2543Smrg   than 10%:
1791706f2543Smrg1.12   Fill 100x100 stippled trapezoid (161x145 stipple)
1792706f2543Smrg1.26   PutImage 10x10 square
1793706f2543Smrg1.83   PutImage 100x100 square
1794706f2543Smrg1.91   PutImage 500x500 square
1795706f2543Smrg1.40   PutImage XY 10x10 square
1796706f2543Smrg1.48   PutImage XY 100x100 square
1797706f2543Smrg1.50   PutImage XY 500x500 square
1798706f2543Smrg1.45   Circulate Unmapped window (75 kids)
1799706f2543Smrg1.74   Circulate Unmapped window (100 kids)
1800706f2543Smrg
1801706f2543Smrg   The following test was noted to be more than 10% slower with
1802706f2543Smrg   this optimization:
1803706f2543Smrg0.88   10-pixel fill chord partial circle
1804706f2543Smrg
1805706f2543SmrgSummary of x11perf Data
1806706f2543Smrg
1807706f2543Smrg   With all of the optimizations on, 53 x11perf tests are more
1808706f2543Smrg   than 100X faster than the unoptimized Phase II deliverable,
1809706f2543Smrg   with 69 more than 50X faster, 73 more than 10X faster, and 199
1810706f2543Smrg   more than twice as fast. No tests were more than 10% slower
1811706f2543Smrg   than the unoptimized Phase II deliverable. (Compared with the
1812706f2543Smrg   Phase I deliverable, only Circulate Unmapped window (100 kids)
1813706f2543Smrg   was more than 10% slower than the Phase II deliverable. As
1814706f2543Smrg   noted above, this test seems to have wider variability than
1815706f2543Smrg   other x11perf tests.)
1816706f2543Smrg
1817706f2543Smrg   The following table summarizes relative x11perf test changes
1818706f2543Smrg   for all optimizations individually and collectively. Note that
1819706f2543Smrg   some of the optimizations have a synergistic effect when used
1820706f2543Smrg   together.
1821706f2543Smrg
1822706f2543Smrg1: XSync() batching only
1823706f2543Smrg2: Off screen optimizations only
1824706f2543Smrg3: Window optimizations only
1825706f2543Smrg4: Subdivprims only
1826706f2543Smrg5: All optimizations
1827706f2543Smrg
1828706f2543Smrg    1     2    3    4      5 Operation
1829706f2543Smrg------ ---- ---- ---- ------ ---------
1830706f2543Smrg  2.14 1.85 1.00 1.00   4.13 Dot
1831706f2543Smrg  1.67 1.80 1.00 1.00   3.31 1x1 rectangle
1832706f2543Smrg  2.38 1.43 1.00 1.00   2.44 10x10 rectangle
1833706f2543Smrg  1.00 1.00 0.92 0.98   1.00 100x100 rectangle
1834706f2543Smrg  1.00 1.00 1.00 1.00   1.00 500x500 rectangle
1835706f2543Smrg  1.83 1.85 1.05 1.06   3.54 1x1 stippled rectangle (8x8 stipple)
1836706f2543Smrg  2.43 1.43 1.00 1.00   2.41 10x10 stippled rectangle (8x8 stipple)
1837706f2543Smrg  0.98 1.00 1.00 1.00   1.00 100x100 stippled rectangle (8x8 stipple)
1838706f2543Smrg  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (8x8 stipple)
1839706f2543Smrg  1.75 1.75 1.00 1.00   3.40 1x1 opaque stippled rectangle (8x8 stipple)
1840706f2543Smrg  2.38 1.42 1.00 1.00   2.34 10x10 opaque stippled rectangle (8x8 stippl
1841706f2543Smrge)
1842706f2543Smrg  1.00 1.00 0.97 0.97   1.00 100x100 opaque stippled rectangle (8x8 stip
1843706f2543Smrgple)
1844706f2543Smrg  1.00 1.00 1.00 1.00   0.99 500x500 opaque stippled rectangle (8x8 stip
1845706f2543Smrgple)
1846706f2543Smrg  1.82 1.82 1.04 1.04   3.56 1x1 tiled rectangle (4x4 tile)
1847706f2543Smrg  2.33 1.42 1.00 1.00   2.37 10x10 tiled rectangle (4x4 tile)
1848706f2543Smrg  1.00 0.92 1.00 1.00   1.00 100x100 tiled rectangle (4x4 tile)
1849706f2543Smrg  1.00 1.00 1.00 1.00   1.00 500x500 tiled rectangle (4x4 tile)
1850706f2543Smrg  1.94 1.62 1.00 1.00   3.66 1x1 stippled rectangle (17x15 stipple)
1851706f2543Smrg  1.74 1.28 1.00 1.00   1.73 10x10 stippled rectangle (17x15 stipple)
1852706f2543Smrg  1.00 1.00 1.00 0.89   0.98 100x100 stippled rectangle (17x15 stipple)
1853706f2543Smrg  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (17x15 stipple)
1854706f2543Smrg  1.94 1.62 1.00 1.00   3.67 1x1 opaque stippled rectangle (17x15 stippl
1855706f2543Smrge)
1856706f2543Smrg  1.69 1.26 1.00 1.00   1.66 10x10 opaque stippled rectangle (17x15 stip
1857706f2543Smrgple)
1858706f2543Smrg  1.00 0.95 1.00 1.00   1.00 100x100 opaque stippled rectangle (17x15 st
1859706f2543Smrgipple)
1860706f2543Smrg  1.00 1.00 1.00 1.00   0.97 500x500 opaque stippled rectangle (17x15 st
1861706f2543Smrgipple)
1862706f2543Smrg  1.93 1.61 0.99 0.99   3.69 1x1 tiled rectangle (17x15 tile)
1863706f2543Smrg  1.73 1.27 1.00 1.00   1.72 10x10 tiled rectangle (17x15 tile)
1864706f2543Smrg  1.00 1.00 1.00 1.00   0.98 100x100 tiled rectangle (17x15 tile)
1865706f2543Smrg  1.00 1.00 0.97 0.97   1.00 500x500 tiled rectangle (17x15 tile)
1866706f2543Smrg  1.95 1.63 1.00 1.00   3.83 1x1 stippled rectangle (161x145 stipple)
1867706f2543Smrg  1.80 1.30 1.00 1.00   1.83 10x10 stippled rectangle (161x145 stipple)
1868706f2543Smrg  0.97 1.00 1.00 1.00   1.01 100x100 stippled rectangle (161x145 stipple
1869706f2543Smrg)
1870706f2543Smrg  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (161x145 stipple
1871706f2543Smrg)
1872706f2543Smrg  1.95 1.63 1.00 1.00   3.56 1x1 opaque stippled rectangle (161x145 stip
1873706f2543Smrgple)
1874706f2543Smrg  1.65 1.25 1.00 1.00   1.68 10x10 opaque stippled rectangle (161x145 st
1875706f2543Smrgipple)
1876706f2543Smrg  1.00 1.00 1.00 1.00   1.01 100x100 opaque stippled rectangle (161x145.
1877706f2543Smrg..
1878706f2543Smrg  1.00 1.00 1.00 1.00   0.97 500x500 opaque stippled rectangle (161x145.
1879706f2543Smrg..
1880706f2543Smrg  1.95 1.63 0.98 0.99   3.80 1x1 tiled rectangle (161x145 tile)
1881706f2543Smrg  1.67 1.26 1.00 1.00   1.67 10x10 tiled rectangle (161x145 tile)
1882706f2543Smrg  1.13 1.14 1.14 1.14   1.14 100x100 tiled rectangle (161x145 tile)
1883706f2543Smrg  0.88 1.00 1.00 1.00   0.99 500x500 tiled rectangle (161x145 tile)
1884706f2543Smrg  1.93 1.63 1.00 1.00   3.53 1x1 tiled rectangle (216x208 tile)
1885706f2543Smrg  1.69 1.26 1.00 1.00   1.66 10x10 tiled rectangle (216x208 tile)
1886706f2543Smrg  1.00 1.00 1.00 1.00   1.00 100x100 tiled rectangle (216x208 tile)
1887706f2543Smrg  1.00 1.00 1.00 1.00   1.00 500x500 tiled rectangle (216x208 tile)
1888706f2543Smrg  1.82 1.70 1.00 1.00   3.38 1-pixel line segment
1889706f2543Smrg  2.07 1.56 0.90 1.00   3.31 10-pixel line segment
1890706f2543Smrg  1.29 1.10 1.00 1.00   1.27 100-pixel line segment
1891706f2543Smrg  1.05 1.06 1.03 1.03   1.09 500-pixel line segment
1892706f2543Smrg  1.30 1.13 1.00 1.00   1.29 100-pixel line segment (1 kid)
1893706f2543Smrg  1.32 1.15 1.00 1.00   1.32 100-pixel line segment (2 kids)
1894706f2543Smrg  1.33 1.16 1.00 1.00   1.33 100-pixel line segment (3 kids)
1895706f2543Smrg  1.92 1.64 1.00 1.00   3.73 10-pixel dashed segment
1896706f2543Smrg  1.34 1.16 1.00 1.00   1.34 100-pixel dashed segment
1897706f2543Smrg  1.24 1.11 0.99 0.97   1.23 100-pixel double-dashed segment
1898706f2543Smrg  1.72 1.77 1.00 1.00   3.25 10-pixel horizontal line segment
1899706f2543Smrg  1.83 1.66 1.01 1.00   3.54 100-pixel horizontal line segment
1900706f2543Smrg  1.86 1.30 1.00 1.00   1.84 500-pixel horizontal line segment
1901706f2543Smrg  2.11 1.52 1.00 0.99   3.02 10-pixel vertical line segment
1902706f2543Smrg  1.21 1.10 1.00 1.00   1.20 100-pixel vertical line segment
1903706f2543Smrg  1.03 1.03 1.00 1.00   1.02 500-pixel vertical line segment
1904706f2543Smrg  4.42 1.68 1.00 1.01   4.64 10x1 wide horizontal line segment
1905706f2543Smrg  1.83 1.31 1.00 1.00   1.83 100x10 wide horizontal line segment
1906706f2543Smrg  1.07 1.00 0.96 1.00   1.07 500x50 wide horizontal line segment
1907706f2543Smrg  4.10 1.67 1.00 1.00   4.62 10x1 wide vertical line segment
1908706f2543Smrg  1.50 1.24 1.06 1.06   1.48 100x10 wide vertical line segment
1909706f2543Smrg  1.06 1.03 1.00 1.00   1.05 500x50 wide vertical line segment
1910706f2543Smrg  2.54 1.61 1.00 1.00   3.61 1-pixel line
1911706f2543Smrg  2.71 1.48 1.00 1.00   2.67 10-pixel line
1912706f2543Smrg  1.19 1.09 1.00 1.00   1.19 100-pixel line
1913706f2543Smrg  1.04 1.02 1.00 1.00   1.03 500-pixel line
1914706f2543Smrg  2.68 1.51 0.98 1.00   3.17 10-pixel dashed line
1915706f2543Smrg  1.23 1.11 0.99 0.99   1.23 100-pixel dashed line
1916706f2543Smrg  1.15 1.08 1.00 1.00   1.15 100-pixel double-dashed line
1917706f2543Smrg  2.27 1.39 1.00 1.00   2.23 10x1 wide line
1918706f2543Smrg  1.20 1.09 1.00 1.00   1.20 100x10 wide line
1919706f2543Smrg  1.04 1.02 1.00 1.00   1.04 500x50 wide line
1920706f2543Smrg  1.52 1.45 1.00 1.00   1.52 100x10 wide dashed line
1921706f2543Smrg  1.54 1.47 1.00 1.00   1.54 100x10 wide double-dashed line
1922706f2543Smrg  1.97 1.30 0.96 0.95   1.95 10x10 rectangle outline
1923706f2543Smrg  1.44 1.27 1.00 1.00   1.43 100x100 rectangle outline
1924706f2543Smrg  3.22 2.16 1.10 1.09   3.61 500x500 rectangle outline
1925706f2543Smrg  1.95 1.34 1.00 1.00   1.90 10x10 wide rectangle outline
1926706f2543Smrg  1.14 1.14 1.00 1.00   1.13 100x100 wide rectangle outline
1927706f2543Smrg  1.00 1.00 1.00 1.00   1.00 500x500 wide rectangle outline
1928706f2543Smrg  1.57 1.72 1.00 1.00   3.03 1-pixel circle
1929706f2543Smrg  1.96 1.35 1.00 1.00   1.92 10-pixel circle
1930706f2543Smrg  1.21 1.07 0.86 0.97   1.20 100-pixel circle
1931706f2543Smrg  1.08 1.04 1.00 1.00   1.08 500-pixel circle
1932706f2543Smrg  1.39 1.19 1.03 1.03   1.38 100-pixel dashed circle
1933706f2543Smrg  1.21 1.11 1.00 1.00   1.23 100-pixel double-dashed circle
1934706f2543Smrg  1.59 1.28 1.00 1.00   1.58 10-pixel wide circle
1935706f2543Smrg  1.22 1.12 0.99 1.00   1.22 100-pixel wide circle
1936706f2543Smrg  1.06 1.04 1.00 1.00   1.05 500-pixel wide circle
1937706f2543Smrg  1.87 1.84 1.00 1.00   1.85 100-pixel wide dashed circle
1938706f2543Smrg  1.90 1.93 1.01 1.01   1.90 100-pixel wide double-dashed circle
1939706f2543Smrg  2.13 1.43 1.00 1.00   2.32 10-pixel partial circle
1940706f2543Smrg  1.42 1.18 1.00 1.00   1.42 100-pixel partial circle
1941706f2543Smrg  1.92 1.85 1.01 1.01   1.89 10-pixel wide partial circle
1942706f2543Smrg  1.73 1.67 1.00 1.00   1.73 100-pixel wide partial circle
1943706f2543Smrg  1.36 1.95 1.00 1.00   2.64 1-pixel solid circle
1944706f2543Smrg  2.02 1.37 1.00 1.00   2.03 10-pixel solid circle
1945706f2543Smrg  1.19 1.09 1.00 1.00   1.19 100-pixel solid circle
1946706f2543Smrg  1.02 0.99 1.00 1.00   1.01 500-pixel solid circle
1947706f2543Smrg  1.74 1.28 1.00 0.88   1.73 10-pixel fill chord partial circle
1948706f2543Smrg  1.31 1.13 1.00 1.00   1.31 100-pixel fill chord partial circle
1949706f2543Smrg  1.67 1.31 1.03 1.03   1.72 10-pixel fill slice partial circle
1950706f2543Smrg  1.30 1.13 1.00 1.00   1.28 100-pixel fill slice partial circle
1951706f2543Smrg  2.45 1.49 1.01 1.00   2.71 10-pixel ellipse
1952706f2543Smrg  1.22 1.10 1.00 1.00   1.22 100-pixel ellipse
1953706f2543Smrg  1.09 1.04 1.00 1.00   1.09 500-pixel ellipse
1954706f2543Smrg  1.90 1.28 1.00 1.00   1.89 100-pixel dashed ellipse
1955706f2543Smrg  1.62 1.24 0.96 0.97   1.61 100-pixel double-dashed ellipse
1956706f2543Smrg  2.43 1.50 1.00 1.00   2.42 10-pixel wide ellipse
1957706f2543Smrg  1.61 1.28 1.03 1.03   1.60 100-pixel wide ellipse
1958706f2543Smrg  1.08 1.05 1.00 1.00   1.08 500-pixel wide ellipse
1959706f2543Smrg  1.93 1.88 1.00 1.00   1.88 100-pixel wide dashed ellipse
1960706f2543Smrg  1.94 1.89 1.01 1.00   1.94 100-pixel wide double-dashed ellipse
1961706f2543Smrg  2.31 1.48 1.00 1.00   2.67 10-pixel partial ellipse
1962706f2543Smrg  1.38 1.17 1.00 1.00   1.38 100-pixel partial ellipse
1963706f2543Smrg  2.00 1.85 0.98 0.97   1.98 10-pixel wide partial ellipse
1964706f2543Smrg  1.89 1.86 1.00 1.00   1.89 100-pixel wide partial ellipse
1965706f2543Smrg  3.49 1.60 1.00 1.00   3.65 10-pixel filled ellipse
1966706f2543Smrg  1.67 1.26 1.00 1.00   1.67 100-pixel filled ellipse
1967706f2543Smrg  1.06 1.04 1.00 1.00   1.06 500-pixel filled ellipse
1968706f2543Smrg  2.38 1.43 1.01 1.00   2.32 10-pixel fill chord partial ellipse
1969706f2543Smrg  2.06 1.30 1.00 1.00   2.05 100-pixel fill chord partial ellipse
1970706f2543Smrg  2.27 1.41 1.00 1.00   2.27 10-pixel fill slice partial ellipse
1971706f2543Smrg  1.98 1.33 1.00 0.97   1.97 100-pixel fill slice partial ellipse
1972706f2543Smrg 57.46 1.99 1.01 1.00 114.92 Fill 1x1 equivalent triangle
1973706f2543Smrg 56.94 1.98 1.01 1.00  73.89 Fill 10x10 equivalent triangle
1974706f2543Smrg  6.07 1.75 1.00 1.00   6.07 Fill 100x100 equivalent triangle
1975706f2543Smrg 51.12 1.98 1.00 1.00 102.81 Fill 1x1 trapezoid
1976706f2543Smrg 51.42 1.82 1.01 1.00  94.89 Fill 10x10 trapezoid
1977706f2543Smrg  6.47 1.80 1.00 1.00   6.44 Fill 100x100 trapezoid
1978706f2543Smrg  1.56 1.28 1.00 0.99   1.56 Fill 300x300 trapezoid
1979706f2543Smrg 51.27 1.97 0.96 0.97 102.54 Fill 1x1 stippled trapezoid (8x8 stipple)
1980706f2543Smrg 51.73 2.00 1.02 1.02  67.92 Fill 10x10 stippled trapezoid (8x8 stipple)
1981706f2543Smrg  5.36 1.72 1.00 1.00   5.36 Fill 100x100 stippled trapezoid (8x8 stippl
1982706f2543Smrge)
1983706f2543Smrg  1.54 1.26 1.00 1.00   1.59 Fill 300x300 stippled trapezoid (8x8 stippl
1984706f2543Smrge)
1985706f2543Smrg 51.41 1.94 1.01 1.00 102.82 Fill 1x1 opaque stippled trapezoid (8x8 sti
1986706f2543Smrgpple)
1987706f2543Smrg 50.71 1.95 0.99 1.00  65.44 Fill 10x10 opaque stippled trapezoid (8x8..
1988706f2543Smrg.
1989706f2543Smrg  5.33 1.73 1.00 1.00   5.36 Fill 100x100 opaque stippled trapezoid (8x8
1990706f2543Smrg...
1991706f2543Smrg  1.58 1.25 1.00 1.00   1.58 Fill 300x300 opaque stippled trapezoid (8x8
1992706f2543Smrg...
1993706f2543Smrg 51.56 1.96 0.99 0.90 103.68 Fill 1x1 tiled trapezoid (4x4 tile)
1994706f2543Smrg 51.59 1.99 1.01 1.01  62.25 Fill 10x10 tiled trapezoid (4x4 tile)
1995706f2543Smrg  5.38 1.72 1.00 1.00   5.38 Fill 100x100 tiled trapezoid (4x4 tile)
1996706f2543Smrg  1.54 1.25 1.00 0.99   1.58 Fill 300x300 tiled trapezoid (4x4 tile)
1997706f2543Smrg 51.70 1.98 1.01 1.01 103.98 Fill 1x1 stippled trapezoid (17x15 stipple)
1998706f2543Smrg 44.86 1.97 1.00 1.00  44.86 Fill 10x10 stippled trapezoid (17x15 stippl
1999706f2543Smrge)
2000706f2543Smrg  2.74 1.56 1.00 1.00   2.73 Fill 100x100 stippled trapezoid (17x15 stip
2001706f2543Smrgple)
2002706f2543Smrg  1.29 1.14 1.00 1.00   1.27 Fill 300x300 stippled trapezoid (17x15 stip
2003706f2543Smrgple)
2004706f2543Smrg 51.41 1.96 0.96 0.95 103.39 Fill 1x1 opaque stippled trapezoid (17x15..
2005706f2543Smrg.
2006706f2543Smrg 45.14 1.96 1.01 1.00  45.14 Fill 10x10 opaque stippled trapezoid (17x15
2007706f2543Smrg...
2008706f2543Smrg  2.68 1.56 1.00 1.00   2.68 Fill 100x100 opaque stippled trapezoid (17x
2009706f2543Smrg15...
2010706f2543Smrg  1.26 1.10 1.00 1.00   1.28 Fill 300x300 opaque stippled trapezoid (17x
2011706f2543Smrg15...
2012706f2543Smrg 51.13 1.97 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (17x15 tile)
2013706f2543Smrg 47.58 1.96 1.00 1.00  47.86 Fill 10x10 tiled trapezoid (17x15 tile)
2014706f2543Smrg  2.74 1.56 1.00 1.00   2.74 Fill 100x100 tiled trapezoid (17x15 tile)
2015706f2543Smrg  1.29 1.14 1.00 1.00   1.28 Fill 300x300 tiled trapezoid (17x15 tile)
2016706f2543Smrg 51.13 1.97 0.99 0.97 103.39 Fill 1x1 stippled trapezoid (161x145 stippl
2017706f2543Smrge)
2018706f2543Smrg 45.14 1.97 1.00 1.00  44.29 Fill 10x10 stippled trapezoid (161x145 stip
2019706f2543Smrgple)
2020706f2543Smrg  3.02 1.77 1.12 1.12   3.38 Fill 100x100 stippled trapezoid (161x145 st
2021706f2543Smrgipple)
2022706f2543Smrg  1.31 1.13 1.00 1.00   1.30 Fill 300x300 stippled trapezoid (161x145 st
2023706f2543Smrgipple)
2024706f2543Smrg 51.27 1.97 1.00 1.00 103.10 Fill 1x1 opaque stippled trapezoid (161x145
2025706f2543Smrg...
2026706f2543Smrg 45.01 1.97 1.00 1.00  45.01 Fill 10x10 opaque stippled trapezoid (161x1
2027706f2543Smrg45...
2028706f2543Smrg  2.67 1.56 1.00 1.00   2.69 Fill 100x100 opaque stippled trapezoid (161
2029706f2543Smrgx145..
2030706f2543Smrg  1.29 1.13 1.00 1.01   1.27 Fill 300x300 opaque stippled trapezoid (161
2031706f2543Smrgx145..
2032706f2543Smrg 51.41 1.96 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (161x145 tile)
2033706f2543Smrg 45.01 1.96 0.98 1.00  45.01 Fill 10x10 tiled trapezoid (161x145 tile)
2034706f2543Smrg  2.62 1.36 1.00 1.00   2.69 Fill 100x100 tiled trapezoid (161x145 tile)
2035706f2543Smrg  1.27 1.13 1.00 1.00   1.22 Fill 300x300 tiled trapezoid (161x145 tile)
2036706f2543Smrg 51.13 1.98 1.00 1.00 103.39 Fill 1x1 tiled trapezoid (216x208 tile)
2037706f2543Smrg 45.14 1.97 1.01 0.99  45.14 Fill 10x10 tiled trapezoid (216x208 tile)
2038706f2543Smrg  2.62 1.55 1.00 1.00   2.71 Fill 100x100 tiled trapezoid (216x208 tile)
2039706f2543Smrg  1.28 1.13 1.00 1.00   1.20 Fill 300x300 tiled trapezoid (216x208 tile)
2040706f2543Smrg 50.71 1.95 1.00 1.00  54.70 Fill 10x10 equivalent complex polygon
2041706f2543Smrg  5.51 1.71 0.96 0.98   5.47 Fill 100x100 equivalent complex polygons
2042706f2543Smrg  8.39 1.97 1.00 1.00  16.75 Fill 10x10 64-gon (Convex)
2043706f2543Smrg  8.38 1.83 1.00 1.00   8.43 Fill 100x100 64-gon (Convex)
2044706f2543Smrg  8.50 1.96 1.00 1.00  16.64 Fill 10x10 64-gon (Complex)
2045706f2543Smrg  8.26 1.83 1.00 1.00   8.35 Fill 100x100 64-gon (Complex)
2046706f2543Smrg 14.09 1.87 1.00 1.00  14.05 Char in 80-char line (6x13)
2047706f2543Smrg 11.91 1.87 1.00 1.00  11.95 Char in 70-char line (8x13)
2048706f2543Smrg 11.16 1.85 1.01 1.00  11.10 Char in 60-char line (9x15)
2049706f2543Smrg 10.09 1.78 1.00 1.00  10.09 Char16 in 40-char line (k14)
2050706f2543Smrg  6.15 1.75 1.00 1.00   6.31 Char16 in 23-char line (k24)
2051706f2543Smrg 11.92 1.90 1.03 1.03  11.88 Char in 80-char line (TR 10)
2052706f2543Smrg  8.18 1.78 1.00 0.99   8.17 Char in 30-char line (TR 24)
2053706f2543Smrg 42.83 1.44 1.01 1.00  42.11 Char in 20/40/20 line (6x13, TR 10)
2054706f2543Smrg 27.45 1.43 1.01 1.01  27.45 Char16 in 7/14/7 line (k14, k24)
2055706f2543Smrg 12.13 1.85 1.00 1.00  12.05 Char in 80-char image line (6x13)
2056706f2543Smrg 10.00 1.84 1.00 1.00  10.00 Char in 70-char image line (8x13)
2057706f2543Smrg  9.18 1.83 1.00 1.00   9.12 Char in 60-char image line (9x15)
2058706f2543Smrg  9.66 1.82 0.98 0.95   9.66 Char16 in 40-char image line (k14)
2059706f2543Smrg  5.82 1.72 1.00 1.00   5.99 Char16 in 23-char image line (k24)
2060706f2543Smrg  8.70 1.80 1.00 1.00   8.65 Char in 80-char image line (TR 10)
2061706f2543Smrg  4.67 1.66 1.00 1.00   4.67 Char in 30-char image line (TR 24)
2062706f2543Smrg 84.43 1.47 1.00 1.00 124.18 Scroll 10x10 pixels
2063706f2543Smrg  3.73 1.50 1.00 0.98   3.73 Scroll 100x100 pixels
2064706f2543Smrg  1.00 1.00 1.00 1.00   1.00 Scroll 500x500 pixels
2065706f2543Smrg 84.43 1.51 1.00 1.00 134.02 Copy 10x10 from window to window
2066706f2543Smrg  3.62 1.51 0.98 0.98   3.62 Copy 100x100 from window to window
2067706f2543Smrg  0.89 1.00 1.00 1.00   1.00 Copy 500x500 from window to window
2068706f2543Smrg 57.06 1.99 1.00 1.00  88.64 Copy 10x10 from pixmap to window
2069706f2543Smrg  2.49 2.00 1.00 1.00   2.48 Copy 100x100 from pixmap to window
2070706f2543Smrg  1.00 0.91 1.00 1.00   0.98 Copy 500x500 from pixmap to window
2071706f2543Smrg  2.04 1.01 1.00 1.00   2.03 Copy 10x10 from window to pixmap
2072706f2543Smrg  1.05 1.00 1.00 1.00   1.05 Copy 100x100 from window to pixmap
2073706f2543Smrg  1.00 1.00 0.93 1.00   1.04 Copy 500x500 from window to pixmap
2074706f2543Smrg 58.52 1.03 1.03 1.02  57.95 Copy 10x10 from pixmap to pixmap
2075706f2543Smrg  2.40 1.00 1.00 1.00   2.45 Copy 100x100 from pixmap to pixmap
2076706f2543Smrg  1.00 1.00 1.00 1.00   1.00 Copy 500x500 from pixmap to pixmap
2077706f2543Smrg 51.57 1.92 1.00 1.00  85.75 Copy 10x10 1-bit deep plane
2078706f2543Smrg  6.37 1.75 1.01 1.01   6.37 Copy 100x100 1-bit deep plane
2079706f2543Smrg  1.26 1.11 1.00 1.00   1.24 Copy 500x500 1-bit deep plane
2080706f2543Smrg  4.23 1.63 0.98 0.97   4.38 Copy 10x10 n-bit deep plane
2081706f2543Smrg  1.04 1.02 1.00 1.00   1.04 Copy 100x100 n-bit deep plane
2082706f2543Smrg  1.00 1.00 1.00 1.00   1.00 Copy 500x500 n-bit deep plane
2083706f2543Smrg  6.45 1.98 1.00 1.26  12.80 PutImage 10x10 square
2084706f2543Smrg  1.10 1.87 1.00 1.83   2.11 PutImage 100x100 square
2085706f2543Smrg  1.02 1.93 1.00 1.91   1.91 PutImage 500x500 square
2086706f2543Smrg  4.17 1.78 1.00 1.40   7.18 PutImage XY 10x10 square
2087706f2543Smrg  1.27 1.49 0.97 1.48   2.10 PutImage XY 100x100 square
2088706f2543Smrg  1.00 1.50 1.00 1.50   1.52 PutImage XY 500x500 square
2089706f2543Smrg  1.07 1.01 1.00 1.00   1.06 GetImage 10x10 square
2090706f2543Smrg  1.01 1.00 1.00 1.00   1.01 GetImage 100x100 square
2091706f2543Smrg  1.00 1.00 1.00 1.00   1.00 GetImage 500x500 square
2092706f2543Smrg  1.56 1.00 0.99 0.97   1.56 GetImage XY 10x10 square
2093706f2543Smrg  1.02 1.00 1.00 1.00   1.02 GetImage XY 100x100 square
2094706f2543Smrg  1.00 1.00 1.00 1.00   1.00 GetImage XY 500x500 square
2095706f2543Smrg  1.00 1.00 1.01 0.98   0.95 X protocol NoOperation
2096706f2543Smrg  1.02 1.03 1.04 1.03   1.00 QueryPointer
2097706f2543Smrg  1.03 1.02 1.04 1.03   1.00 GetProperty
2098706f2543Smrg100.41 1.51 1.00 1.00 198.76 Change graphics context
2099706f2543Smrg 45.81 1.00 0.99 0.97  57.10 Create and map subwindows (4 kids)
2100706f2543Smrg 78.45 1.01 1.02 1.02  63.07 Create and map subwindows (16 kids)
2101706f2543Smrg 73.91 1.01 1.00 1.00  56.37 Create and map subwindows (25 kids)
2102706f2543Smrg 73.22 1.00 1.00 1.00  49.07 Create and map subwindows (50 kids)
2103706f2543Smrg 72.36 1.01 0.99 1.00  32.14 Create and map subwindows (75 kids)
2104706f2543Smrg 70.34 1.00 1.00 1.00  30.12 Create and map subwindows (100 kids)
2105706f2543Smrg 55.00 1.00 1.00 0.99  23.75 Create and map subwindows (200 kids)
2106706f2543Smrg 55.30 1.01 1.00 1.00 141.03 Create unmapped window (4 kids)
2107706f2543Smrg 55.38 1.01 1.01 1.00 163.25 Create unmapped window (16 kids)
2108706f2543Smrg 54.75 0.96 1.00 0.99 166.95 Create unmapped window (25 kids)
2109706f2543Smrg 54.83 1.00 1.00 0.99 178.81 Create unmapped window (50 kids)
2110706f2543Smrg 55.38 1.01 1.01 1.00 181.20 Create unmapped window (75 kids)
2111706f2543Smrg 55.38 1.01 1.01 1.00 181.20 Create unmapped window (100 kids)
2112706f2543Smrg 54.87 1.01 1.01 1.00 182.05 Create unmapped window (200 kids)
2113706f2543Smrg 28.13 1.00 1.00 1.00  30.75 Map window via parent (4 kids)
2114706f2543Smrg 36.14 1.01 1.01 1.01  32.58 Map window via parent (16 kids)
2115706f2543Smrg 26.13 1.00 0.98 0.95  29.85 Map window via parent (25 kids)
2116706f2543Smrg 40.07 1.00 1.01 1.00  27.57 Map window via parent (50 kids)
2117706f2543Smrg 23.26 0.99 1.00 1.00  18.23 Map window via parent (75 kids)
2118706f2543Smrg 22.91 0.99 1.00 0.99  16.52 Map window via parent (100 kids)
2119706f2543Smrg 27.79 1.00 1.00 0.99  12.50 Map window via parent (200 kids)
2120706f2543Smrg 22.35 1.00 1.00 1.00  56.19 Unmap window via parent (4 kids)
2121706f2543Smrg  9.57 1.00 0.99 1.00  89.78 Unmap window via parent (16 kids)
2122706f2543Smrg 80.77 1.01 1.00 1.00 103.85 Unmap window via parent (25 kids)
2123706f2543Smrg 96.34 1.00 1.00 1.00 116.06 Unmap window via parent (50 kids)
2124706f2543Smrg 99.72 1.00 1.00 1.00 124.93 Unmap window via parent (75 kids)
2125706f2543Smrg112.36 1.00 1.00 1.00 125.27 Unmap window via parent (100 kids)
2126706f2543Smrg105.41 1.00 1.00 0.99 120.00 Unmap window via parent (200 kids)
2127706f2543Smrg 51.29 1.03 1.02 1.02  74.19 Destroy window via parent (4 kids)
2128706f2543Smrg 86.75 0.99 0.99 0.99 116.87 Destroy window via parent (16 kids)
2129706f2543Smrg106.43 1.01 1.01 1.01 127.49 Destroy window via parent (25 kids)
2130706f2543Smrg120.34 1.01 1.01 1.00 140.11 Destroy window via parent (50 kids)
2131706f2543Smrg126.67 1.00 0.99 0.99 145.00 Destroy window via parent (75 kids)
2132706f2543Smrg126.11 1.01 1.01 1.00 140.56 Destroy window via parent (100 kids)
2133706f2543Smrg128.57 1.01 1.00 1.00 137.91 Destroy window via parent (200 kids)
2134706f2543Smrg 16.04 0.88 1.00 1.00  20.36 Hide/expose window via popup (4 kids)
2135706f2543Smrg 19.04 1.01 1.00 1.00  23.48 Hide/expose window via popup (16 kids)
2136706f2543Smrg 19.22 1.00 1.00 1.00  20.44 Hide/expose window via popup (25 kids)
2137706f2543Smrg 17.41 1.00 0.91 0.97  17.68 Hide/expose window via popup (50 kids)
2138706f2543Smrg 17.29 1.01 1.00 1.01  17.07 Hide/expose window via popup (75 kids)
2139706f2543Smrg 16.74 1.00 1.00 1.00  16.17 Hide/expose window via popup (100 kids)
2140706f2543Smrg 10.30 1.00 1.00 1.00  10.51 Hide/expose window via popup (200 kids)
2141706f2543Smrg 16.48 1.01 1.00 1.00  26.05 Move window (4 kids)
2142706f2543Smrg 17.01 0.95 1.00 1.00  23.97 Move window (16 kids)
2143706f2543Smrg 16.95 1.00 1.00 1.00  22.90 Move window (25 kids)
2144706f2543Smrg 16.05 1.01 1.00 1.00  21.32 Move window (50 kids)
2145706f2543Smrg 15.58 1.00 0.98 0.98  19.44 Move window (75 kids)
2146706f2543Smrg 14.98 1.02 1.03 1.03  18.17 Move window (100 kids)
2147706f2543Smrg 10.90 1.01 1.01 1.00  12.68 Move window (200 kids)
2148706f2543Smrg 49.42 1.00 1.00 1.00 198.27 Moved unmapped window (4 kids)
2149706f2543Smrg 50.72 0.97 1.00 1.00 193.66 Moved unmapped window (16 kids)
2150706f2543Smrg 50.87 1.00 0.99 1.00 195.09 Moved unmapped window (25 kids)
2151706f2543Smrg 50.72 1.00 1.00 1.00 189.34 Moved unmapped window (50 kids)
2152706f2543Smrg 50.87 1.00 1.00 1.00 191.33 Moved unmapped window (75 kids)
2153706f2543Smrg 50.87 1.00 1.00 0.90 186.71 Moved unmapped window (100 kids)
2154706f2543Smrg 50.87 1.00 1.00 1.00 179.19 Moved unmapped window (200 kids)
2155706f2543Smrg 41.04 1.00 1.00 1.00  56.61 Move window via parent (4 kids)
2156706f2543Smrg 69.81 1.00 1.00 1.00 130.82 Move window via parent (16 kids)
2157706f2543Smrg 95.81 1.00 1.00 1.00 141.92 Move window via parent (25 kids)
2158706f2543Smrg 95.98 1.00 1.00 1.00 149.43 Move window via parent (50 kids)
2159706f2543Smrg 96.59 1.01 1.01 1.00 153.98 Move window via parent (75 kids)
2160706f2543Smrg 97.19 1.00 1.00 1.00 157.30 Move window via parent (100 kids)
2161706f2543Smrg 96.67 1.00 0.99 0.96 159.44 Move window via parent (200 kids)
2162706f2543Smrg 17.75 1.01 1.00 1.00  27.61 Resize window (4 kids)
2163706f2543Smrg 17.94 1.00 1.00 0.99  25.42 Resize window (16 kids)
2164706f2543Smrg 17.92 1.01 1.00 1.00  24.47 Resize window (25 kids)
2165706f2543Smrg 17.24 0.97 1.00 1.00  24.14 Resize window (50 kids)
2166706f2543Smrg 16.81 1.00 1.00 0.99  22.75 Resize window (75 kids)
2167706f2543Smrg 16.08 1.00 1.00 1.00  21.20 Resize window (100 kids)
2168706f2543Smrg 12.92 1.00 0.99 1.00  16.26 Resize window (200 kids)
2169706f2543Smrg 52.94 1.01 1.00 1.00 327.12 Resize unmapped window (4 kids)
2170706f2543Smrg 53.60 1.01 1.01 1.01 333.71 Resize unmapped window (16 kids)
2171706f2543Smrg 52.99 1.00 1.00 1.00 337.29 Resize unmapped window (25 kids)
2172706f2543Smrg 51.98 1.00 1.00 1.00 329.38 Resize unmapped window (50 kids)
2173706f2543Smrg 53.05 0.89 1.00 1.00 322.60 Resize unmapped window (75 kids)
2174706f2543Smrg 53.05 1.00 1.00 1.00 318.08 Resize unmapped window (100 kids)
2175706f2543Smrg 53.11 1.00 1.00 0.99 306.21 Resize unmapped window (200 kids)
2176706f2543Smrg 16.76 1.00 0.96 1.00  19.46 Circulate window (4 kids)
2177706f2543Smrg 17.24 1.00 1.00 0.97  16.24 Circulate window (16 kids)
2178706f2543Smrg 16.30 1.03 1.03 1.03  15.85 Circulate window (25 kids)
2179706f2543Smrg 13.45 1.00 1.00 1.00  14.90 Circulate window (50 kids)
2180706f2543Smrg 12.91 1.00 1.00 1.00  13.06 Circulate window (75 kids)
2181706f2543Smrg 11.30 0.98 1.00 1.00  11.03 Circulate window (100 kids)
2182706f2543Smrg  7.58 1.01 1.01 0.99   7.47 Circulate window (200 kids)
2183706f2543Smrg  1.01 1.01 0.98 1.00   0.95 Circulate Unmapped window (4 kids)
2184706f2543Smrg  1.07 1.07 1.01 1.07   1.02 Circulate Unmapped window (16 kids)
2185706f2543Smrg  1.04 1.09 1.06 1.05   0.97 Circulate Unmapped window (25 kids)
2186706f2543Smrg  1.04 1.23 1.20 1.18   1.05 Circulate Unmapped window (50 kids)
2187706f2543Smrg  1.18 1.53 1.19 1.45   1.24 Circulate Unmapped window (75 kids)
2188706f2543Smrg  1.08 1.02 1.01 1.74   1.01 Circulate Unmapped window (100 kids)
2189706f2543Smrg  1.01 1.12 0.98 0.91   0.97 Circulate Unmapped window (200 kids)
2190706f2543Smrg
2191706f2543SmrgProfiling with OProfile
2192706f2543Smrg
2193706f2543Smrg   OProfile (available from http://oprofile.sourceforge.net/) is a
2194706f2543Smrg   system-wide profiler for Linux systems that uses
2195706f2543Smrg   processor-level counters to collect sampling data. OProfile can
2196706f2543Smrg   provide information that is similar to that provided by gprof,
2197706f2543Smrg   but without the necessity of recompiling the program with
2198706f2543Smrg   special instrumentation (i.e., OProfile can collect statistical
2199706f2543Smrg   profiling information about optimized programs). A test harness
2200706f2543Smrg   was developed to collect OProfile data for each x11perf test
2201706f2543Smrg   individually.
2202706f2543Smrg
2203706f2543Smrg   Test runs were performed using the RETIRED_INSNS counter on the
2204706f2543Smrg   AMD Athlon and the CPU_CLK_HALTED counter on the Intel Pentium
2205706f2543Smrg   III (with a test configuration different from the one described
2206706f2543Smrg   above). We have examined OProfile output and have compared it
2207706f2543Smrg   with gprof output. This investigation has not produced results
2208706f2543Smrg   that yield performance increases in x11perf numbers.
2209706f2543Smrg
2210706f2543SmrgX Test Suite
2211706f2543Smrg
2212706f2543Smrg   The X Test Suite was run on the fully optimized DMX server
2213706f2543Smrg   using the configuration described above. The following failures
2214706f2543Smrg   were noted:
2215706f2543SmrgXListPixmapFormats: Test 1              [1]
2216706f2543SmrgXChangeWindowAttributes: Test 32        [1]
2217706f2543SmrgXCreateWindow: Test 30                  [1]
2218706f2543SmrgXFreeColors: Test 4                     [3]
2219706f2543SmrgXCopyArea: Test 13, 17, 21, 25, 30      [2]
2220706f2543SmrgXCopyPlane: Test 11, 15, 27, 31         [2]
2221706f2543SmrgXSetFontPath: Test 4                    [1]
2222706f2543SmrgXChangeKeyboardControl: Test 9, 10      [1]
2223706f2543Smrg
2224706f2543Smrg[1] Previously documented errors expected from the Xinerama
2225706f2543Smrg    implementation (see Phase I discussion).
2226706f2543Smrg[2] Newly noted errors that have been verified as expected
2227706f2543Smrg    behavior of the Xinerama implementation.
2228706f2543Smrg[3] Newly noted error that has been verified as a Xinerama
2229706f2543Smrg    implementation bug.
2230706f2543Smrg
2231706f2543SmrgPhase III
2232706f2543Smrg
2233706f2543Smrg   During the third phase of development, support was provided for
2234706f2543Smrg   the following extensions: SHAPE, RENDER, XKEYBOARD, XInput.
2235706f2543Smrg
2236706f2543SmrgSHAPE
2237706f2543Smrg
2238706f2543Smrg   The SHAPE extension is supported. Test applications (e.g.,
2239706f2543Smrg   xeyes and oclock) and window managers that make use of the
2240706f2543Smrg   SHAPE extension will work as expected.
2241706f2543Smrg
2242706f2543SmrgRENDER
2243706f2543Smrg
2244706f2543Smrg   The RENDER extension is supported. The version included in the
2245706f2543Smrg   DMX CVS tree is version 0.2, and this version is fully
2246706f2543Smrg   supported by Xdmx. Applications using only version 0.2
2247706f2543Smrg   functions will work correctly; however, some apps that make use
2248706f2543Smrg   of functions from later versions do not properly check the
2249706f2543Smrg   extension's major/minor version numbers. These apps will fail
2250706f2543Smrg   with a Bad Implementation error when using post-version 0.2
2251706f2543Smrg   functions. This is expected behavior. When the DMX CVS tree is
2252706f2543Smrg   updated to include newer versions of RENDER, support for these
2253706f2543Smrg   newer functions will be added to the DMX X server.
2254706f2543Smrg
2255706f2543SmrgXKEYBOARD
2256706f2543Smrg
2257706f2543Smrg   The XKEYBOARD extension is supported. If present on the
2258706f2543Smrg   back-end X servers, the XKEYBOARD extension will be used to
2259706f2543Smrg   obtain information about the type of the keyboard for
2260706f2543Smrg   initialization. Otherwise, the keyboard will be initialized
2261706f2543Smrg   using defaults. Note that this departs from older behavior:
2262706f2543Smrg   when Xdmx is compiled without XKEYBOARD support, the map from
2263706f2543Smrg   the back-end X server will be preserved. With XKEYBOARD
2264706f2543Smrg   support, the map is not preserved because better information
2265706f2543Smrg   and control of the keyboard is available.
2266706f2543Smrg
2267706f2543SmrgXInput
2268706f2543Smrg
2269706f2543Smrg   The XInput extension is supported. Any device can be used as a
2270706f2543Smrg   core device and be used as an XInput extension device, with the
2271706f2543Smrg   exception of core devices on the back-end servers. This
2272706f2543Smrg   limitation is present because cursor handling on the back-end
2273706f2543Smrg   requires that the back-end cursor sometimes track the Xdmx core
2274706f2543Smrg   cursor -- behavior that is incompatible with using the back-end
2275706f2543Smrg   pointer as a non-core device.
2276706f2543Smrg
2277706f2543Smrg   Currently, back-end extension devices are not available as Xdmx
2278706f2543Smrg   extension devices, but this limitation should be removed in the
2279706f2543Smrg   future.
2280706f2543Smrg
2281706f2543Smrg   To demonstrate the XInput extension, and to provide more
2282706f2543Smrg   examples for low-level input device driver writers, USB device
2283706f2543Smrg   drivers have been written for mice (usb-mou), keyboards
2284706f2543Smrg   (usb-kbd), and non-mouse/non-keyboard USB devices (usb-oth).
2285706f2543Smrg   Please see the man page for information on Linux kernel drivers
2286706f2543Smrg   that are required for using these Xdmx drivers.
2287706f2543Smrg
2288706f2543SmrgDPMS
2289706f2543Smrg
2290706f2543Smrg   The DPMS extension is exported but does not do anything at this
2291706f2543Smrg   time.
2292706f2543Smrg
2293706f2543SmrgOther Extensions
2294706f2543Smrg
2295706f2543Smrg   The LBX, SECURITY, XC-APPGROUP, and XFree86-Bigfont extensions
2296706f2543Smrg   do not require any special Xdmx support and have been exported.
2297706f2543Smrg
2298706f2543Smrg   The BIG-REQUESTS, DEC-XTRAP, DOUBLE-BUFFER,
2299706f2543Smrg   Extended-Visual-Information, FontCache, GLX, MIT-SCREEN-SAVER,
2300706f2543Smrg   MIT-SHM, MIT-SUNDRY-NONSTANDARD, RECORD, SECURITY, SGI-GLX,
2301706f2543Smrg   SYNC, TOG-CUP, X-Resource, XC-MISC, XFree86-DGA, XFree86-DRI,
2302706f2543Smrg   XFree86-Misc, XFree86-VidModeExtension, and XVideo extensions
2303706f2543Smrg   are not supported at this time, but will be evaluated for
2304706f2543Smrg   inclusion in future DMX releases. See below for additional work
2305706f2543Smrg   on extensions after Phase III.
2306706f2543Smrg
2307706f2543SmrgPhase IV
2308706f2543Smrg
2309706f2543SmrgMoving to XFree86 4.3.0
2310706f2543Smrg
2311706f2543Smrg   For Phase IV, the recent release of XFree86 4.3.0 (27 February
2312706f2543Smrg   2003) was merged onto the dmx.sourceforge.net CVS trunk and all
2313706f2543Smrg   work is proceeding using this tree.
2314706f2543Smrg
2315706f2543SmrgExtensions
2316706f2543Smrg
2317706f2543SmrgXC-MISC (supported)
2318706f2543Smrg
2319706f2543Smrg   XC-MISC is used internally by the X library to recycle XIDs
2320706f2543Smrg   from the X server. This is important for long-running X server
2321706f2543Smrg   sessions. Xdmx supports this extension. The X Test Suite passed
2322706f2543Smrg   and failed the exact same tests before and after this extension
2323706f2543Smrg   was enabled.
2324706f2543Smrg
2325706f2543SmrgExtended-Visual-Information (supported)
2326706f2543Smrg
2327706f2543Smrg   The Extended-Visual-Information extension provides a method for
2328706f2543Smrg   an X client to obtain detailed visual information. Xdmx
2329706f2543Smrg   supports this extension. It was tested using the
2330706f2543Smrg   hw/dmx/examples/evi example program. Note that this extension
2331706f2543Smrg   is not Xinerama-aware -- it will return visual information for
2332706f2543Smrg   each screen even though Xinerama is causing the X server to
2333706f2543Smrg   export a single logical screen.
2334706f2543Smrg
2335706f2543SmrgRES (supported)
2336706f2543Smrg
2337706f2543Smrg   The X-Resource extension provides a mechanism for a client to
2338706f2543Smrg   obtain detailed information about the resources used by other
2339706f2543Smrg   clients. This extension was tested with the hw/dmx/examples/res
2340706f2543Smrg   program. The X Test Suite passed and failed the exact same
2341706f2543Smrg   tests before and after this extension was enabled.
2342706f2543Smrg
2343706f2543SmrgBIG-REQUESTS (supported)
2344706f2543Smrg
2345706f2543Smrg   This extension enables the X11 protocol to handle requests
2346706f2543Smrg   longer than 262140 bytes. The X Test Suite passed and failed
2347706f2543Smrg   the exact same tests before and after this extension was
2348706f2543Smrg   enabled.
2349706f2543Smrg
2350706f2543SmrgXSYNC (supported)
2351706f2543Smrg
2352706f2543Smrg   This extension provides facilities for two different X clients
2353706f2543Smrg   to synchronize their requests. This extension was minimally
2354706f2543Smrg   tested with xdpyinfo and the X Test Suite passed and failed the
2355706f2543Smrg   exact same tests before and after this extension was enabled.
2356706f2543Smrg
2357706f2543SmrgXTEST, RECORD, DEC-XTRAP (supported) and XTestExtension1 (not
2358706f2543Smrgsupported)
2359706f2543Smrg
2360706f2543Smrg   The XTEST and RECORD extension were developed by the X
2361706f2543Smrg   Consortium for use in the X Test Suite and are supported as a
2362706f2543Smrg   standard in the X11R6 tree. They are also supported in Xdmx.
2363706f2543Smrg   When X Test Suite tests that make use of the XTEST extension
2364706f2543Smrg   are run, Xdmx passes and fails exactly the same tests as does a
2365706f2543Smrg   standard XFree86 X server. When the rcrdtest test (a part of
2366706f2543Smrg   the X Test Suite that verifies the RECORD extension) is run,
2367706f2543Smrg   Xdmx passes and fails exactly the same tests as does a standard
2368706f2543Smrg   XFree86 X server.
2369706f2543Smrg
2370706f2543Smrg   There are two older XTEST-like extensions: DEC-XTRAP and
2371706f2543Smrg   XTestExtension1. The XTestExtension1 extension was developed
2372706f2543Smrg   for use by the X Testing Consortium for use with a test suite
2373706f2543Smrg   that eventually became (part of?) the X Test Suite. Unlike
2374706f2543Smrg   XTEST, which only allows events to be sent to the server, the
2375706f2543Smrg   XTestExtension1 extension also allowed events to be recorded
2376706f2543Smrg   (similar to the RECORD extension). The second is the DEC-XTRAP
2377706f2543Smrg   extension that was developed by the Digital Equipment
2378706f2543Smrg   Corporation.
2379706f2543Smrg
2380706f2543Smrg   The DEC-XTRAP extension is available from Xdmx and has been
2381706f2543Smrg   tested with the xtrap* tools which are distributed as standard
2382706f2543Smrg   X11R6 clients.
2383706f2543Smrg
2384706f2543Smrg   The XTestExtension1 is not supported because it does not appear
2385706f2543Smrg   to be used by any modern X clients (the few that support it
2386706f2543Smrg   also support XTEST) and because there are no good methods
2387706f2543Smrg   available for testing that it functions correctly (unlike XTEST
2388706f2543Smrg   and DEC-XTRAP, the code for XTestExtension1 is not part of the
2389706f2543Smrg   standard X server source tree, so additional testing is
2390706f2543Smrg   important).
2391706f2543Smrg
2392706f2543Smrg   Most of these extensions are documented in the X11R6 source
2393706f2543Smrg   tree. Further, several original papers exist that this author
2394706f2543Smrg   was unable to locate -- for completeness and historical
2395706f2543Smrg   interest, citations are provide:
2396706f2543Smrg
2397706f2543Smrg   XRECORD
2398706f2543Smrg
2399706f2543Smrg   Martha Zimet. Extending X For Recording. 8th Annual X Technical
2400706f2543Smrg   Conference Boston, MA January 24-26, 1994.
2401706f2543Smrg
2402706f2543Smrg   DEC-XTRAP
2403706f2543Smrg
2404706f2543Smrg   Dick Annicchiarico, Robert Chesler, Alan Jamison. XTrap
2405706f2543Smrg   Architecture. Digital Equipment Corporation, July 1991.
2406706f2543Smrg
2407706f2543Smrg   XTestExtension1
2408706f2543Smrg
2409706f2543Smrg   Larry Woestman. X11 Input Synthesis Extension Proposal. Hewlett
2410706f2543Smrg   Packard, November 1991.
2411706f2543Smrg
2412706f2543SmrgMIT-MISC (not supported)
2413706f2543Smrg
2414706f2543Smrg   The MIT-MISC extension is used to control a bug-compatibility
2415706f2543Smrg   flag that provides compatibility with xterm programs from X11R1
2416706f2543Smrg   and X11R2. There does not appear to be a single client
2417706f2543Smrg   available that makes use of this extension and there is not way
2418706f2543Smrg   to verify that it works correctly. The Xdmx server does not
2419706f2543Smrg   support MIT-MISC.
2420706f2543Smrg
2421706f2543SmrgSCREENSAVER (not supported)
2422706f2543Smrg
2423706f2543Smrg   This extension provides special support for the X screen saver.
2424706f2543Smrg   It was tested with beforelight, which appears to be the only
2425706f2543Smrg   client that works with it. When Xinerama was not active,
2426706f2543Smrg   beforelight behaved as expected. However, when Xinerama was
2427706f2543Smrg   active, beforelight did not behave as expected. Further, when
2428706f2543Smrg   this extension is not active, xscreensaver (a widely-used X
2429706f2543Smrg   screen saver program) did not behave as expected. Since this
2430706f2543Smrg   extension is not Xinerama-aware and is not commonly used with
2431706f2543Smrg   expected results by clients, we have left this extension
2432706f2543Smrg   disabled at this time.
2433706f2543Smrg
2434706f2543SmrgGLX (supported)
2435706f2543Smrg
2436706f2543Smrg   The GLX extension provides OpenGL and GLX windowing support. In
2437706f2543Smrg   Xdmx, the extension is called glxProxy, and it is Xinerama
2438706f2543Smrg   aware. It works by either feeding requests forward through Xdmx
2439706f2543Smrg   to each of the back-end servers or handling them locally. All
2440706f2543Smrg   rendering requests are handled on the back-end X servers. This
2441706f2543Smrg   code was donated to the DMX project by SGI. For the X Test
2442706f2543Smrg   Suite results comparison, see below.
2443706f2543Smrg
2444706f2543SmrgRENDER (supported)
2445706f2543Smrg
2446706f2543Smrg   The X Rendering Extension (RENDER) provides support for digital
2447706f2543Smrg   image composition. Geometric and text rendering are supported.
2448706f2543Smrg   RENDER is partially Xinerama-aware, with text and the most
2449706f2543Smrg   basic compositing operator; however, its higher level
2450706f2543Smrg   primitives (triangles, triangle strips, and triangle fans) are
2451706f2543Smrg   not yet Xinerama-aware. The RENDER extension is still under
2452706f2543Smrg   development, and is currently at version 0.8. Additional
2453706f2543Smrg   support will be required in DMX as more primitives and/or
2454706f2543Smrg   requests are added to the extension.
2455706f2543Smrg
2456706f2543Smrg   There is currently no test suite for the X Rendering Extension;
2457706f2543Smrg   however, there has been discussion of developing a test suite
2458706f2543Smrg   as the extension matures. When that test suite becomes
2459706f2543Smrg   available, additional testing can be performed with Xdmx. The X
2460706f2543Smrg   Test Suite passed and failed the exact same tests before and
2461706f2543Smrg   after this extension was enabled.
2462706f2543Smrg
2463706f2543SmrgSummary
2464706f2543Smrg
2465706f2543Smrg   To summarize, the following extensions are currently supported:
2466706f2543Smrg   BIG-REQUESTS, DEC-XTRAP, DMX, DPMS,
2467706f2543Smrg   Extended-Visual-Information, GLX, LBX, RECORD, RENDER,
2468706f2543Smrg   SECURITY, SHAPE, SYNC, X-Resource, XC-APPGROUP, XC-MISC,
2469706f2543Smrg   XFree86-Bigfont, XINERAMA, XInputExtension, XKEYBOARD, and
2470706f2543Smrg   XTEST.
2471706f2543Smrg
2472706f2543Smrg   The following extensions are not supported at this time:
2473706f2543Smrg   DOUBLE-BUFFER, FontCache, MIT-SCREEN-SAVER, MIT-SHM,
2474706f2543Smrg   MIT-SUNDRY-NONSTANDARD, TOG-CUP, XFree86-DGA, XFree86-Misc,
2475706f2543Smrg   XFree86-VidModeExtension, XTestExtensionExt1, and XVideo.
2476706f2543Smrg
2477706f2543SmrgAdditional Testing with the X Test Suite
2478706f2543Smrg
2479706f2543SmrgXFree86 without XTEST
2480706f2543Smrg
2481706f2543Smrg   After the release of XFree86 4.3.0, we retested the XFree86 X
2482706f2543Smrg   server with and without using the XTEST extension. When the
2483706f2543Smrg   XTEST extension was not used for testing, the XFree86 4.3.0
2484706f2543Smrg   server running on our usual test system with a Radeon VE card
2485706f2543Smrg   reported unexpected failures in the following tests:
2486706f2543Smrg
2487706f2543Smrg   XListPixmapFormats: Test 1
2488706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
2489706f2543Smrg   XGetDefault: Test 5
2490706f2543Smrg   XRebindKeysym: Test 1
2491706f2543Smrg
2492706f2543SmrgXFree86 with XTEST
2493706f2543Smrg
2494706f2543Smrg   When using the XTEST extension, the XFree86 4.3.0 server
2495706f2543Smrg   reported the following errors:
2496706f2543Smrg
2497706f2543Smrg   XListPixmapFormats: Test 1
2498706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
2499706f2543Smrg   XGetDefault: Test 5
2500706f2543Smrg   XRebindKeysym: Test 1
2501706f2543Smrg   XAllowEvents: Tests 20, 21, 24
2502706f2543Smrg   XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
2503706f2543Smrg   XGrabKey: Test 8
2504706f2543Smrg   XSetPointerMapping: Test 3
2505706f2543Smrg   XUngrabButton: Test 4
2506706f2543Smrg
2507706f2543Smrg   While these errors may be important, they will probably be
2508706f2543Smrg   fixed eventually in the XFree86 source tree. We are
2509706f2543Smrg   particularly interested in demonstrating that the Xdmx server
2510706f2543Smrg   does not introduce additional failures that are not known
2511706f2543Smrg   Xinerama failures.
2512706f2543Smrg
2513706f2543SmrgXdmx with XTEST, without Xinerama, without GLX
2514706f2543Smrg
2515706f2543Smrg   Without Xinerama, but using the XTEST extension, the following
2516706f2543Smrg   errors were reported from Xdmx (note that these are the same as
2517706f2543Smrg   for the XFree86 4.3.0, except that XGetDefault no longer
2518706f2543Smrg   fails):
2519706f2543Smrg
2520706f2543Smrg   XListPixmapFormats: Test 1
2521706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
2522706f2543Smrg   XRebindKeysym: Test 1
2523706f2543Smrg   XAllowEvents: Tests  20, 21, 24
2524706f2543Smrg   XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
2525706f2543Smrg   XGrabKey: Test 8
2526706f2543Smrg   XSetPointerMapping: Test 3
2527706f2543Smrg   XUngrabButton: Test 4
2528706f2543Smrg
2529706f2543SmrgXdmx with XTEST, with Xinerama, without GLX
2530706f2543Smrg
2531706f2543Smrg   With Xinerama, using the XTEST extension, the following errors
2532706f2543Smrg   were reported from Xdmx:
2533706f2543Smrg
2534706f2543Smrg   XListPixmapFormats: Test 1
2535706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
2536706f2543Smrg   XRebindKeysym: Test 1
2537706f2543Smrg   XAllowEvents: Tests 20, 21, 24
2538706f2543Smrg   XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
2539706f2543Smrg   XGrabKey: Test 8
2540706f2543Smrg   XSetPointerMapping: Test 3
2541706f2543Smrg   XUngrabButton: Test 4
2542706f2543Smrg   XCopyPlane: Tests 13, 22, 31 (well-known XTEST/Xinerama interac
2543706f2543Smrg   tion issue)
2544706f2543Smrg   XDrawLine: Test 67
2545706f2543Smrg   XDrawLines: Test 91
2546706f2543Smrg   XDrawSegments: Test 68
2547706f2543Smrg
2548706f2543Smrg   Note that the first two sets of errors are the same as for the
2549706f2543Smrg   XFree86 4.3.0 server, and that the XCopyPlane error is a
2550706f2543Smrg   well-known error resulting from an XTEST/Xinerama interaction
2551706f2543Smrg   when the request crosses a screen boundary. The XDraw* errors
2552706f2543Smrg   are resolved when the tests are run individually and they do
2553706f2543Smrg   not cross a screen boundary. We will investigate these errors
2554706f2543Smrg   further to determine their cause.
2555706f2543Smrg
2556706f2543SmrgXdmx with XTEST, with Xinerama, with GLX
2557706f2543Smrg
2558706f2543Smrg   With GLX enabled, using the XTEST extension, the following
2559706f2543Smrg   errors were reported from Xdmx (these results are from early
2560706f2543Smrg   during the Phase IV development, but were confirmed with a late
2561706f2543Smrg   Phase IV snapshot):
2562706f2543Smrg
2563706f2543Smrg   XListPixmapFormats: Test 1
2564706f2543Smrg   XChangeKeyboardControl: Tests 9, 10
2565706f2543Smrg   XRebindKeysym: Test 1
2566706f2543Smrg   XAllowEvents: Tests 20, 21, 24
2567706f2543Smrg   XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
2568706f2543Smrg   XGrabKey: Test 8
2569706f2543Smrg   XSetPointerMapping: Test 3
2570706f2543Smrg   XUngrabButton: Test 4
2571706f2543Smrg   XClearArea: Test 8
2572706f2543Smrg   XCopyArea: Tests 4, 5, 11, 14, 17, 23, 25, 27, 30
2573706f2543Smrg   XCopyPlane: Tests 6, 7, 10, 19, 22, 31
2574706f2543Smrg   XDrawArcs: Tests 89, 100, 102
2575706f2543Smrg   XDrawLine: Test 67
2576706f2543Smrg   XDrawSegments: Test 68
2577706f2543Smrg
2578706f2543Smrg   Note that the first two sets of errors are the same as for the
2579706f2543Smrg   XFree86 4.3.0 server, and that the third set has different
2580706f2543Smrg   failures than when Xdmx does not include GLX support. Since the
2581706f2543Smrg   GLX extension adds new visuals to support GLX's visual configs
2582706f2543Smrg   and the X Test Suite runs tests over the entire set of visuals,
2583706f2543Smrg   additional rendering tests were run and presumably more of them
2584706f2543Smrg   crossed a screen boundary. This conclusion is supported by the
2585706f2543Smrg   fact that nearly all of the rendering errors reported are
2586706f2543Smrg   resolved when the tests are run individually and they do no
2587706f2543Smrg   cross a screen boundary.
2588706f2543Smrg
2589706f2543Smrg   Further, when hardware rendering is disabled on the back-end
2590706f2543Smrg   displays, many of the errors in the third set are eliminated,
2591706f2543Smrg   leaving only:
2592706f2543Smrg
2593706f2543Smrg   XClearArea: Test 8
2594706f2543Smrg   XCopyArea: Test 4, 5, 11, 14, 17, 23, 25, 27, 30
2595706f2543Smrg   XCopyPlane: Test 6, 7, 10, 19, 22, 31
2596706f2543Smrg
2597706f2543SmrgConclusion
2598706f2543Smrg
2599706f2543Smrg   We conclude that all of the X Test Suite errors reported for
2600706f2543Smrg   Xdmx are the result of errors in the back-end X server or the
2601706f2543Smrg   Xinerama implementation. Further, all of these errors that can
2602706f2543Smrg   be reasonably fixed at the Xdmx layer have been. (Where
2603706f2543Smrg   appropriate, we have submitted patches to the XFree86 and
2604706f2543Smrg   Xinerama upstream maintainers.)
2605706f2543Smrg
2606706f2543SmrgDynamic Reconfiguration
2607706f2543Smrg
2608706f2543Smrg   During this development phase, dynamic reconfiguration support
2609706f2543Smrg   was added to DMX. This support allows an application to change
2610706f2543Smrg   the position and offset of a back-end server's screen. For
2611706f2543Smrg   example, if the application would like to shift a screen
2612706f2543Smrg   slightly to the left, it could query Xdmx for the screen's
2613706f2543Smrg   <x,y> position and then dynamically reconfigure that screen to
2614706f2543Smrg   be at position <x+10,y>. When a screen is dynamically
2615706f2543Smrg   reconfigured, input handling and a screen's root window
2616706f2543Smrg   dimensions are adjusted as needed. These adjustments are
2617706f2543Smrg   transparent to the user.
2618706f2543Smrg
2619706f2543SmrgDynamic reconfiguration extension
2620706f2543Smrg
2621706f2543Smrg   The application interface to DMX's dynamic reconfiguration is
2622706f2543Smrg   through a function in the DMX extension library:
2623706f2543SmrgBool DMXReconfigureScreen(Display *dpy, int screen, int x, int y)
2624706f2543Smrg
2625706f2543Smrg   where dpy is DMX server's display, screen is the number of the
2626706f2543Smrg   screen to be reconfigured, and x and y are the new upper,
2627706f2543Smrg   left-hand coordinates of the screen to be reconfigured.
2628706f2543Smrg
2629706f2543Smrg   The coordinates are not limited other than as required by the X
2630706f2543Smrg   protocol, which limits all coordinates to a signed 16 bit
2631706f2543Smrg   number. In addition, all coordinates within a screen must also
2632706f2543Smrg   be legal values. Therefore, setting a screen's upper, left-hand
2633706f2543Smrg   coordinates such that the right or bottom edges of the screen
2634706f2543Smrg   is greater than 32,767 is illegal.
2635706f2543Smrg
2636706f2543SmrgBounding box
2637706f2543Smrg
2638706f2543Smrg   When the Xdmx server is started, a bounding box is calculated
2639706f2543Smrg   from the screens' layout given either on the command line or in
2640706f2543Smrg   the configuration file. This bounding box is currently fixed
2641706f2543Smrg   for the lifetime of the Xdmx server.
2642706f2543Smrg
2643706f2543Smrg   While it is possible to move a screen outside of the bounding
2644706f2543Smrg   box, it is currently not possible to change the dimensions of
2645706f2543Smrg   the bounding box. For example, it is possible to specify
2646706f2543Smrg   coordinates of <-100,-100> for the upper, left-hand corner of
2647706f2543Smrg   the bounding box, which was previously at coordinates <0,0>. As
2648706f2543Smrg   expected, the screen is moved down and to the right; however,
2649706f2543Smrg   since the bounding box is fixed, the left side and upper
2650706f2543Smrg   portions of the screen exposed by the reconfiguration are no
2651706f2543Smrg   longer accessible on that screen. Those inaccessible regions
2652706f2543Smrg   are filled with black.
2653706f2543Smrg
2654706f2543Smrg   This fixed bounding box limitation will be addressed in a
2655706f2543Smrg   future development phase.
2656706f2543Smrg
2657706f2543SmrgSample applications
2658706f2543Smrg
2659706f2543Smrg   An example of where this extension is useful is in setting up a
2660706f2543Smrg   video wall. It is not always possible to get everything
2661706f2543Smrg   perfectly aligned, and sometimes the positions are changed
2662706f2543Smrg   (e.g., someone might bump into a projector). Instead of
2663706f2543Smrg   physically moving projectors or monitors, it is now possible to
2664706f2543Smrg   adjust the positions of the back-end server's screens using the
2665706f2543Smrg   dynamic reconfiguration support in DMX.
2666706f2543Smrg
2667706f2543Smrg   Other applications, such as automatic setup and calibration
2668706f2543Smrg   tools, can make use of dynamic reconfiguration to correct for
2669706f2543Smrg   projector alignment problems, as long as the projectors are
2670706f2543Smrg   still arranged rectilinearly. Horizontal and vertical keystone
2671706f2543Smrg   correction could be applied to projectors to correct for
2672706f2543Smrg   non-rectilinear alignment problems; however, this must be done
2673706f2543Smrg   external to Xdmx.
2674706f2543Smrg
2675706f2543Smrg   A sample test program is included in the DMX server's examples
2676706f2543Smrg   directory to demonstrate the interface and how an application
2677706f2543Smrg   might use dynamic reconfiguration. See dmxreconfig.c for
2678706f2543Smrg   details.
2679706f2543Smrg
2680706f2543SmrgAdditional notes
2681706f2543Smrg
2682706f2543Smrg   In the original development plan, Phase IV was primarily
2683706f2543Smrg   devoted to adding OpenGL support to DMX; however, SGI became
2684706f2543Smrg   interested in the DMX project and developed code to support
2685706f2543Smrg   OpenGL/GLX. This code was later donated to the DMX project and
2686706f2543Smrg   integrated into the DMX code base, which freed the DMX
2687706f2543Smrg   developers to concentrate on dynamic reconfiguration (as
2688706f2543Smrg   described above).
2689706f2543Smrg
2690706f2543SmrgDoxygen documentation
2691706f2543Smrg
2692706f2543Smrg   Doxygen is an open-source (GPL) documentation system for
2693706f2543Smrg   generating browseable documentation from stylized comments in
2694706f2543Smrg   the source code. We have placed all of the Xdmx server and DMX
2695706f2543Smrg   protocol source code files under Doxygen so that comprehensive
2696706f2543Smrg   documentation for the Xdmx source code is available in an
2697706f2543Smrg   easily browseable format.
2698706f2543Smrg
2699706f2543SmrgValgrind
2700706f2543Smrg
2701706f2543Smrg   Valgrind, an open-source (GPL) memory debugger for Linux, was
2702706f2543Smrg   used to search for memory management errors. Several memory
2703706f2543Smrg   leaks were detected and repaired. The following errors were not
2704706f2543Smrg   addressed:
2705706f2543Smrg    1. When the X11 transport layer sends a reply to the client,
2706706f2543Smrg       only those fields that are required by the protocol are
2707706f2543Smrg       filled in -- unused fields are left as uninitialized memory
2708706f2543Smrg       and are therefore noted by valgrind. These instances are
2709706f2543Smrg       not errors and were not repaired.
2710706f2543Smrg    2. At each server generation, glxInitVisuals allocates memory
2711706f2543Smrg       that is never freed. The amount of memory lost each
2712706f2543Smrg       generation approximately equal to 128 bytes for each
2713706f2543Smrg       back-end visual. Because the code involved is automatically
2714706f2543Smrg       generated, this bug has not been fixed and will be referred
2715706f2543Smrg       to SGI.
2716706f2543Smrg    3. At each server generation, dmxRealizeFont calls
2717706f2543Smrg       XLoadQueryFont, which allocates a font structure that is
2718706f2543Smrg       not freed. dmxUnrealizeFont can free the font structure for
2719706f2543Smrg       the first screen, but cannot free it for the other screens
2720706f2543Smrg       since they are already closed by the time dmxUnrealizeFont
2721706f2543Smrg       could free them. The amount of memory lost each generation
2722706f2543Smrg       is approximately equal to 80 bytes per font per back-end.
2723706f2543Smrg       When this bug is fixed in the the X server's
2724706f2543Smrg       device-independent (dix) code, DMX will be able to properly
2725706f2543Smrg       free the memory allocated by XLoadQueryFont.
2726706f2543Smrg
2727706f2543SmrgRATS
2728706f2543Smrg
2729706f2543Smrg   RATS (Rough Auditing Tool for Security) is an open-source (GPL)
2730706f2543Smrg   security analysis tool that scans source code for common
2731706f2543Smrg   security-related programming errors (e.g., buffer overflows and
2732706f2543Smrg   TOCTOU races). RATS was used to audit all of the code in the
2733706f2543Smrg   hw/dmx directory and all "High" notations were checked
2734706f2543Smrg   manually. The code was either re-written to eliminate the
2735706f2543Smrg   warning, or a comment containing "RATS" was inserted on the
2736706f2543Smrg   line to indicate that a human had checked the code. Unrepaired
2737706f2543Smrg   warnings are as follows:
2738706f2543Smrg    1. Fixed-size buffers are used in many areas, but code has
2739706f2543Smrg       been added to protect against buffer overflows (e.g.,
2740706f2543Smrg       XmuSnprint). The only instances that have not yet been
2741706f2543Smrg       fixed are in config/xdmxconfig.c (which is not part of the
2742706f2543Smrg       Xdmx server) and input/usb-common.c.
2743706f2543Smrg    2. vprintf and vfprintf are used in the logging routines. In
2744706f2543Smrg       general, all uses of these functions (e.g., dmxLog) provide
2745706f2543Smrg       a constant format string from a trusted source, so the use
2746706f2543Smrg       is relatively benign.
2747706f2543Smrg    3. glxProxy/glxscreens.c uses getenv and strcat. The use of
2748706f2543Smrg       these functions is safe and will remain safe as long as
2749706f2543Smrg       ExtensionsString is longer then GLXServerExtensions
2750706f2543Smrg       (ensuring this may not be ovious to the casual programmer,
2751706f2543Smrg       but this is in automatically generated code, so we hope
2752706f2543Smrg       that the generator enforces this constraint).
2753