xref: /OK3568_Linux_fs/external/xserver/hw/dmx/doc/dmx.xml (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun<?xml version="1.0" encoding="ISO-8859-1"?>
2*4882a593Smuzhiyun<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3*4882a593Smuzhiyun "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
4*4882a593Smuzhiyun <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs;
5*4882a593Smuzhiyun]>
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun<article>
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun  <articleinfo>
10*4882a593Smuzhiyun    <!-- Title information -->
11*4882a593Smuzhiyun    <title>Distributed Multihead X Design</title>
12*4882a593Smuzhiyun    <authorgroup>
13*4882a593Smuzhiyun      <author><firstname>Kevin E.</firstname><surname>Martin</surname></author>
14*4882a593Smuzhiyun      <author><firstname>David H.</firstname><surname>Dawes</surname></author>
15*4882a593Smuzhiyun      <author><firstname>Rickard E.</firstname><surname>Faith</surname></author>
16*4882a593Smuzhiyun    </authorgroup>
17*4882a593Smuzhiyun    <pubdate>29 June 2004 (created 25 July 2001)</pubdate>
18*4882a593Smuzhiyun    <releaseinfo>X Server Version &xserver.version;</releaseinfo>
19*4882a593Smuzhiyun    <abstract><para>
20*4882a593Smuzhiyun        This document covers the motivation, background, design, and
21*4882a593Smuzhiyun        implementation of the distributed multihead X (DMX) system.  It
22*4882a593Smuzhiyun        is a living document and describes the current design and
23*4882a593Smuzhiyun        implementation details of the DMX system.  As the project
24*4882a593Smuzhiyun        progresses, this document will be continually updated to reflect
25*4882a593Smuzhiyun        the changes in the code and/or design.  <emphasis remap="it">Copyright 2001 by VA
26*4882a593Smuzhiyun        Linux Systems, Inc., Fremont, California.  Copyright 2001-2004
27*4882a593Smuzhiyun        by Red Hat, Inc., Raleigh, North Carolina</emphasis>
28*4882a593Smuzhiyun      </para></abstract>
29*4882a593Smuzhiyun  </articleinfo>
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun<!-- Begin the document -->
32*4882a593Smuzhiyun<sect1>
33*4882a593Smuzhiyun<title>Introduction</title>
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun<sect2>
36*4882a593Smuzhiyun<title>The Distributed Multihead X Server</title>
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun<para>Current Open Source multihead solutions are limited to a single
39*4882a593Smuzhiyunphysical machine.  A single X server controls multiple display devices,
40*4882a593Smuzhiyunwhich can be arranged as independent heads or unified into a single
41*4882a593Smuzhiyundesktop (with Xinerama).  These solutions are limited to the number of
42*4882a593Smuzhiyunphysical devices that can co-exist in a single machine (e.g., due to the
43*4882a593Smuzhiyunnumber of AGP/PCI slots available for graphics cards).  Thus, large
44*4882a593Smuzhiyuntiled displays are not currently possible.  The work described in this
45*4882a593Smuzhiyunpaper will eliminate the requirement that the display devices reside in
46*4882a593Smuzhiyunthe same physical machine.  This will be accomplished by developing a
47*4882a593Smuzhiyunfront-end proxy X server that will control multiple back-end X servers
48*4882a593Smuzhiyunthat make up the large display.
49*4882a593Smuzhiyun</para>
50*4882a593Smuzhiyun
51*4882a593Smuzhiyun<para>The overall structure of the distributed multihead X (DMX) project is
52*4882a593Smuzhiyunas follows: A single front-end X server will act as a proxy to a set of
53*4882a593Smuzhiyunback-end X servers, which handle all of the visible rendering.  X
54*4882a593Smuzhiyunclients will connect to the front-end server just as they normally would
55*4882a593Smuzhiyunto a regular X server.  The front-end server will present an abstracted
56*4882a593Smuzhiyunview to the client of a single large display.  This will ensure that all
57*4882a593Smuzhiyunstandard X clients will continue to operate without modification
58*4882a593Smuzhiyun(limited, as always, by the visuals and extensions provided by the X
59*4882a593Smuzhiyunserver).  Clients that are DMX-aware will be able to use an extension to
60*4882a593Smuzhiyunobtain information about the back-end servers (e.g., for placement of
61*4882a593Smuzhiyunpop-up windows, window alignments by the window manager, etc.).
62*4882a593Smuzhiyun</para>
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun<para>The architecture of the DMX server is divided into two main sections:
65*4882a593Smuzhiyuninput (e.g., mouse and keyboard events) and output (e.g., rendering and
66*4882a593Smuzhiyunwindowing requests).  Each of these are describe briefly below, and the
67*4882a593Smuzhiyunrest of this design document will describe them in greater detail.
68*4882a593Smuzhiyun</para>
69*4882a593Smuzhiyun
70*4882a593Smuzhiyun<para>The DMX server can receive input from three general types of input
71*4882a593Smuzhiyundevices: "local" devices that are physically attached to the machine on
72*4882a593Smuzhiyunwhich DMX is running, "backend" devices that are physically attached to
73*4882a593Smuzhiyunone or more of the back-end X servers (and that generate events via the
74*4882a593SmuzhiyunX protocol stream from the backend), and "console" devices that can be
75*4882a593Smuzhiyunabstracted from any non-back-end X server.  Backend and console devices
76*4882a593Smuzhiyunare treated differently because the pointer device on the back-end X
77*4882a593Smuzhiyunserver also controls the location of the hardware X cursor.  Full
78*4882a593Smuzhiyunsupport for XInput extension devices is provided.
79*4882a593Smuzhiyun</para>
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun<para>Rendering requests will be accepted by the front-end server; however,
82*4882a593Smuzhiyunrendering to visible windows will be broken down as needed and sent to
83*4882a593Smuzhiyunthe appropriate back-end server(s) via X11 library calls for actual
84*4882a593Smuzhiyunrendering.  The basic framework will follow a Xnest-style approach.  GC
85*4882a593Smuzhiyunstate will be managed in the front-end server and sent to the
86*4882a593Smuzhiyunappropriate back-end server(s) as required.  Pixmap rendering will (at
87*4882a593Smuzhiyunleast initially) be handled by the front-end X server.  Windowing
88*4882a593Smuzhiyunrequests (e.g., ordering, mapping, moving, etc.) will handled in the
89*4882a593Smuzhiyunfront-end server.  If the request requires a visible change, the
90*4882a593Smuzhiyunwindowing operation will be translated into requests for the appropriate
91*4882a593Smuzhiyunback-end server(s).  Window state will be mirrored in the back-end
92*4882a593Smuzhiyunserver(s) as needed.
93*4882a593Smuzhiyun</para>
94*4882a593Smuzhiyun</sect2>
95*4882a593Smuzhiyun
96*4882a593Smuzhiyun<sect2>
97*4882a593Smuzhiyun<title>Layout of Paper</title>
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun<para>The next section describes the general development plan that was
100*4882a593Smuzhiyunactually used for implementation.  The final section discusses
101*4882a593Smuzhiyunoutstanding issues at the conclusion of development.  The first appendix
102*4882a593Smuzhiyunprovides low-level technical detail that may be of interest to those
103*4882a593Smuzhiyunintimately familiar with the X server architecture.  The final appendix
104*4882a593Smuzhiyundescribes the four phases of development that were performed during the
105*4882a593Smuzhiyunfirst two years of development.
106*4882a593Smuzhiyun</para>
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun<para>The final year of work was divided into 9 tasks that are not
109*4882a593Smuzhiyundescribed in specific sections of this document.  The major tasks during
110*4882a593Smuzhiyunthat time were the enhancement of the reconfiguration ability added in
111*4882a593SmuzhiyunPhase IV, addition of support for a dynamic number of back-end displays
112*4882a593Smuzhiyun(instead of a hard-coded limit), and the support for back-end display
113*4882a593Smuzhiyunand input removal and addition.  This work is mentioned in this paper,
114*4882a593Smuzhiyunbut is not covered in detail.
115*4882a593Smuzhiyun</para>
116*4882a593Smuzhiyun</sect2>
117*4882a593Smuzhiyun</sect1>
118*4882a593Smuzhiyun
119*4882a593Smuzhiyun<!-- ============================================================ -->
120*4882a593Smuzhiyun<sect1>
121*4882a593Smuzhiyun<title>Development plan</title>
122*4882a593Smuzhiyun
123*4882a593Smuzhiyun<para>This section describes the development plan from approximately June
124*4882a593Smuzhiyun2001 through July 2003.
125*4882a593Smuzhiyun</para>
126*4882a593Smuzhiyun
127*4882a593Smuzhiyun<sect2>
128*4882a593Smuzhiyun<title>Bootstrap code</title>
129*4882a593Smuzhiyun
130*4882a593Smuzhiyun<para>To allow for rapid development of the DMX server by multiple
131*4882a593Smuzhiyundevelopers during the first development stage, the problem will be
132*4882a593Smuzhiyunbroken down into three tasks: the overall DMX framework, back-end
133*4882a593Smuzhiyunrendering services and input device handling services.  However, before
134*4882a593Smuzhiyunthe work begins on these tasks, a simple framework that each developer
135*4882a593Smuzhiyuncould use was implemented to bootstrap the development effort.  This
136*4882a593Smuzhiyunframework renders to a single back-end server and provides dummy input
137*4882a593Smuzhiyundevices (i.e., the keyboard and mouse).  The simple back-end rendering
138*4882a593Smuzhiyunservice was implemented using the shadow framebuffer support currently
139*4882a593Smuzhiyunavailable in the XFree86 environment.
140*4882a593Smuzhiyun</para>
141*4882a593Smuzhiyun
142*4882a593Smuzhiyun<para>Using this bootstrapping framework, each developer has been able to
143*4882a593Smuzhiyunwork on each of the tasks listed above independently as follows: the
144*4882a593Smuzhiyunframework will be extended to handle arbitrary back-end server
145*4882a593Smuzhiyunconfigurations; the back-end rendering services will be transitioned to
146*4882a593Smuzhiyunthe more efficient Xnest-style implementation; and, an input device
147*4882a593Smuzhiyunframework to handle various input devices via the input extension will
148*4882a593Smuzhiyunbe developed.
149*4882a593Smuzhiyun</para>
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun<para>Status: The boot strap code is complete.   <!-- August 2001 -->
152*4882a593Smuzhiyun</para>
153*4882a593Smuzhiyun
154*4882a593Smuzhiyun</sect2>
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun<sect2>
157*4882a593Smuzhiyun<title>Input device handling</title>
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun<para>An X server (including the front-end X server) requires two core
160*4882a593Smuzhiyuninput devices -- a keyboard and a pointer (mouse).  These core devices
161*4882a593Smuzhiyunare handled and required by the core X11 protocol.  Additional types of
162*4882a593Smuzhiyuninput devices may be attached and utilized via the XInput extension.
163*4882a593SmuzhiyunThese are usually referred to as ``XInput extension devices'',
164*4882a593Smuzhiyun</para>
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun<para>There are some options as to how the front-end X server gets its core
167*4882a593Smuzhiyuninput devices:
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun<orderedlist>
170*4882a593Smuzhiyun<listitem>
171*4882a593Smuzhiyun    <para>Local Input. The physical input devices (e.g., keyboard and
172*4882a593Smuzhiyun    mouse) can be attached directly to the front-end X server.  In this
173*4882a593Smuzhiyun    case, the keyboard and mouse on the machine running the front-end X
174*4882a593Smuzhiyun    server will be used.  The front-end will have drivers to read the
175*4882a593Smuzhiyun    raw input from those devices and convert it into the required X
176*4882a593Smuzhiyun    input events (e.g., key press/release, pointer button press/release,
177*4882a593Smuzhiyun    pointer motion).  The front-end keyboard driver will keep track of
178*4882a593Smuzhiyun    keyboard properties such as key and modifier mappings, autorepeat
179*4882a593Smuzhiyun    state, keyboard sound and led state.  Similarly the front-end
180*4882a593Smuzhiyun    pointer driver will keep track if pointer properties such as the
181*4882a593Smuzhiyun    button mapping and movement acceleration parameters.  With this
182*4882a593Smuzhiyun    option, input is handled fully in the front-end X server, and the
183*4882a593Smuzhiyun    back-end X servers are used in a display-only mode.  This option was
184*4882a593Smuzhiyun    implemented and works for a limited number of Linux-specific
185*4882a593Smuzhiyun    devices.  Adding additional local input devices for other
186*4882a593Smuzhiyun    architectures is expected to be relatively simple.
187*4882a593Smuzhiyun</para>
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun    <para>The following options are available for implementing local input
190*4882a593Smuzhiyun    devices:
191*4882a593Smuzhiyun
192*4882a593Smuzhiyun<orderedlist>
193*4882a593Smuzhiyun<listitem>
194*4882a593Smuzhiyun        <para>The XFree86 X server has modular input drivers that could
195*4882a593Smuzhiyun        be adapted for this purpose.  The mouse driver supports a wide
196*4882a593Smuzhiyun        range of mouse types and interfaces, as well as a range of
197*4882a593Smuzhiyun        Operating System platforms.  The keyboard driver in XFree86 is
198*4882a593Smuzhiyun        not currently as modular as the mouse driver, but could be made
199*4882a593Smuzhiyun        so.  The XFree86 X server also has a range of other input
200*4882a593Smuzhiyun        drivers for extended input devices such as tablets and touch
201*4882a593Smuzhiyun        screens.  Unfortunately, the XFree86 drivers are generally
202*4882a593Smuzhiyun        complex, often simultaneously providing support for multiple
203*4882a593Smuzhiyun        devices across multiple architectures; and rely so heavily on
204*4882a593Smuzhiyun        XFree86-specific helper-functions, that this option was not
205*4882a593Smuzhiyun        pursued.
206*4882a593Smuzhiyun</para>
207*4882a593Smuzhiyun</listitem>
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun<listitem>
210*4882a593Smuzhiyun        <para>The <command>kdrive</command> X server in XFree86 has built-in drivers that
211*4882a593Smuzhiyun        support PS/2 mice and keyboard under Linux.  The mouse driver
212*4882a593Smuzhiyun        can indirectly handle other mouse types if the Linux utility
213*4882a593Smuzhiyun        <command>gpm</command> is used as to translate the native mouse protocol into
214*4882a593Smuzhiyun        PS/2 mouse format.  These drivers could be adapted and built in
215*4882a593Smuzhiyun        to the front-end X server if this range of hardware and OS
216*4882a593Smuzhiyun        support is sufficient.  While much simpler than the XFree86
217*4882a593Smuzhiyun        drivers, the <command>kdrive</command> drivers were not used for the DMX
218*4882a593Smuzhiyun        implementation.
219*4882a593Smuzhiyun</para>
220*4882a593Smuzhiyun</listitem>
221*4882a593Smuzhiyun
222*4882a593Smuzhiyun<listitem>
223*4882a593Smuzhiyun        <para>Reimplementation of keyboard and mouse drivers from
224*4882a593Smuzhiyun        scratch for the DMX framework.  Because keyboard and mouse
225*4882a593Smuzhiyun        drivers are relatively trivial to implement, this pathway was
226*4882a593Smuzhiyun        selected.  Other drivers in the X source tree were referenced,
227*4882a593Smuzhiyun        and significant contributions from other drivers are noted in
228*4882a593Smuzhiyun        the DMX source code.
229*4882a593Smuzhiyun</para>
230*4882a593Smuzhiyun</listitem>
231*4882a593Smuzhiyun</orderedlist>
232*4882a593Smuzhiyun</para>
233*4882a593Smuzhiyun</listitem>
234*4882a593Smuzhiyun
235*4882a593Smuzhiyun<listitem>
236*4882a593Smuzhiyun    <para>Backend Input.  The front-end can make use of the core input
237*4882a593Smuzhiyun    devices attached to one or more of the back-end X servers.  Core
238*4882a593Smuzhiyun    input events from multiple back-ends are merged into a single input
239*4882a593Smuzhiyun    event stream.  This can work sanely when only a single set of input
240*4882a593Smuzhiyun    devices is used at any given time.  The keyboard and pointer state
241*4882a593Smuzhiyun    will be handled in the front-end, with changes propagated to the
242*4882a593Smuzhiyun    back-end servers as needed.  This option was implemented and works
243*4882a593Smuzhiyun    well.  Because the core pointer on a back-end controls the hardware
244*4882a593Smuzhiyun    mouse on that back-end, core pointers cannot be treated as XInput
245*4882a593Smuzhiyun    extension devices.  However, all back-end XInput extensions devices
246*4882a593Smuzhiyun    can be mapped to either DMX core or DMX XInput extension devices.
247*4882a593Smuzhiyun</para>
248*4882a593Smuzhiyun</listitem>
249*4882a593Smuzhiyun
250*4882a593Smuzhiyun<listitem>
251*4882a593Smuzhiyun    <para>Console Input.  The front-end server could create a console
252*4882a593Smuzhiyun    window that is displayed on an X server independent of the back-end
253*4882a593Smuzhiyun    X servers.  This console window could display things like the
254*4882a593Smuzhiyun    physical screen layout, and the front-end could get its core input
255*4882a593Smuzhiyun    events from events delivered to the console window.  This option was
256*4882a593Smuzhiyun    implemented and works well.  To help the human navigate, window
257*4882a593Smuzhiyun    outlines are also displayed in the console window.  Further, console
258*4882a593Smuzhiyun    windows can be used as either core or XInput extension devices.
259*4882a593Smuzhiyun</para>
260*4882a593Smuzhiyun</listitem>
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun<listitem>
263*4882a593Smuzhiyun    <para>Other options were initially explored, but they were all
264*4882a593Smuzhiyun    partial subsets of the options listed above and, hence, are
265*4882a593Smuzhiyun    irrelevant.
266*4882a593Smuzhiyun</para>
267*4882a593Smuzhiyun</listitem>
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun</orderedlist>
270*4882a593Smuzhiyun</para>
271*4882a593Smuzhiyun
272*4882a593Smuzhiyun<para>Although extended input devices are not specifically mentioned in the
273*4882a593SmuzhiyunDistributed X requirements, the options above were all implemented so
274*4882a593Smuzhiyunthat XInput extension devices were supported.
275*4882a593Smuzhiyun</para>
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun<para>The bootstrap code (Xdmx) had dummy input devices, and these are
278*4882a593Smuzhiyunstill supported in the final version.  These do the necessary
279*4882a593Smuzhiyuninitialization to satisfy the X server's requirements for core pointer
280*4882a593Smuzhiyunand keyboard devices, but no input events are ever generated.
281*4882a593Smuzhiyun</para>
282*4882a593Smuzhiyun
283*4882a593Smuzhiyun<para>Status: The input code is complete.  Because of the complexity of the
284*4882a593SmuzhiyunXFree86 input device drivers (and their heavy reliance on XFree86
285*4882a593Smuzhiyuninfrastructure), separate low-level device drivers were implemented for
286*4882a593SmuzhiyunXdmx.  The following kinds of drivers are supported (in general, the
287*4882a593Smuzhiyundevices can be treated arbitrarily as "core" input devices or as XInput
288*4882a593Smuzhiyun"extension" devices; and multiple instances of different kinds of
289*4882a593Smuzhiyundevices can be simultaneously available):
290*4882a593Smuzhiyun<orderedlist>
291*4882a593Smuzhiyun<listitem>
292*4882a593Smuzhiyun        <para> A "dummy" device drive that never generates events.
293*4882a593Smuzhiyun</para>
294*4882a593Smuzhiyun</listitem>
295*4882a593Smuzhiyun
296*4882a593Smuzhiyun<listitem>
297*4882a593Smuzhiyun        <para> "Local" input is from the low-level hardware on which the
298*4882a593Smuzhiyun        Xdmx binary is running.  This is the only area where using the
299*4882a593Smuzhiyun        XFree86 driver infrastructure would have been helpful, and then
300*4882a593Smuzhiyun        only partially, since good support for generic USB devices does
301*4882a593Smuzhiyun        not yet exist in XFree86 (in any case, XFree86 and kdrive driver
302*4882a593Smuzhiyun        code was used where possible).  Currently, the following local
303*4882a593Smuzhiyun        devices are supported under Linux (porting to other operating
304*4882a593Smuzhiyun        systems should be fairly straightforward):
305*4882a593Smuzhiyun        <itemizedlist>
306*4882a593Smuzhiyun            <listitem><para>Linux keyboard</para></listitem>
307*4882a593Smuzhiyun            <listitem><para>Linux serial mouse (MS)</para></listitem>
308*4882a593Smuzhiyun            <listitem><para>Linux PS/2 mouse</para></listitem>
309*4882a593Smuzhiyun            <listitem><para>USB keyboard</para></listitem>
310*4882a593Smuzhiyun            <listitem><para>USB mouse</para></listitem>
311*4882a593Smuzhiyun            <listitem><para>USB generic device (e.g., joystick, gamepad, etc.)</para></listitem>
312*4882a593Smuzhiyun        </itemizedlist>
313*4882a593Smuzhiyun</para>
314*4882a593Smuzhiyun</listitem>
315*4882a593Smuzhiyun
316*4882a593Smuzhiyun<listitem>
317*4882a593Smuzhiyun        <para> "Backend" input is taken from one or more of the back-end
318*4882a593Smuzhiyun        displays.  In this case, events are taken from the back-end X
319*4882a593Smuzhiyun        server and are converted to Xdmx events.  Care must be taken so
320*4882a593Smuzhiyun        that the sprite moves properly on the display from which input
321*4882a593Smuzhiyun        is being taken.
322*4882a593Smuzhiyun</para>
323*4882a593Smuzhiyun</listitem>
324*4882a593Smuzhiyun
325*4882a593Smuzhiyun<listitem>
326*4882a593Smuzhiyun        <para> "Console" input is taken from an X window that Xdmx
327*4882a593Smuzhiyun        creates on the operator's display (i.e., on the machine running
328*4882a593Smuzhiyun        the Xdmx binary).  When the operator's mouse is inside the
329*4882a593Smuzhiyun        console window, then those events are converted to Xdmx events.
330*4882a593Smuzhiyun        Several special features are available: the console can display
331*4882a593Smuzhiyun        outlines of windows that are on the Xdmx display (to facilitate
332*4882a593Smuzhiyun        navigation), the cursor can be confined to the console, and a
333*4882a593Smuzhiyun        "fine" mode can be activated to allow very precise cursor
334*4882a593Smuzhiyun        positioning.
335*4882a593Smuzhiyun</para>
336*4882a593Smuzhiyun</listitem>
337*4882a593Smuzhiyun</orderedlist>
338*4882a593Smuzhiyun
339*4882a593Smuzhiyun</para>
340*4882a593Smuzhiyun
341*4882a593Smuzhiyun</sect2>
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun<!-- May 2002; July 2003 -->
344*4882a593Smuzhiyun
345*4882a593Smuzhiyun<sect2>
346*4882a593Smuzhiyun<title>Output device handling</title>
347*4882a593Smuzhiyun
348*4882a593Smuzhiyun<para>The output of the DMX system displays rendering and windowing
349*4882a593Smuzhiyunrequests across multiple screens.  The screens are typically arranged in
350*4882a593Smuzhiyuna grid such that together they represent a single large display.
351*4882a593Smuzhiyun</para>
352*4882a593Smuzhiyun
353*4882a593Smuzhiyun<para>The output section of the DMX code consists of two parts.  The first
354*4882a593Smuzhiyunis in the front-end proxy X server (Xdmx), which accepts client
355*4882a593Smuzhiyunconnections, manages the windows, and potentially renders primitives but
356*4882a593Smuzhiyundoes not actually display any of the drawing primitives.  The second
357*4882a593Smuzhiyunpart is the back-end X server(s), which accept commands from the
358*4882a593Smuzhiyunfront-end server and display the results on their screens.
359*4882a593Smuzhiyun</para>
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun<sect3>
362*4882a593Smuzhiyun<title>Initialization</title>
363*4882a593Smuzhiyun
364*4882a593Smuzhiyun<para>The DMX front-end must first initialize its screens by connecting to
365*4882a593Smuzhiyuneach of the back-end X servers and collecting information about each of
366*4882a593Smuzhiyunthese screens.  However, the information collected from the back-end X
367*4882a593Smuzhiyunservers might be inconsistent.  Handling these cases can be difficult
368*4882a593Smuzhiyunand/or inefficient.  For example, a two screen system has one back-end X
369*4882a593Smuzhiyunserver running at 16bpp while the second is running at 32bpp.
370*4882a593SmuzhiyunConverting rendering requests (e.g., XPutImage() or XGetImage()
371*4882a593Smuzhiyunrequests) to the appropriate bit depth can be very time consuming.
372*4882a593SmuzhiyunAnalyzing these cases to determine how or even if it is possible to
373*4882a593Smuzhiyunhandle them is required.  The current Xinerama code handles many of
374*4882a593Smuzhiyunthese cases (e.g., in PanoramiXConsolidate()) and will be used as a
375*4882a593Smuzhiyunstarting point.  In general, the best solution is to use homogeneous X
376*4882a593Smuzhiyunservers and display devices.  Using back-end servers with the same depth
377*4882a593Smuzhiyunis a requirement of the final DMX implementation.
378*4882a593Smuzhiyun</para>
379*4882a593Smuzhiyun
380*4882a593Smuzhiyun<para>Once this screen consolidation is finished, the relative position of
381*4882a593Smuzhiyuneach back-end X server's screen in the unified screen is initialized.  A
382*4882a593Smuzhiyunfull-screen window is opened on each of the back-end X servers, and the
383*4882a593Smuzhiyuncursor on each screen is turned off.  The final DMX implementation can
384*4882a593Smuzhiyunalso make use of a partial-screen window, or multiple windows per
385*4882a593Smuzhiyunback-end screen.
386*4882a593Smuzhiyun</para>
387*4882a593Smuzhiyun</sect3>
388*4882a593Smuzhiyun
389*4882a593Smuzhiyun<sect3>
390*4882a593Smuzhiyun<title>Handling rendering requests</title>
391*4882a593Smuzhiyun
392*4882a593Smuzhiyun<para>After initialization, X applications connect to the front-end server.
393*4882a593SmuzhiyunThere are two possible implementations of how rendering and windowing
394*4882a593Smuzhiyunrequests are handled in the DMX system:
395*4882a593Smuzhiyun
396*4882a593Smuzhiyun<orderedlist>
397*4882a593Smuzhiyun<listitem>
398*4882a593Smuzhiyun    <para>A shadow framebuffer is used in the front-end server as the
399*4882a593Smuzhiyun    render target.  In this option, all protocol requests are completely
400*4882a593Smuzhiyun    handled in the front-end server.  All state and resources are
401*4882a593Smuzhiyun    maintained in the front-end including a shadow copy of the entire
402*4882a593Smuzhiyun    framebuffer.  The framebuffers attached to the back-end servers are
403*4882a593Smuzhiyun    updated by XPutImage() calls with data taken directly from the
404*4882a593Smuzhiyun    shadow framebuffer.
405*4882a593Smuzhiyun</para>
406*4882a593Smuzhiyun
407*4882a593Smuzhiyun    <para>This solution suffers from two main problems.  First, it does not
408*4882a593Smuzhiyun    take advantage of any accelerated hardware available in the system.
409*4882a593Smuzhiyun    Second, the size of the XPutImage() calls can be quite large and
410*4882a593Smuzhiyun    thus will be limited by the bandwidth available.
411*4882a593Smuzhiyun</para>
412*4882a593Smuzhiyun
413*4882a593Smuzhiyun    <para>The initial DMX implementation used a shadow framebuffer by
414*4882a593Smuzhiyun    default.
415*4882a593Smuzhiyun</para>
416*4882a593Smuzhiyun</listitem>
417*4882a593Smuzhiyun
418*4882a593Smuzhiyun<listitem>
419*4882a593Smuzhiyun    <para>Rendering requests are sent to each back-end server for
420*4882a593Smuzhiyun    handling (as is done in the Xnest server described above).  In this
421*4882a593Smuzhiyun    option, certain protocol requests are handled in the front-end
422*4882a593Smuzhiyun    server and certain requests are repackaged and then sent to the
423*4882a593Smuzhiyun    back-end servers.  The framebuffer is distributed across the
424*4882a593Smuzhiyun    multiple back-end servers.  Rendering to the framebuffer is handled
425*4882a593Smuzhiyun    on each back-end and can take advantage of any acceleration
426*4882a593Smuzhiyun    available on the back-end servers' graphics display device.  State
427*4882a593Smuzhiyun    is maintained both in the front and back-end servers.
428*4882a593Smuzhiyun</para>
429*4882a593Smuzhiyun
430*4882a593Smuzhiyun    <para>This solution suffers from two main drawbacks.  First, protocol
431*4882a593Smuzhiyun    requests are sent to all back-end servers -- even those that will
432*4882a593Smuzhiyun    completely clip the rendering primitive -- which wastes bandwidth
433*4882a593Smuzhiyun    and processing time.  Second, state is maintained both in the front-
434*4882a593Smuzhiyun    and back-end servers.  These drawbacks are not as severe as in
435*4882a593Smuzhiyun    option 1 (above) and can either be overcome through optimizations or
436*4882a593Smuzhiyun    are acceptable.  Therefore, this option will be used in the final
437*4882a593Smuzhiyun    implementation.
438*4882a593Smuzhiyun</para>
439*4882a593Smuzhiyun
440*4882a593Smuzhiyun    <para>The final DMX implementation defaults to this mechanism, but also
441*4882a593Smuzhiyun    supports the shadow framebuffer mechanism.  Several optimizations
442*4882a593Smuzhiyun    were implemented to eliminate the drawbacks of the default
443*4882a593Smuzhiyun    mechanism.  These optimizations are described the section below and
444*4882a593Smuzhiyun    in Phase II of the Development Results (see appendix).
445*4882a593Smuzhiyun</para>
446*4882a593Smuzhiyun</listitem>
447*4882a593Smuzhiyun
448*4882a593Smuzhiyun</orderedlist>
449*4882a593Smuzhiyun</para>
450*4882a593Smuzhiyun
451*4882a593Smuzhiyun<para>Status: Both the shadow framebuffer and Xnest-style code is complete.
452*4882a593Smuzhiyun<!-- May 2002 -->
453*4882a593Smuzhiyun</para>
454*4882a593Smuzhiyun
455*4882a593Smuzhiyun</sect3>
456*4882a593Smuzhiyun</sect2>
457*4882a593Smuzhiyun
458*4882a593Smuzhiyun<sect2>
459*4882a593Smuzhiyun<title>Optimizing DMX</title>
460*4882a593Smuzhiyun
461*4882a593Smuzhiyun<para>Initially, the Xnest-style solution's performance will be measured
462*4882a593Smuzhiyunand analyzed to determine where the performance bottlenecks exist.
463*4882a593SmuzhiyunThere are four main areas that will be addressed.
464*4882a593Smuzhiyun</para>
465*4882a593Smuzhiyun
466*4882a593Smuzhiyun<para>First, to obtain reasonable interactivity with the first development
467*4882a593Smuzhiyunphase, XSync() was called after each protocol request.  The XSync()
468*4882a593Smuzhiyunfunction flushes any pending protocol requests.  It then waits for the
469*4882a593Smuzhiyunback-end to process the request and send a reply that the request has
470*4882a593Smuzhiyuncompleted.  This happens with each back-end server and performance
471*4882a593Smuzhiyungreatly suffers.  As a result of the way XSync() is called in the first
472*4882a593Smuzhiyundevelopment phase, the batching that the X11 library performs is
473*4882a593Smuzhiyuneffectively defeated.  The XSync() call usage will be analyzed and
474*4882a593Smuzhiyunoptimized by batching calls and performing them at regular intervals,
475*4882a593Smuzhiyunexcept where interactivity will suffer (e.g., on cursor movements).
476*4882a593Smuzhiyun</para>
477*4882a593Smuzhiyun
478*4882a593Smuzhiyun<para>Second, the initial Xnest-style solution described above sends the
479*4882a593Smuzhiyunrepackaged protocol requests to all back-end servers regardless of
480*4882a593Smuzhiyunwhether or not they would be completely clipped out.  The requests that
481*4882a593Smuzhiyunare trivially rejected on the back-end server wastes the limited
482*4882a593Smuzhiyunbandwidth available.  By tracking clipping changes in the DMX X server's
483*4882a593Smuzhiyunwindowing code (e.g., by opening, closing, moving or resizing windows),
484*4882a593Smuzhiyunwe can determine whether or not back-end windows are visible so that
485*4882a593Smuzhiyuntrivial tests in the front-end server's GC ops drawing functions can
486*4882a593Smuzhiyuneliminate these unnecessary protocol requests.
487*4882a593Smuzhiyun</para>
488*4882a593Smuzhiyun
489*4882a593Smuzhiyun<para>Third, each protocol request will be analyzed to determine if it is
490*4882a593Smuzhiyunpossible to break the request into smaller pieces at display boundaries.
491*4882a593SmuzhiyunThe initial ones to be analyzed are put and get image requests since
492*4882a593Smuzhiyunthey will require the greatest bandwidth to transmit data between the
493*4882a593Smuzhiyunfront and back-end servers.  Other protocol requests will be analyzed
494*4882a593Smuzhiyunand those that will benefit from breaking them into smaller requests
495*4882a593Smuzhiyunwill be implemented.
496*4882a593Smuzhiyun</para>
497*4882a593Smuzhiyun
498*4882a593Smuzhiyun<para>Fourth, an extension is being considered that will allow font glyphs to
499*4882a593Smuzhiyunbe transferred from the front-end DMX X server to each back-end server.
500*4882a593SmuzhiyunThis extension will permit the front-end to handle all font requests and
501*4882a593Smuzhiyuneliminate the requirement that all back-end X servers share the exact
502*4882a593Smuzhiyunsame fonts as the front-end server.  We are investigating the
503*4882a593Smuzhiyunfeasibility of this extension during this development phase.
504*4882a593Smuzhiyun</para>
505*4882a593Smuzhiyun
506*4882a593Smuzhiyun<para>Other potential optimizations will be determined from the performance
507*4882a593Smuzhiyunanalysis.
508*4882a593Smuzhiyun</para>
509*4882a593Smuzhiyun
510*4882a593Smuzhiyun<para>Please note that in our initial design, we proposed optimizing BLT
511*4882a593Smuzhiyunoperations (e.g., XCopyArea() and window moves) by developing an
512*4882a593Smuzhiyunextension that would allow individual back-end servers to directly copy
513*4882a593Smuzhiyunpixel data to other back-end servers.  This potential optimization was
514*4882a593Smuzhiyunin response to the simple image movement implementation that required
515*4882a593Smuzhiyunpotentially many calls to GetImage() and PutImage().  However, the
516*4882a593Smuzhiyuncurrent Xinerama implementation handles these BLT operations
517*4882a593Smuzhiyundifferently.  Instead of copying data to and from screens, they generate
518*4882a593Smuzhiyunexpose events -- just as happens in the case when a window is moved from
519*4882a593Smuzhiyunoff a screen to on screen.  This approach saves the limited bandwidth
520*4882a593Smuzhiyunavailable between front and back-end servers and is being standardized
521*4882a593Smuzhiyunwith Xinerama.  It also eliminates the potential setup problems and
522*4882a593Smuzhiyunsecurity issues resulting from having each back-end server open
523*4882a593Smuzhiyunconnections to all other back-end servers.  Therefore, we suggest
524*4882a593Smuzhiyunaccepting Xinerama's expose event solution.
525*4882a593Smuzhiyun</para>
526*4882a593Smuzhiyun
527*4882a593Smuzhiyun<para>Also note that the approach proposed in the second and third
528*4882a593Smuzhiyunoptimizations might cause backing store algorithms in the back-end to be
529*4882a593Smuzhiyundefeated, so a DMX X server configuration flag will be added to disable
530*4882a593Smuzhiyunthese optimizations.
531*4882a593Smuzhiyun</para>
532*4882a593Smuzhiyun
533*4882a593Smuzhiyun<para>Status: The optimizations proposed above are complete.  It was
534*4882a593Smuzhiyundetermined that the using the xfs font server was sufficient and
535*4882a593Smuzhiyuncreating a new mechanism to pass glyphs was redundant; therefore, the
536*4882a593Smuzhiyunfourth optimization proposed above was not included in DMX.
537*4882a593Smuzhiyun<!-- September 2002 -->
538*4882a593Smuzhiyun</para>
539*4882a593Smuzhiyun
540*4882a593Smuzhiyun</sect2>
541*4882a593Smuzhiyun
542*4882a593Smuzhiyun<sect2>
543*4882a593Smuzhiyun<title>DMX X extension support</title>
544*4882a593Smuzhiyun
545*4882a593Smuzhiyun<para>The DMX X server keeps track of all the windowing information on the
546*4882a593Smuzhiyunback-end X servers, but does not currently export this information to
547*4882a593Smuzhiyunany client applications.  An extension will be developed to pass the
548*4882a593Smuzhiyunscreen information and back-end window IDs to DMX-aware clients.  These
549*4882a593Smuzhiyunclients can then use this information to directly connect to and render
550*4882a593Smuzhiyunto the back-end windows.  Bypassing the DMX X server allows DMX-aware
551*4882a593Smuzhiyunclients to break up complex rendering requests on their own and send
552*4882a593Smuzhiyunthem directly to the windows on the back-end server's screens.  An
553*4882a593Smuzhiyunexample of a client that can make effective use of this extension is
554*4882a593SmuzhiyunChromium.
555*4882a593Smuzhiyun</para>
556*4882a593Smuzhiyun
557*4882a593Smuzhiyun<para>Status: The extension, as implemented, is fully documented in
558*4882a593Smuzhiyun"Client-to-Server DMX Extension to the X Protocol".  Future changes
559*4882a593Smuzhiyunmight be required based on feedback and other proposed enhancements to
560*4882a593SmuzhiyunDMX.  Currently, the following facilities are supported:
561*4882a593Smuzhiyun<orderedlist>
562*4882a593Smuzhiyun<listitem><para>
563*4882a593Smuzhiyun        Screen information (clipping rectangle for each screen relative
564*4882a593Smuzhiyun        to the virtual screen)
565*4882a593Smuzhiyun</para></listitem>
566*4882a593Smuzhiyun<listitem><para>
567*4882a593Smuzhiyun        Window information (window IDs and clipping information for each
568*4882a593Smuzhiyun        back-end window that corresponds to each DMX window)
569*4882a593Smuzhiyun</para></listitem>
570*4882a593Smuzhiyun<listitem><para>
571*4882a593Smuzhiyun        Input device information (mappings from DMX device IDs to
572*4882a593Smuzhiyun        back-end device IDs)
573*4882a593Smuzhiyun</para></listitem>
574*4882a593Smuzhiyun<listitem><para>
575*4882a593Smuzhiyun        Force window creation (so that a client can override the
576*4882a593Smuzhiyun        server-side lazy window creation optimization)
577*4882a593Smuzhiyun</para></listitem>
578*4882a593Smuzhiyun<listitem><para>
579*4882a593Smuzhiyun        Reconfiguration (so that a client can request that a screen
580*4882a593Smuzhiyun        position be changed)
581*4882a593Smuzhiyun</para></listitem>
582*4882a593Smuzhiyun<listitem><para>
583*4882a593Smuzhiyun        Addition and removal of back-end servers and back-end and
584*4882a593Smuzhiyun        console inputs.
585*4882a593Smuzhiyun</para></listitem>
586*4882a593Smuzhiyun</orderedlist>
587*4882a593Smuzhiyun</para>
588*4882a593Smuzhiyun<!-- September 2002; July 2003 -->
589*4882a593Smuzhiyun
590*4882a593Smuzhiyun</sect2>
591*4882a593Smuzhiyun
592*4882a593Smuzhiyun<sect2>
593*4882a593Smuzhiyun<title>Common X extension support</title>
594*4882a593Smuzhiyun
595*4882a593Smuzhiyun<para>The XInput, XKeyboard and Shape extensions are commonly used
596*4882a593Smuzhiyunextensions to the base X11 protocol.  XInput allows multiple and
597*4882a593Smuzhiyunnon-standard input devices to be accessed simultaneously.  These input
598*4882a593Smuzhiyundevices can be connected to either the front-end or back-end servers.
599*4882a593SmuzhiyunXKeyboard allows much better keyboard mappings control.  Shape adds
600*4882a593Smuzhiyunsupport for arbitrarily shaped windows and is used by various window
601*4882a593Smuzhiyunmanagers.  Nearly all potential back-end X servers make these extensions
602*4882a593Smuzhiyunavailable, and support for each one will be added to the DMX system.
603*4882a593Smuzhiyun</para>
604*4882a593Smuzhiyun
605*4882a593Smuzhiyun<para>In addition to the extensions listed above, support for the X
606*4882a593SmuzhiyunRendering extension (Render) is being developed.  Render adds digital
607*4882a593Smuzhiyunimage composition to the rendering model used by the X Window System.
608*4882a593SmuzhiyunWhile this extension is still under development by Keith Packard of HP,
609*4882a593Smuzhiyunsupport for the current version will be added to the DMX system.
610*4882a593Smuzhiyun</para>
611*4882a593Smuzhiyun
612*4882a593Smuzhiyun<para>Support for the XTest extension was added during the first
613*4882a593Smuzhiyundevelopment phase.
614*4882a593Smuzhiyun</para>
615*4882a593Smuzhiyun
616*4882a593Smuzhiyun<!-- WARNING: this list is duplicated in the Phase IV discussion -->
617*4882a593Smuzhiyun<para>Status: The following extensions are supported and are discussed in
618*4882a593Smuzhiyunmore detail in Phase IV of the Development Results (see appendix):
619*4882a593Smuzhiyun    BIG-REQUESTS,
620*4882a593Smuzhiyun    DEC-XTRAP,
621*4882a593Smuzhiyun    DMX,
622*4882a593Smuzhiyun    DPMS,
623*4882a593Smuzhiyun    Extended-Visual-Information,
624*4882a593Smuzhiyun    GLX,
625*4882a593Smuzhiyun    LBX,
626*4882a593Smuzhiyun    RECORD,
627*4882a593Smuzhiyun    RENDER,
628*4882a593Smuzhiyun    SECURITY,
629*4882a593Smuzhiyun    SHAPE,
630*4882a593Smuzhiyun    SYNC,
631*4882a593Smuzhiyun    X-Resource,
632*4882a593Smuzhiyun    XC-APPGROUP,
633*4882a593Smuzhiyun    XC-MISC,
634*4882a593Smuzhiyun    XFree86-Bigfont,
635*4882a593Smuzhiyun    XINERAMA,
636*4882a593Smuzhiyun    XInputExtension,
637*4882a593Smuzhiyun    XKEYBOARD, and
638*4882a593Smuzhiyun    XTEST.
639*4882a593Smuzhiyun<!-- November 2002; updated February 2003, July 2003 -->
640*4882a593Smuzhiyun</para>
641*4882a593Smuzhiyun</sect2>
642*4882a593Smuzhiyun
643*4882a593Smuzhiyun<sect2>
644*4882a593Smuzhiyun<title>OpenGL support</title>
645*4882a593Smuzhiyun
646*4882a593Smuzhiyun<para>OpenGL support using the Mesa code base exists in XFree86 release 4
647*4882a593Smuzhiyunand later.  Currently, the direct rendering infrastructure (DRI)
648*4882a593Smuzhiyunprovides accelerated OpenGL support for local clients and unaccelerated
649*4882a593SmuzhiyunOpenGL support (i.e., software rendering) is provided for non-local
650*4882a593Smuzhiyunclients.
651*4882a593Smuzhiyun</para>
652*4882a593Smuzhiyun
653*4882a593Smuzhiyun<para>The single head OpenGL support in XFree86 4.x will be extended to use
654*4882a593Smuzhiyunthe DMX system.  When the front and back-end servers are on the same
655*4882a593Smuzhiyunphysical hardware, it is possible to use the DRI to directly render to
656*4882a593Smuzhiyunthe back-end servers.  First, the existing DRI will be extended to
657*4882a593Smuzhiyunsupport multiple display heads, and then to support the DMX system.
658*4882a593SmuzhiyunOpenGL rendering requests will be direct rendering to each back-end X
659*4882a593Smuzhiyunserver.  The DRI will request the screen layout (either from the
660*4882a593Smuzhiyunexisting Xinerama extension or a DMX-specific extension).  Support for
661*4882a593Smuzhiyunsynchronized swap buffers will also be added (on hardware that supports
662*4882a593Smuzhiyunit).  Note that a single front-end server with a single back-end server
663*4882a593Smuzhiyunon the same physical machine can emulate accelerated indirect rendering.
664*4882a593Smuzhiyun</para>
665*4882a593Smuzhiyun
666*4882a593Smuzhiyun<para>When the front and back-end servers are on different physical
667*4882a593Smuzhiyunhardware or are using non-XFree86 4.x X servers, a mechanism to render
668*4882a593Smuzhiyunprimitives across the back-end servers will be provided.  There are
669*4882a593Smuzhiyunseveral options as to how this can be implemented.
670*4882a593Smuzhiyun</para>
671*4882a593Smuzhiyun
672*4882a593Smuzhiyun<orderedlist>
673*4882a593Smuzhiyun<listitem>
674*4882a593Smuzhiyun    <para>The existing OpenGL support in each back-end server can be
675*4882a593Smuzhiyun    used by repackaging rendering primitives and sending them to each
676*4882a593Smuzhiyun    back-end server.  This option is similar to the unoptimized
677*4882a593Smuzhiyun    Xnest-style approach mentioned above.  Optimization of this solution
678*4882a593Smuzhiyun    is beyond the scope of this project and is better suited to other
679*4882a593Smuzhiyun    distributed rendering systems.
680*4882a593Smuzhiyun</para></listitem>
681*4882a593Smuzhiyun
682*4882a593Smuzhiyun<listitem>
683*4882a593Smuzhiyun    <para>Rendering to a pixmap in the front-end server using the
684*4882a593Smuzhiyun    current XFree86 4.x code, and then displaying to the back-ends via
685*4882a593Smuzhiyun    calls to XPutImage() is another option.  This option is similar to
686*4882a593Smuzhiyun    the shadow frame buffer approach mentioned above.  It is slower and
687*4882a593Smuzhiyun    bandwidth intensive, but has the advantage that the back-end servers
688*4882a593Smuzhiyun    are not required to have OpenGL support.
689*4882a593Smuzhiyun</para></listitem>
690*4882a593Smuzhiyun</orderedlist>
691*4882a593Smuzhiyun
692*4882a593Smuzhiyun<para>These, and other, options will be investigated in this phase of the
693*4882a593Smuzhiyunwork.
694*4882a593Smuzhiyun</para>
695*4882a593Smuzhiyun
696*4882a593Smuzhiyun<para>Work by others have made Chromium DMX-aware.  Chromium will use the
697*4882a593SmuzhiyunDMX X protocol extension to obtain information about the back-end
698*4882a593Smuzhiyunservers and will render directly to those servers, bypassing DMX.
699*4882a593Smuzhiyun</para>
700*4882a593Smuzhiyun
701*4882a593Smuzhiyun<para>Status: OpenGL support by the glxProxy extension was implemented by
702*4882a593SmuzhiyunSGI and has been integrated into the DMX code base.
703*4882a593Smuzhiyun</para>
704*4882a593Smuzhiyun<!-- May 2003-->
705*4882a593Smuzhiyun</sect2>
706*4882a593Smuzhiyun
707*4882a593Smuzhiyun</sect1>
708*4882a593Smuzhiyun
709*4882a593Smuzhiyun<!-- ============================================================ -->
710*4882a593Smuzhiyun<sect1>
711*4882a593Smuzhiyun<title>Current issues</title>
712*4882a593Smuzhiyun
713*4882a593Smuzhiyun<para>In this sections the current issues are outlined that require further
714*4882a593Smuzhiyuninvestigation.
715*4882a593Smuzhiyun</para>
716*4882a593Smuzhiyun
717*4882a593Smuzhiyun<sect2>
718*4882a593Smuzhiyun<title>Fonts</title>
719*4882a593Smuzhiyun
720*4882a593Smuzhiyun<para>The font path and glyphs need to be the same for the front-end and
721*4882a593Smuzhiyuneach of the back-end servers.  Font glyphs could be sent to the back-end
722*4882a593Smuzhiyunservers as necessary but this would consume a significant amount of
723*4882a593Smuzhiyunavailable bandwidth during font rendering for clients that use many
724*4882a593Smuzhiyundifferent fonts (e.g., Netscape).  Initially, the font server (xfs) will
725*4882a593Smuzhiyunbe used to provide the fonts to both the front-end and back-end servers.
726*4882a593SmuzhiyunOther possibilities will be investigated during development.
727*4882a593Smuzhiyun</para>
728*4882a593Smuzhiyun</sect2>
729*4882a593Smuzhiyun
730*4882a593Smuzhiyun<sect2>
731*4882a593Smuzhiyun<title>Zero width rendering primitives</title>
732*4882a593Smuzhiyun
733*4882a593Smuzhiyun<para>To allow pixmap and on-screen rendering to be pixel perfect, all
734*4882a593Smuzhiyunback-end servers must render zero width primitives exactly the same as
735*4882a593Smuzhiyunthe front-end renders the primitives to pixmaps.  For those back-end
736*4882a593Smuzhiyunservers that do not exactly match, zero width primitives will be
737*4882a593Smuzhiyunautomatically converted to one width primitives.  This can be handled in
738*4882a593Smuzhiyunthe front-end server via the GC state.
739*4882a593Smuzhiyun</para>
740*4882a593Smuzhiyun</sect2>
741*4882a593Smuzhiyun
742*4882a593Smuzhiyun<sect2>
743*4882a593Smuzhiyun<title>Output scaling</title>
744*4882a593Smuzhiyun
745*4882a593Smuzhiyun<para>With very large tiled displays, it might be difficult to read the
746*4882a593Smuzhiyuninformation on the standard X desktop.  In particular, the cursor can be
747*4882a593Smuzhiyuneasily lost and fonts could be difficult to read.  Automatic primitive
748*4882a593Smuzhiyunscaling might prove to be very useful.  We will investigate the
749*4882a593Smuzhiyunpossibility of scaling the cursor and providing a set of alternate
750*4882a593Smuzhiyunpre-scaled fonts to replace the standard fonts that many applications
751*4882a593Smuzhiyunuse (e.g., fixed).  Other options for automatic scaling will also be
752*4882a593Smuzhiyuninvestigated.
753*4882a593Smuzhiyun</para>
754*4882a593Smuzhiyun</sect2>
755*4882a593Smuzhiyun
756*4882a593Smuzhiyun<sect2>
757*4882a593Smuzhiyun<title>Per-screen colormaps</title>
758*4882a593Smuzhiyun
759*4882a593Smuzhiyun<para>Each screen's default colormap in the set of back-end X servers
760*4882a593Smuzhiyunshould be able to be adjusted via a configuration utility.  This support
761*4882a593Smuzhiyunis would allow the back-end screens to be calibrated via custom gamma
762*4882a593Smuzhiyuntables.  On 24-bit systems that support a DirectColor visual, this type
763*4882a593Smuzhiyunof correction can be accommodated.  One possible implementation would be
764*4882a593Smuzhiyunto advertise to X client of the DMX server a TrueColor visual while
765*4882a593Smuzhiyunusing DirectColor visuals on the back-end servers to implement this type
766*4882a593Smuzhiyunof color correction.  Other options will be investigated.
767*4882a593Smuzhiyun</para>
768*4882a593Smuzhiyun</sect2>
769*4882a593Smuzhiyun</sect1>
770*4882a593Smuzhiyun
771*4882a593Smuzhiyun<!-- ============================================================ -->
772*4882a593Smuzhiyun<appendix>
773*4882a593Smuzhiyun<title>Appendix</title>
774*4882a593Smuzhiyun
775*4882a593Smuzhiyun<sect1>
776*4882a593Smuzhiyun<title>Background</title>
777*4882a593Smuzhiyun
778*4882a593Smuzhiyun<para>This section describes the existing Open Source architectures that
779*4882a593Smuzhiyuncan be used to handle multiple screens and upon which this development
780*4882a593Smuzhiyunproject is based.  This section was written before the implementation
781*4882a593Smuzhiyunwas finished, and may not reflect actual details of the implementation.
782*4882a593SmuzhiyunIt is left for historical interest only.
783*4882a593Smuzhiyun</para>
784*4882a593Smuzhiyun
785*4882a593Smuzhiyun<sect2>
786*4882a593Smuzhiyun<title>Core input device handling</title>
787*4882a593Smuzhiyun
788*4882a593Smuzhiyun<para>The following is a description of how core input devices are handled
789*4882a593Smuzhiyunby an X server.
790*4882a593Smuzhiyun</para>
791*4882a593Smuzhiyun
792*4882a593Smuzhiyun<sect3>
793*4882a593Smuzhiyun<title>InitInput()</title>
794*4882a593Smuzhiyun
795*4882a593Smuzhiyun<para>InitInput() is a DDX function that is called at the start of each
796*4882a593Smuzhiyunserver generation from the X server's main() function.  Its purpose is
797*4882a593Smuzhiyunto determine what input devices are connected to the X server, register
798*4882a593Smuzhiyunthem with the DIX and MI layers, and initialize the input event queue.
799*4882a593SmuzhiyunInitInput() does not have a return value, but the X server will abort if
800*4882a593Smuzhiyuneither a core keyboard device or a core pointer device are not
801*4882a593Smuzhiyunregistered.  Extended input (XInput) devices can also be registered in
802*4882a593SmuzhiyunInitInput().
803*4882a593Smuzhiyun</para>
804*4882a593Smuzhiyun
805*4882a593Smuzhiyun<para>InitInput() usually has implementation specific code to determine
806*4882a593Smuzhiyunwhich input devices are available.  For each input device it will be
807*4882a593Smuzhiyunusing, it calls AddInputDevice():
808*4882a593Smuzhiyun
809*4882a593Smuzhiyun<variablelist>
810*4882a593Smuzhiyun<varlistentry>
811*4882a593Smuzhiyun<term>AddInputDevice()</term>
812*4882a593Smuzhiyun<listitem><para>This DIX function allocates the device structure,
813*4882a593Smuzhiyunregisters a callback function (which handles device init, close, on and
814*4882a593Smuzhiyunoff), and returns the input handle, which can be treated as opaque.  It
815*4882a593Smuzhiyunis called once for each input device.
816*4882a593Smuzhiyun</para></listitem>
817*4882a593Smuzhiyun</varlistentry>
818*4882a593Smuzhiyun</variablelist>
819*4882a593Smuzhiyun</para>
820*4882a593Smuzhiyun
821*4882a593Smuzhiyun<para>Once input handles for core keyboard and core pointer devices have
822*4882a593Smuzhiyunbeen obtained from AddInputDevice().  If both core devices are not
823*4882a593Smuzhiyunregistered, then the X server will exit with a fatal error when it
824*4882a593Smuzhiyunattempts to start the input devices in InitAndStartDevices(), which is
825*4882a593Smuzhiyuncalled directly after InitInput() (see below).
826*4882a593Smuzhiyun</para>
827*4882a593Smuzhiyun
828*4882a593Smuzhiyun<para>The core pointer device is then registered with the miPointer code
829*4882a593Smuzhiyun(which does the high level cursor handling).  While this registration
830*4882a593Smuzhiyunis not necessary for correct miPointer operation in the current XFree86
831*4882a593Smuzhiyuncode, it is still done mostly for compatibility reasons.
832*4882a593Smuzhiyun</para>
833*4882a593Smuzhiyun
834*4882a593Smuzhiyun<para><variablelist>
835*4882a593Smuzhiyun
836*4882a593Smuzhiyun<varlistentry>
837*4882a593Smuzhiyun<term>miRegisterPointerDevice()</term>
838*4882a593Smuzhiyun<listitem><para>This MI function registers the core
839*4882a593Smuzhiyunpointer's input handle with with the miPointer code.
840*4882a593Smuzhiyun</para></listitem></varlistentry>
841*4882a593Smuzhiyun</variablelist>
842*4882a593Smuzhiyun</para>
843*4882a593Smuzhiyun
844*4882a593Smuzhiyun<para>The final part of InitInput() is the initialization of the input
845*4882a593Smuzhiyunevent queue handling.  In most cases, the event queue handling provided
846*4882a593Smuzhiyunin the MI layer is used.  The primary XFree86 X server uses its own
847*4882a593Smuzhiyunevent queue handling to support some special cases related to the XInput
848*4882a593Smuzhiyunextension and the XFree86-specific DGA extension.  For our purposes, the
849*4882a593SmuzhiyunMI event queue handling should be suitable.  It is initialized by
850*4882a593Smuzhiyuncalling mieqInit():
851*4882a593Smuzhiyun
852*4882a593Smuzhiyun<variablelist>
853*4882a593Smuzhiyun<varlistentry>
854*4882a593Smuzhiyun<term>mieqInit()</term>
855*4882a593Smuzhiyun<listitem><para>This MI function initializes the MI event queue for the
856*4882a593Smuzhiyuncore devices, and is passed the public component of the input handles
857*4882a593Smuzhiyunfor the two core devices.
858*4882a593Smuzhiyun</para></listitem></varlistentry>
859*4882a593Smuzhiyun</variablelist>
860*4882a593Smuzhiyun</para>
861*4882a593Smuzhiyun
862*4882a593Smuzhiyun<para>If a wakeup handler is required to deliver synchronous input
863*4882a593Smuzhiyunevents, it can be registered here by calling the DIX function
864*4882a593SmuzhiyunRegisterBlockAndWakeupHandlers().  (See the devReadInput() description
865*4882a593Smuzhiyunbelow.)
866*4882a593Smuzhiyun</para>
867*4882a593Smuzhiyun</sect3>
868*4882a593Smuzhiyun
869*4882a593Smuzhiyun<sect3>
870*4882a593Smuzhiyun<title>InitAndStartDevices()</title>
871*4882a593Smuzhiyun
872*4882a593Smuzhiyun<para>InitAndStartDevices() is a DIX function that is called immediately
873*4882a593Smuzhiyunafter InitInput() from the X server's main() function.  Its purpose is
874*4882a593Smuzhiyunto initialize each input device that was registered with
875*4882a593SmuzhiyunAddInputDevice(), enable each input device that was successfully
876*4882a593Smuzhiyuninitialized, and create the list of enabled input devices.  Once each
877*4882a593Smuzhiyunregistered device is processed in this way, the list of enabled input
878*4882a593Smuzhiyundevices is checked to make sure that both a core keyboard device and
879*4882a593Smuzhiyuncore pointer device were registered and successfully enabled.  If not,
880*4882a593SmuzhiyunInitAndStartDevices() returns failure, and results in the the X server
881*4882a593Smuzhiyunexiting with a fatal error.
882*4882a593Smuzhiyun</para>
883*4882a593Smuzhiyun
884*4882a593Smuzhiyun<para>Each registered device is initialized by calling its callback
885*4882a593Smuzhiyun(dev-&gt;deviceProc) with the DEVICE_INIT argument:
886*4882a593Smuzhiyun
887*4882a593Smuzhiyun<variablelist>
888*4882a593Smuzhiyun<varlistentry>
889*4882a593Smuzhiyun<term>(*dev-&gt;deviceProc)(dev, DEVICE_INIT)</term>
890*4882a593Smuzhiyun<listitem>
891*4882a593Smuzhiyun<para>This function initializes the
892*4882a593Smuzhiyundevice structs with core information relevant to the device.
893*4882a593Smuzhiyun</para>
894*4882a593Smuzhiyun
895*4882a593Smuzhiyun<para>For pointer devices, this means specifying the number of buttons,
896*4882a593Smuzhiyundefault button mapping, the function used to get motion events (usually
897*4882a593SmuzhiyunmiPointerGetMotionEvents()), the function used to change/control the
898*4882a593Smuzhiyuncore pointer motion parameters (acceleration and threshold), and the
899*4882a593Smuzhiyunmotion buffer size.
900*4882a593Smuzhiyun</para>
901*4882a593Smuzhiyun
902*4882a593Smuzhiyun<para>For keyboard devices, this means specifying the keycode range,
903*4882a593Smuzhiyundefault keycode to keysym mapping, default modifier mapping, and the
904*4882a593Smuzhiyunfunctions used to sound the keyboard bell and modify/control the
905*4882a593Smuzhiyunkeyboard parameters (LEDs, bell pitch and duration, key click, which
906*4882a593Smuzhiyunkeys are auto-repeating, etc).
907*4882a593Smuzhiyun</para></listitem></varlistentry>
908*4882a593Smuzhiyun</variablelist>
909*4882a593Smuzhiyun</para>
910*4882a593Smuzhiyun
911*4882a593Smuzhiyun<para>Each initialized device is enabled by calling EnableDevice():
912*4882a593Smuzhiyun
913*4882a593Smuzhiyun<variablelist>
914*4882a593Smuzhiyun<varlistentry>
915*4882a593Smuzhiyun<term>EnableDevice()</term>
916*4882a593Smuzhiyun<listitem>
917*4882a593Smuzhiyun<para>EnableDevice() calls the device callback with
918*4882a593SmuzhiyunDEVICE_ON:
919*4882a593Smuzhiyun    <variablelist>
920*4882a593Smuzhiyun    <varlistentry>
921*4882a593Smuzhiyun    <term>(*dev-&gt;deviceProc)(dev, DEVICE_ON)</term>
922*4882a593Smuzhiyun    <listitem>
923*4882a593Smuzhiyun    <para>This typically opens and
924*4882a593Smuzhiyun    initializes the relevant physical device, and when appropriate,
925*4882a593Smuzhiyun    registers the device's file descriptor (or equivalent) as a valid
926*4882a593Smuzhiyun    input source.
927*4882a593Smuzhiyun    </para></listitem></varlistentry>
928*4882a593Smuzhiyun    </variablelist>
929*4882a593Smuzhiyun    </para>
930*4882a593Smuzhiyun
931*4882a593Smuzhiyun    <para>EnableDevice() then adds the device handle to the X server's
932*4882a593Smuzhiyun    global list of enabled devices.
933*4882a593Smuzhiyun</para></listitem></varlistentry>
934*4882a593Smuzhiyun</variablelist>
935*4882a593Smuzhiyun</para>
936*4882a593Smuzhiyun
937*4882a593Smuzhiyun<para>InitAndStartDevices() then verifies that a valid core keyboard and
938*4882a593Smuzhiyunpointer has been initialized and enabled.  It returns failure if either
939*4882a593Smuzhiyunare missing.
940*4882a593Smuzhiyun</para>
941*4882a593Smuzhiyun</sect3>
942*4882a593Smuzhiyun
943*4882a593Smuzhiyun<sect3>
944*4882a593Smuzhiyun<title>devReadInput()</title>
945*4882a593Smuzhiyun
946*4882a593Smuzhiyun<para>Each device will have some function that gets called to read its
947*4882a593Smuzhiyunphysical input. This function should do at least two things: make sure that
948*4882a593Smuzhiyuninput events get enqueued, and make sure that the cursor gets moved for motion
949*4882a593Smuzhiyunevents (except if these are handled later by the driver's own event queue
950*4882a593Smuzhiyunprocessing function, which cannot be done when using the MI event queue
951*4882a593Smuzhiyunhandling).
952*4882a593Smuzhiyun</para>
953*4882a593Smuzhiyun
954*4882a593Smuzhiyun<para>Events are queued by calling mieqEnqueue():
955*4882a593Smuzhiyun
956*4882a593Smuzhiyun<variablelist>
957*4882a593Smuzhiyun<varlistentry>
958*4882a593Smuzhiyun<term>mieqEnqueue()</term>
959*4882a593Smuzhiyun<listitem>
960*4882a593Smuzhiyun<para>This MI function is used to add input events to the
961*4882a593Smuzhiyunevent queue.  It is simply passed the event to be queued.
962*4882a593Smuzhiyun</para></listitem></varlistentry>
963*4882a593Smuzhiyun</variablelist>
964*4882a593Smuzhiyun</para>
965*4882a593Smuzhiyun
966*4882a593Smuzhiyun<para>The cursor position should be updated when motion events are
967*4882a593Smuzhiyunenqueued by calling miPointerDeltaCursor():
968*4882a593Smuzhiyun
969*4882a593Smuzhiyun<variablelist>
970*4882a593Smuzhiyun<varlistentry>
971*4882a593Smuzhiyun<term>miPointerDeltaCursor()</term>
972*4882a593Smuzhiyun<listitem>
973*4882a593Smuzhiyun<para>This MI function is used to move the cursor
974*4882a593Smuzhiyunrelative to its current position.
975*4882a593Smuzhiyun</para></listitem></varlistentry>
976*4882a593Smuzhiyun</variablelist>
977*4882a593Smuzhiyun</para>
978*4882a593Smuzhiyun</sect3>
979*4882a593Smuzhiyun
980*4882a593Smuzhiyun<sect3>
981*4882a593Smuzhiyun<title>ProcessInputEvents()</title>
982*4882a593Smuzhiyun
983*4882a593Smuzhiyun<para>ProcessInputEvents() is a DDX function that is called from the X
984*4882a593Smuzhiyunserver's main dispatch loop when new events are available in the input
985*4882a593Smuzhiyunevent queue.  It typically processes the enqueued events, and updates
986*4882a593Smuzhiyunthe cursor/pointer position.  It may also do other DDX-specific event
987*4882a593Smuzhiyunprocessing.
988*4882a593Smuzhiyun</para>
989*4882a593Smuzhiyun
990*4882a593Smuzhiyun<para>Enqueued events are processed by mieqProcessInputEvents() and passed
991*4882a593Smuzhiyunto the DIX layer for transmission to clients:
992*4882a593Smuzhiyun
993*4882a593Smuzhiyun<variablelist>
994*4882a593Smuzhiyun<varlistentry>
995*4882a593Smuzhiyun<term>mieqProcessInputEvents()</term>
996*4882a593Smuzhiyun<listitem>
997*4882a593Smuzhiyun<para>This function processes each event in the
998*4882a593Smuzhiyunevent queue, and passes it to the device's input processing function.
999*4882a593SmuzhiyunThe DIX layer provides default functions to do this processing, and they
1000*4882a593Smuzhiyunhandle the task of getting the events passed back to the relevant
1001*4882a593Smuzhiyunclients.
1002*4882a593Smuzhiyun</para></listitem></varlistentry>
1003*4882a593Smuzhiyun<varlistentry>
1004*4882a593Smuzhiyun<term>miPointerUpdate()</term>
1005*4882a593Smuzhiyun<listitem>
1006*4882a593Smuzhiyun<para>This function resynchronized the cursor position
1007*4882a593Smuzhiyunwith the new pointer position.  It also takes care of moving the cursor
1008*4882a593Smuzhiyunbetween screens when needed in multi-head configurations.
1009*4882a593Smuzhiyun</para></listitem></varlistentry>
1010*4882a593Smuzhiyun</variablelist>
1011*4882a593Smuzhiyun</para>
1012*4882a593Smuzhiyun
1013*4882a593Smuzhiyun</sect3>
1014*4882a593Smuzhiyun
1015*4882a593Smuzhiyun<sect3>
1016*4882a593Smuzhiyun<title>DisableDevice()</title>
1017*4882a593Smuzhiyun
1018*4882a593Smuzhiyun<para>DisableDevice is a DIX function that removes an input device from the
1019*4882a593Smuzhiyunlist of enabled devices.  The result of this is that the device no
1020*4882a593Smuzhiyunlonger generates input events.  The device's data structures are kept in
1021*4882a593Smuzhiyunplace, and disabling a device like this can be reversed by calling
1022*4882a593SmuzhiyunEnableDevice().  DisableDevice() may be called from the DDX when it is
1023*4882a593Smuzhiyundesirable to do so (e.g., the XFree86 server does this when VT
1024*4882a593Smuzhiyunswitching).  Except for special cases, this is not normally called for
1025*4882a593Smuzhiyuncore input devices.
1026*4882a593Smuzhiyun</para>
1027*4882a593Smuzhiyun
1028*4882a593Smuzhiyun<para>DisableDevice() calls the device's callback function with
1029*4882a593Smuzhiyun<constant>DEVICE_OFF</constant>:
1030*4882a593Smuzhiyun
1031*4882a593Smuzhiyun<variablelist>
1032*4882a593Smuzhiyun<varlistentry>
1033*4882a593Smuzhiyun<term>(*dev-&gt;deviceProc)(dev, DEVICE_OFF)</term>
1034*4882a593Smuzhiyun<listitem>
1035*4882a593Smuzhiyun<para>This typically closes the
1036*4882a593Smuzhiyunrelevant physical device, and when appropriate, unregisters the device's
1037*4882a593Smuzhiyunfile descriptor (or equivalent) as a valid input source.
1038*4882a593Smuzhiyun</para></listitem></varlistentry>
1039*4882a593Smuzhiyun</variablelist>
1040*4882a593Smuzhiyun</para>
1041*4882a593Smuzhiyun
1042*4882a593Smuzhiyun<para>DisableDevice() then removes the device handle from the X server's
1043*4882a593Smuzhiyunglobal list of enabled devices.
1044*4882a593Smuzhiyun</para>
1045*4882a593Smuzhiyun
1046*4882a593Smuzhiyun</sect3>
1047*4882a593Smuzhiyun
1048*4882a593Smuzhiyun<sect3>
1049*4882a593Smuzhiyun<title>CloseDevice()</title>
1050*4882a593Smuzhiyun
1051*4882a593Smuzhiyun<para>CloseDevice is a DIX function that removes an input device from the
1052*4882a593Smuzhiyunlist of available devices.  It disables input from the device and frees
1053*4882a593Smuzhiyunall data structures associated with the device.  This function is
1054*4882a593Smuzhiyunusually called from CloseDownDevices(), which is called from main() at
1055*4882a593Smuzhiyunthe end of each server generation to close all input devices.
1056*4882a593Smuzhiyun</para>
1057*4882a593Smuzhiyun
1058*4882a593Smuzhiyun<para>CloseDevice() calls the device's callback function with
1059*4882a593Smuzhiyun<constant>DEVICE_CLOSE</constant>:
1060*4882a593Smuzhiyun
1061*4882a593Smuzhiyun<variablelist>
1062*4882a593Smuzhiyun<varlistentry>
1063*4882a593Smuzhiyun<term>(*dev-&gt;deviceProc)(dev, DEVICE_CLOSE)</term>
1064*4882a593Smuzhiyun<listitem>
1065*4882a593Smuzhiyun<para>This typically closes the
1066*4882a593Smuzhiyunrelevant physical device, and when appropriate, unregisters the device's
1067*4882a593Smuzhiyunfile descriptor (or equivalent) as a valid input source.  If any device
1068*4882a593Smuzhiyunspecific data structures were allocated when the device was initialized,
1069*4882a593Smuzhiyunthey are freed here.
1070*4882a593Smuzhiyun</para></listitem></varlistentry>
1071*4882a593Smuzhiyun</variablelist>
1072*4882a593Smuzhiyun</para>
1073*4882a593Smuzhiyun
1074*4882a593Smuzhiyun<para>CloseDevice() then frees the data structures that were allocated
1075*4882a593Smuzhiyunfor the device when it was registered/initialized.
1076*4882a593Smuzhiyun</para>
1077*4882a593Smuzhiyun
1078*4882a593Smuzhiyun</sect3>
1079*4882a593Smuzhiyun
1080*4882a593Smuzhiyun<sect3>
1081*4882a593Smuzhiyun<title>LegalModifier()</title>
1082*4882a593Smuzhiyun<!-- dmx/dmxinput.c - currently returns TRUE -->
1083*4882a593Smuzhiyun<para>LegalModifier() is a required DDX function that can be used to
1084*4882a593Smuzhiyunrestrict which keys may be modifier keys.  This seems to be present for
1085*4882a593Smuzhiyunhistorical reasons, so this function should simply return TRUE
1086*4882a593Smuzhiyununconditionally.
1087*4882a593Smuzhiyun</para>
1088*4882a593Smuzhiyun
1089*4882a593Smuzhiyun</sect3>
1090*4882a593Smuzhiyun</sect2>
1091*4882a593Smuzhiyun
1092*4882a593Smuzhiyun<sect2>
1093*4882a593Smuzhiyun<title>Output handling</title>
1094*4882a593Smuzhiyun
1095*4882a593Smuzhiyun<para>The following sections describe the main functions required to
1096*4882a593Smuzhiyuninitialize, use and close the output device(s) for each screen in the X
1097*4882a593Smuzhiyunserver.
1098*4882a593Smuzhiyun</para>
1099*4882a593Smuzhiyun
1100*4882a593Smuzhiyun<sect3>
1101*4882a593Smuzhiyun<title>InitOutput()</title>
1102*4882a593Smuzhiyun
1103*4882a593Smuzhiyun<para>This DDX function is called near the start of each server generation
1104*4882a593Smuzhiyunfrom the X server's main() function.  InitOutput()'s main purpose is to
1105*4882a593Smuzhiyuninitialize each screen and fill in the global screenInfo structure for
1106*4882a593Smuzhiyuneach screen.  It is passed three arguments: a pointer to the screenInfo
1107*4882a593Smuzhiyunstruct, which it is to initialize, and argc and argv from main(), which
1108*4882a593Smuzhiyuncan be used to determine additional configuration information.
1109*4882a593Smuzhiyun</para>
1110*4882a593Smuzhiyun
1111*4882a593Smuzhiyun<para>The primary tasks for this function are outlined below:
1112*4882a593Smuzhiyun
1113*4882a593Smuzhiyun<orderedlist>
1114*4882a593Smuzhiyun<listitem>
1115*4882a593Smuzhiyun    <para><emphasis remap="bf">Parse configuration info:</emphasis> The first task of InitOutput()
1116*4882a593Smuzhiyun    is to parses any configuration information from the configuration
1117*4882a593Smuzhiyun    file.  In addition to the XF86Config file, other configuration
1118*4882a593Smuzhiyun    information can be taken from the command line.  The command line
1119*4882a593Smuzhiyun    options can be gathered either in InitOutput() or earlier in the
1120*4882a593Smuzhiyun    ddxProcessArgument() function, which is called by
1121*4882a593Smuzhiyun    ProcessCommandLine().  The configuration information determines the
1122*4882a593Smuzhiyun    characteristics of the screen(s).  For example, in the XFree86 X
1123*4882a593Smuzhiyun    server, the XF86Config file specifies the monitor information, the
1124*4882a593Smuzhiyun    screen resolution, the graphics devices and slots in which they are
1125*4882a593Smuzhiyun    located, and, for Xinerama, the screens' layout.
1126*4882a593Smuzhiyun</para>
1127*4882a593Smuzhiyun</listitem>
1128*4882a593Smuzhiyun
1129*4882a593Smuzhiyun<listitem>
1130*4882a593Smuzhiyun    <para><emphasis remap="bf">Initialize screen info:</emphasis> The next task is to initialize
1131*4882a593Smuzhiyun    the screen-dependent internal data structures.  For example, part of
1132*4882a593Smuzhiyun    what the XFree86 X server does is to allocate its screen and pixmap
1133*4882a593Smuzhiyun    private indices, probe for graphics devices, compare the probed
1134*4882a593Smuzhiyun    devices to the ones listed in the XF86Config file, and add the ones that
1135*4882a593Smuzhiyun    match to the internal xf86Screens&lsqb;&rsqb; structure.
1136*4882a593Smuzhiyun</para>
1137*4882a593Smuzhiyun</listitem>
1138*4882a593Smuzhiyun
1139*4882a593Smuzhiyun<listitem>
1140*4882a593Smuzhiyun    <para><emphasis remap="bf">Set pixmap formats:</emphasis> The next task is to initialize the
1141*4882a593Smuzhiyun    screenInfo's image byte order, bitmap bit order and bitmap scanline
1142*4882a593Smuzhiyun    unit/pad.  The screenInfo's pixmap format's depth, bits per pixel
1143*4882a593Smuzhiyun    and scanline padding is also initialized at this stage.
1144*4882a593Smuzhiyun</para>
1145*4882a593Smuzhiyun</listitem>
1146*4882a593Smuzhiyun
1147*4882a593Smuzhiyun<listitem>
1148*4882a593Smuzhiyun    <para><emphasis remap="bf">Unify screen info:</emphasis> An optional task that might be done at
1149*4882a593Smuzhiyun    this stage is to compare all of the information from the various
1150*4882a593Smuzhiyun    screens and determines if they are compatible (i.e., if the set of
1151*4882a593Smuzhiyun    screens can be unified into a single desktop).  This task has
1152*4882a593Smuzhiyun    potential to be useful to the DMX front-end server, if Xinerama's
1153*4882a593Smuzhiyun    PanoramiXConsolidate() function is not sufficient.
1154*4882a593Smuzhiyun</para>
1155*4882a593Smuzhiyun</listitem>
1156*4882a593Smuzhiyun</orderedlist>
1157*4882a593Smuzhiyun</para>
1158*4882a593Smuzhiyun
1159*4882a593Smuzhiyun<para>Once these tasks are complete, the valid screens are known and each
1160*4882a593Smuzhiyunof these screens can be initialized by calling AddScreen().
1161*4882a593Smuzhiyun</para>
1162*4882a593Smuzhiyun</sect3>
1163*4882a593Smuzhiyun
1164*4882a593Smuzhiyun<sect3>
1165*4882a593Smuzhiyun<title>AddScreen()</title>
1166*4882a593Smuzhiyun
1167*4882a593Smuzhiyun<para>This DIX function is called from InitOutput(), in the DDX layer, to
1168*4882a593Smuzhiyunadd each new screen to the screenInfo structure.  The DDX screen
1169*4882a593Smuzhiyuninitialization function and command line arguments (i.e., argc and argv)
1170*4882a593Smuzhiyunare passed to it as arguments.
1171*4882a593Smuzhiyun</para>
1172*4882a593Smuzhiyun
1173*4882a593Smuzhiyun<para>This function first allocates a new Screen structure and any privates
1174*4882a593Smuzhiyunthat are required.  It then initializes some of the fields in the Screen
1175*4882a593Smuzhiyunstruct and sets up the pixmap padding information.  Finally, it calls
1176*4882a593Smuzhiyunthe DDX screen initialization function ScreenInit(), which is described
1177*4882a593Smuzhiyunbelow.  It returns the number of the screen that were just added, or -1
1178*4882a593Smuzhiyunif there is insufficient memory to add the screen or if the DDX screen
1179*4882a593Smuzhiyuninitialization fails.
1180*4882a593Smuzhiyun</para>
1181*4882a593Smuzhiyun</sect3>
1182*4882a593Smuzhiyun
1183*4882a593Smuzhiyun<sect3>
1184*4882a593Smuzhiyun<title>ScreenInit()</title>
1185*4882a593Smuzhiyun
1186*4882a593Smuzhiyun<para>This DDX function initializes the rest of the Screen structure with
1187*4882a593Smuzhiyuneither generic or screen-specific functions (as necessary).  It also
1188*4882a593Smuzhiyunfills in various screen attributes (e.g., width and height in
1189*4882a593Smuzhiyunmillimeters, black and white pixel values).
1190*4882a593Smuzhiyun</para>
1191*4882a593Smuzhiyun
1192*4882a593Smuzhiyun<para>The screen init function usually calls several functions to perform
1193*4882a593Smuzhiyuncertain screen initialization functions.  They are described below:
1194*4882a593Smuzhiyun
1195*4882a593Smuzhiyun<variablelist>
1196*4882a593Smuzhiyun<varlistentry>
1197*4882a593Smuzhiyun<term>{mi,*fb}ScreenInit()</term>
1198*4882a593Smuzhiyun<listitem>
1199*4882a593Smuzhiyun<para>The DDX layer's ScreenInit() function usually
1200*4882a593Smuzhiyuncalls another layer's ScreenInit() function (e.g., miScreenInit() or
1201*4882a593SmuzhiyunfbScreenInit()) to initialize the fallbacks that the DDX driver does not
1202*4882a593Smuzhiyunspecifically handle.
1203*4882a593Smuzhiyun</para>
1204*4882a593Smuzhiyun
1205*4882a593Smuzhiyun<para>After calling another layer's ScreenInit() function, any
1206*4882a593Smuzhiyunscreen-specific functions either wrap or replace the other layer's
1207*4882a593Smuzhiyunfunction pointers.  If a function is to be wrapped, each of the old
1208*4882a593Smuzhiyunfunction pointers from the other layer are stored in a screen private
1209*4882a593Smuzhiyunarea.  Common functions to wrap are CloseScreen() and SaveScreen().
1210*4882a593Smuzhiyun</para></listitem></varlistentry>
1211*4882a593Smuzhiyun
1212*4882a593Smuzhiyun<varlistentry>
1213*4882a593Smuzhiyun<term>miDCInitialize()</term>
1214*4882a593Smuzhiyun<listitem>
1215*4882a593Smuzhiyun<para>This MI function initializes the MI cursor
1216*4882a593Smuzhiyundisplay structures and function pointers.  If a hardware cursor is used,
1217*4882a593Smuzhiyunthe DDX layer's ScreenInit() function will wrap additional screen and
1218*4882a593Smuzhiyunthe MI cursor display function pointers.
1219*4882a593Smuzhiyun</para></listitem></varlistentry>
1220*4882a593Smuzhiyun</variablelist>
1221*4882a593Smuzhiyun</para>
1222*4882a593Smuzhiyun
1223*4882a593Smuzhiyun<para>Another common task for ScreenInit() function is to initialize the
1224*4882a593Smuzhiyunoutput device state.  For example, in the XFree86 X server, the
1225*4882a593SmuzhiyunScreenInit() function saves the original state of the video card and
1226*4882a593Smuzhiyunthen initializes the video mode of the graphics device.
1227*4882a593Smuzhiyun</para>
1228*4882a593Smuzhiyun</sect3>
1229*4882a593Smuzhiyun
1230*4882a593Smuzhiyun<sect3>
1231*4882a593Smuzhiyun<title>CloseScreen()</title>
1232*4882a593Smuzhiyun
1233*4882a593Smuzhiyun<para>This function restores any wrapped screen functions (and in
1234*4882a593Smuzhiyunparticular the wrapped CloseScreen() function) and restores the state of
1235*4882a593Smuzhiyunthe output device to its original state.  It should also free any
1236*4882a593Smuzhiyunprivate data it created during the screen initialization.
1237*4882a593Smuzhiyun</para>
1238*4882a593Smuzhiyun</sect3>
1239*4882a593Smuzhiyun
1240*4882a593Smuzhiyun<sect3>
1241*4882a593Smuzhiyun<title>GC operations</title>
1242*4882a593Smuzhiyun
1243*4882a593Smuzhiyun<para>When the X server is requested to render drawing primitives, it does
1244*4882a593Smuzhiyunso by calling drawing functions through the graphics context's operation
1245*4882a593Smuzhiyunfunction pointer table (i.e., the GCOps functions).  These functions
1246*4882a593Smuzhiyunrender the basic graphics operations such as drawing rectangles, lines,
1247*4882a593Smuzhiyuntext or copying pixmaps.  Default routines are provided either by the MI
1248*4882a593Smuzhiyunlayer, which draws indirectly through a simple span interface, or by the
1249*4882a593Smuzhiyunframebuffer layers (e.g., CFB, MFB, FB), which draw directly to a
1250*4882a593Smuzhiyunlinearly mapped frame buffer.
1251*4882a593Smuzhiyun</para>
1252*4882a593Smuzhiyun
1253*4882a593Smuzhiyun<para>To take advantage of special hardware on the graphics device,
1254*4882a593Smuzhiyunspecific GCOps functions can be replaced by device specific code.
1255*4882a593SmuzhiyunHowever, many times the graphics devices can handle only a subset of the
1256*4882a593Smuzhiyunpossible states of the GC, so during graphics context validation,
1257*4882a593Smuzhiyunappropriate routines are selected based on the state and capabilities of
1258*4882a593Smuzhiyunthe hardware.  For example, some graphics hardware can accelerate single
1259*4882a593Smuzhiyunpixel width lines with certain dash patterns.  Thus, for dash patterns
1260*4882a593Smuzhiyunthat are not supported by hardware or for width 2 or greater lines, the
1261*4882a593Smuzhiyundefault routine is chosen during GC validation.
1262*4882a593Smuzhiyun</para>
1263*4882a593Smuzhiyun
1264*4882a593Smuzhiyun<para>Note that some pointers to functions that draw to the screen are
1265*4882a593Smuzhiyunstored in the Screen structure.  They include GetImage(), GetSpans(),
1266*4882a593SmuzhiyunCopyWindow() and RestoreAreas().
1267*4882a593Smuzhiyun</para>
1268*4882a593Smuzhiyun</sect3>
1269*4882a593Smuzhiyun
1270*4882a593Smuzhiyun<sect3>
1271*4882a593Smuzhiyun<title>Xnest</title>
1272*4882a593Smuzhiyun
1273*4882a593Smuzhiyun<para>The Xnest X server is a special proxy X server that relays the X
1274*4882a593Smuzhiyunprotocol requests that it receives to a ``real'' X server that then
1275*4882a593Smuzhiyunprocesses the requests and displays the results, if applicable.  To the X
1276*4882a593Smuzhiyunapplications, Xnest appears as if it is a regular X server.  However,
1277*4882a593SmuzhiyunXnest is both server to the X application and client of the real X
1278*4882a593Smuzhiyunserver, which will actually handle the requests.
1279*4882a593Smuzhiyun</para>
1280*4882a593Smuzhiyun
1281*4882a593Smuzhiyun<para>The Xnest server implements all of the standard input and output
1282*4882a593Smuzhiyuninitialization steps outlined above.
1283*4882a593Smuzhiyun</para>
1284*4882a593Smuzhiyun
1285*4882a593Smuzhiyun<para><variablelist>
1286*4882a593Smuzhiyun<varlistentry>
1287*4882a593Smuzhiyun<term>InitOutput()</term>
1288*4882a593Smuzhiyun<listitem>
1289*4882a593Smuzhiyun<para>Xnest takes its configuration information from
1290*4882a593Smuzhiyuncommand line arguments via ddxProcessArguments().  This information
1291*4882a593Smuzhiyunincludes the real X server display to connect to, its default visual
1292*4882a593Smuzhiyunclass, the screen depth, the Xnest window's geometry, etc.  Xnest then
1293*4882a593Smuzhiyunconnects to the real X server and gathers visual, colormap, depth and
1294*4882a593Smuzhiyunpixmap information about that server's display, creates a window on that
1295*4882a593Smuzhiyunserver, which will be used as the root window for Xnest.
1296*4882a593Smuzhiyun</para>
1297*4882a593Smuzhiyun
1298*4882a593Smuzhiyun<para>Next, Xnest initializes its internal data structures and uses the
1299*4882a593Smuzhiyundata from the real X server's pixmaps to initialize its own pixmap
1300*4882a593Smuzhiyunformats.  Finally, it calls AddScreen(xnestOpenScreen, argc, argv) to
1301*4882a593Smuzhiyuninitialize each of its screens.
1302*4882a593Smuzhiyun</para></listitem></varlistentry>
1303*4882a593Smuzhiyun
1304*4882a593Smuzhiyun<varlistentry>
1305*4882a593Smuzhiyun<term>ScreenInit()</term>
1306*4882a593Smuzhiyun<listitem>
1307*4882a593Smuzhiyun<para>Xnest's ScreenInit() function is called
1308*4882a593SmuzhiyunxnestOpenScreen().  This function initializes its screen's depth and
1309*4882a593Smuzhiyunvisual information, and then calls miScreenInit() to set up the default
1310*4882a593Smuzhiyunscreen functions.  It then calls miDCInitialize() to initialize the
1311*4882a593Smuzhiyunsoftware cursor.
1312*4882a593SmuzhiyunFinally, it replaces many of the screen functions with its own
1313*4882a593Smuzhiyunfunctions that repackage and send the requests to the real X server to
1314*4882a593Smuzhiyunwhich Xnest is attached.
1315*4882a593Smuzhiyun</para></listitem></varlistentry>
1316*4882a593Smuzhiyun
1317*4882a593Smuzhiyun<varlistentry>
1318*4882a593Smuzhiyun<term>CloseScreen()</term>
1319*4882a593Smuzhiyun<listitem>
1320*4882a593Smuzhiyun<para>This function frees its internal data structure
1321*4882a593Smuzhiyunallocations.  Since it replaces instead of wrapping screen functions,
1322*4882a593Smuzhiyunthere are no function pointers to unwrap.  This can potentially lead to
1323*4882a593Smuzhiyunproblems during server regeneration.
1324*4882a593Smuzhiyun</para></listitem></varlistentry>
1325*4882a593Smuzhiyun
1326*4882a593Smuzhiyun<varlistentry>
1327*4882a593Smuzhiyun<term>GC operations</term>
1328*4882a593Smuzhiyun<listitem>
1329*4882a593Smuzhiyun<para>The GC operations in Xnest are very simple since
1330*4882a593Smuzhiyunthey leave all of the drawing to the real X server to which Xnest is
1331*4882a593Smuzhiyunattached.  Each of the GCOps takes the request and sends it to the
1332*4882a593Smuzhiyunreal X server using standard Xlib calls.  For example, the X
1333*4882a593Smuzhiyunapplication issues a XDrawLines() call.  This function turns into a
1334*4882a593Smuzhiyunprotocol request to Xnest, which calls the xnestPolylines() function
1335*4882a593Smuzhiyunthrough Xnest's GCOps function pointer table.  The xnestPolylines()
1336*4882a593Smuzhiyunfunction is only a single line, which calls XDrawLines() using the same
1337*4882a593Smuzhiyunarguments that were passed into it.  Other GCOps functions are very
1338*4882a593Smuzhiyunsimilar.  Two exceptions to the simple GCOps functions described above
1339*4882a593Smuzhiyunare the image functions and the BLT operations.
1340*4882a593Smuzhiyun</para>
1341*4882a593Smuzhiyun
1342*4882a593Smuzhiyun<para>The image functions, GetImage() and PutImage(), must use a temporary
1343*4882a593Smuzhiyunimage to hold the image to be put of the image that was just grabbed
1344*4882a593Smuzhiyunfrom the screen while it is in transit to the real X server or the
1345*4882a593Smuzhiyunclient.  When the image has been transmitted, the temporary image is
1346*4882a593Smuzhiyundestroyed.
1347*4882a593Smuzhiyun</para>
1348*4882a593Smuzhiyun
1349*4882a593Smuzhiyun<para>The BLT operations, CopyArea() and CopyPlane(), handle not only the
1350*4882a593Smuzhiyuncopy function, which is the same as the simple cases described above,
1351*4882a593Smuzhiyunbut also the graphics exposures that result when the GC's graphics
1352*4882a593Smuzhiyunexposure bit is set to True.  Graphics exposures are handled in a helper
1353*4882a593Smuzhiyunfunction, xnestBitBlitHelper().  This function collects the exposure
1354*4882a593Smuzhiyunevents from the real X server and, if any resulting in regions being
1355*4882a593Smuzhiyunexposed, then those regions are passed back to the MI layer so that it
1356*4882a593Smuzhiyuncan generate exposure events for the X application.
1357*4882a593Smuzhiyun</para></listitem></varlistentry>
1358*4882a593Smuzhiyun</variablelist>
1359*4882a593Smuzhiyun</para>
1360*4882a593Smuzhiyun
1361*4882a593Smuzhiyun<para>The Xnest server takes its input from the X server to which it is
1362*4882a593Smuzhiyunconnected.  When the mouse is in the Xnest server's window, keyboard and
1363*4882a593Smuzhiyunmouse events are received by the Xnest server, repackaged and sent back
1364*4882a593Smuzhiyunto any client that requests those events.
1365*4882a593Smuzhiyun</para>
1366*4882a593Smuzhiyun</sect3>
1367*4882a593Smuzhiyun
1368*4882a593Smuzhiyun<sect3>
1369*4882a593Smuzhiyun<title>Shadow framebuffer</title>
1370*4882a593Smuzhiyun
1371*4882a593Smuzhiyun<para>The most common type of framebuffer is a linear array memory that
1372*4882a593Smuzhiyunmaps to the video memory on the graphics device.  However, accessing
1373*4882a593Smuzhiyunthat video memory over an I/O bus (e.g., ISA or PCI) can be slow.  The
1374*4882a593Smuzhiyunshadow framebuffer layer allows the developer to keep the entire
1375*4882a593Smuzhiyunframebuffer in main memory and copy it back to video memory at regular
1376*4882a593Smuzhiyunintervals.  It also has been extended to handle planar video memory and
1377*4882a593Smuzhiyunrotated framebuffers.
1378*4882a593Smuzhiyun</para>
1379*4882a593Smuzhiyun
1380*4882a593Smuzhiyun<para>There are two main entry points to the shadow framebuffer code:
1381*4882a593Smuzhiyun
1382*4882a593Smuzhiyun<variablelist>
1383*4882a593Smuzhiyun<varlistentry>
1384*4882a593Smuzhiyun<term>shadowAlloc(width, height, bpp)</term>
1385*4882a593Smuzhiyun<listitem>
1386*4882a593Smuzhiyun<para>This function allocates the in
1387*4882a593Smuzhiyunmemory copy of the framebuffer of size width*height*bpp.  It returns a
1388*4882a593Smuzhiyunpointer to that memory, which will be used by the framebuffer
1389*4882a593SmuzhiyunScreenInit() code during the screen's initialization.
1390*4882a593Smuzhiyun</para></listitem></varlistentry>
1391*4882a593Smuzhiyun
1392*4882a593Smuzhiyun<varlistentry>
1393*4882a593Smuzhiyun<term>shadowInit(pScreen, updateProc, windowProc)</term>
1394*4882a593Smuzhiyun<listitem>
1395*4882a593Smuzhiyun<para>This function
1396*4882a593Smuzhiyuninitializes the shadow framebuffer layer.  It wraps several screen
1397*4882a593Smuzhiyundrawing functions, and registers a block handler that will update the
1398*4882a593Smuzhiyunscreen.  The updateProc is a function that will copy the damaged regions
1399*4882a593Smuzhiyunto the screen, and the windowProc is a function that is used when the
1400*4882a593Smuzhiyunentire linear video memory range cannot be accessed simultaneously so
1401*4882a593Smuzhiyunthat only a window into that memory is available (e.g., when using the
1402*4882a593SmuzhiyunVGA aperture).
1403*4882a593Smuzhiyun</para></listitem></varlistentry>
1404*4882a593Smuzhiyun</variablelist>
1405*4882a593Smuzhiyun</para>
1406*4882a593Smuzhiyun
1407*4882a593Smuzhiyun<para>The shadow framebuffer code keeps track of the damaged area of each
1408*4882a593Smuzhiyunscreen by calculating the bounding box of all drawing operations that
1409*4882a593Smuzhiyunhave occurred since the last screen update.  Then, when the block handler
1410*4882a593Smuzhiyunis next called, only the damaged portion of the screen is updated.
1411*4882a593Smuzhiyun</para>
1412*4882a593Smuzhiyun
1413*4882a593Smuzhiyun<para>Note that since the shadow framebuffer is kept in main memory, all
1414*4882a593Smuzhiyundrawing operations are performed by the CPU and, thus, no accelerated
1415*4882a593Smuzhiyunhardware drawing operations are possible.
1416*4882a593Smuzhiyun</para>
1417*4882a593Smuzhiyun
1418*4882a593Smuzhiyun</sect3>
1419*4882a593Smuzhiyun</sect2>
1420*4882a593Smuzhiyun
1421*4882a593Smuzhiyun<sect2>
1422*4882a593Smuzhiyun<title>Xinerama</title>
1423*4882a593Smuzhiyun
1424*4882a593Smuzhiyun<para>Xinerama is an X extension that allows multiple physical screens
1425*4882a593Smuzhiyuncontrolled by a single X server to appear as a single screen.  Although
1426*4882a593Smuzhiyunthe extension allows clients to find the physical screen layout via
1427*4882a593Smuzhiyunextension requests, it is completely transparent to clients at the core
1428*4882a593SmuzhiyunX11 protocol level.  The original public implementation of Xinerama came
1429*4882a593Smuzhiyunfrom Digital/Compaq.  XFree86 rewrote it, filling in some missing pieces
1430*4882a593Smuzhiyunand improving both X11 core protocol compliance and performance.  The
1431*4882a593SmuzhiyunXinerama extension will be passing through X.Org's standardization
1432*4882a593Smuzhiyunprocess in the near future, and the sample implementation will be based
1433*4882a593Smuzhiyunon this rewritten version.
1434*4882a593Smuzhiyun</para>
1435*4882a593Smuzhiyun
1436*4882a593Smuzhiyun<para>The current implementation of Xinerama is based primarily in the DIX
1437*4882a593Smuzhiyun(device independent) and MI (machine independent) layers of the X
1438*4882a593Smuzhiyunserver.  With few exceptions the DDX layers do not need any changes to
1439*4882a593Smuzhiyunsupport Xinerama.  X server extensions often do need modifications to
1440*4882a593Smuzhiyunprovide full Xinerama functionality.
1441*4882a593Smuzhiyun</para>
1442*4882a593Smuzhiyun
1443*4882a593Smuzhiyun<para>The following is a code-level description of how Xinerama functions.
1444*4882a593Smuzhiyun</para>
1445*4882a593Smuzhiyun
1446*4882a593Smuzhiyun<para>Note: Because the Xinerama extension was originally called the
1447*4882a593SmuzhiyunPanoramiX extension, many of the Xinerama functions still have the
1448*4882a593SmuzhiyunPanoramiX prefix.
1449*4882a593Smuzhiyun</para>
1450*4882a593Smuzhiyun
1451*4882a593Smuzhiyun<variablelist>
1452*4882a593Smuzhiyun<varlistentry>
1453*4882a593Smuzhiyun<term>PanoramiXExtensionInit()</term>
1454*4882a593Smuzhiyun<listitem>
1455*4882a593Smuzhiyun    <para>PanoramiXExtensionInit() is a
1456*4882a593Smuzhiyun    device-independent extension function that is called at the start of
1457*4882a593Smuzhiyun    each server generation from InitExtensions(), which is called from
1458*4882a593Smuzhiyun    the X server's main() function after all output devices have been
1459*4882a593Smuzhiyun    initialized, but before any input devices have been initialized.
1460*4882a593Smuzhiyun    </para>
1461*4882a593Smuzhiyun
1462*4882a593Smuzhiyun    <para>PanoramiXNumScreens is set to the number of physical screens.  If
1463*4882a593Smuzhiyun    only one physical screen is present, the extension is disabled, and
1464*4882a593Smuzhiyun    PanoramiXExtensionInit() returns without doing anything else.
1465*4882a593Smuzhiyun    </para>
1466*4882a593Smuzhiyun
1467*4882a593Smuzhiyun    <para>The Xinerama extension is registered by calling AddExtension().
1468*4882a593Smuzhiyun    </para>
1469*4882a593Smuzhiyun
1470*4882a593Smuzhiyun    <para>GC and Screen private
1471*4882a593Smuzhiyun    indexes are allocated, and both GC and Screen private areas are
1472*4882a593Smuzhiyun    allocated for each physical screen.  These hold Xinerama-specific
1473*4882a593Smuzhiyun    per-GC and per-Screen data.  Each screen's CreateGC and CloseScreen
1474*4882a593Smuzhiyun    functions are wrapped by XineramaCreateGC() and
1475*4882a593Smuzhiyun    XineramaCloseScreen() respectively.  Some new resource classes are
1476*4882a593Smuzhiyun    created for Xinerama drawables and GCs, and resource types for
1477*4882a593Smuzhiyun    Xinerama windows, pixmaps and colormaps.
1478*4882a593Smuzhiyun    </para>
1479*4882a593Smuzhiyun
1480*4882a593Smuzhiyun    <para>A region (PanoramiXScreenRegion) is
1481*4882a593Smuzhiyun    initialized to be the union of the screen regions.
1482*4882a593Smuzhiyun    The relative positioning information for the
1483*4882a593Smuzhiyun    physical screens is taken from the ScreenRec x and y members, which
1484*4882a593Smuzhiyun    the DDX layer must initialize in InitOutput().  The bounds of the
1485*4882a593Smuzhiyun    combined screen is also calculated (PanoramiXPixWidth and
1486*4882a593Smuzhiyun    PanoramiXPixHeight).
1487*4882a593Smuzhiyun    </para>
1488*4882a593Smuzhiyun
1489*4882a593Smuzhiyun    <para>The DIX layer has a list of function pointers
1490*4882a593Smuzhiyun    (ProcVector&lsqb;&rsqb;) that
1491*4882a593Smuzhiyun    holds the entry points for the functions that process core protocol
1492*4882a593Smuzhiyun    requests.  The requests that Xinerama must intercept and break up
1493*4882a593Smuzhiyun    into physical screen-specific requests are wrapped.  The original
1494*4882a593Smuzhiyun    set is copied to SavedProcVector&lsqb;&rsqb;.  The types of requests
1495*4882a593Smuzhiyun    intercepted are Window requests, GC requests, colormap requests,
1496*4882a593Smuzhiyun    drawing requests, and some geometry-related requests.  This wrapping
1497*4882a593Smuzhiyun    allows the bulk of the protocol request processing to be handled
1498*4882a593Smuzhiyun    transparently to the DIX layer.  Some operations cannot be dealt with
1499*4882a593Smuzhiyun    in this way and are handled with Xinerama-specific code within the
1500*4882a593Smuzhiyun    DIX layer.
1501*4882a593Smuzhiyun    </para>
1502*4882a593Smuzhiyun</listitem></varlistentry>
1503*4882a593Smuzhiyun
1504*4882a593Smuzhiyun<varlistentry>
1505*4882a593Smuzhiyun<term>PanoramiXConsolidate()</term>
1506*4882a593Smuzhiyun<listitem>
1507*4882a593Smuzhiyun    <para>PanoramiXConsolidate() is a
1508*4882a593Smuzhiyun    device-independent extension function that is called directly from
1509*4882a593Smuzhiyun    the X server's main() function after extensions and input/output
1510*4882a593Smuzhiyun    devices have been initialized, and before the root windows are
1511*4882a593Smuzhiyun    defined and initialized.
1512*4882a593Smuzhiyun</para>
1513*4882a593Smuzhiyun
1514*4882a593Smuzhiyun    <para>This function finds the set of depths (PanoramiXDepths&lsqb;&rsqb;) and
1515*4882a593Smuzhiyun    visuals (PanoramiXVisuals&lsqb;&rsqb;)
1516*4882a593Smuzhiyun    common to all of the physical screens.
1517*4882a593Smuzhiyun    PanoramiXNumDepths is set to the number of common depths, and
1518*4882a593Smuzhiyun    PanoramiXNumVisuals is set to the number of common visuals.
1519*4882a593Smuzhiyun    Resources are created for the single root window and the default
1520*4882a593Smuzhiyun    colormap.  Each of these resources has per-physical screen entries.
1521*4882a593Smuzhiyun    </para>
1522*4882a593Smuzhiyun</listitem></varlistentry>
1523*4882a593Smuzhiyun
1524*4882a593Smuzhiyun<varlistentry>
1525*4882a593Smuzhiyun<term>PanoramiXCreateConnectionBlock()</term>
1526*4882a593Smuzhiyun<listitem>
1527*4882a593Smuzhiyun    <para>PanoramiXConsolidate() is a
1528*4882a593Smuzhiyun    device-independent extension function that is called directly from
1529*4882a593Smuzhiyun    the X server's main() function after the per-physical screen root
1530*4882a593Smuzhiyun    windows are created.  It is called instead of the standard DIX
1531*4882a593Smuzhiyun    CreateConnectionBlock() function.  If this function returns FALSE,
1532*4882a593Smuzhiyun    the X server exits with a fatal error.  This function will return
1533*4882a593Smuzhiyun    FALSE if no common depths were found in PanoramiXConsolidate().
1534*4882a593Smuzhiyun    With no common depths, Xinerama mode is not possible.
1535*4882a593Smuzhiyun    </para>
1536*4882a593Smuzhiyun
1537*4882a593Smuzhiyun    <para>The connection block holds the information that clients get when
1538*4882a593Smuzhiyun    they open a connection to the X server.  It includes information
1539*4882a593Smuzhiyun    such as the supported pixmap formats, number of screens and the
1540*4882a593Smuzhiyun    sizes, depths, visuals, default colormap information, etc, for each
1541*4882a593Smuzhiyun    of the screens (much of information that <command>xdpyinfo</command> shows).  The
1542*4882a593Smuzhiyun    connection block is initialized with the combined single screen
1543*4882a593Smuzhiyun    values that were calculated in the above two functions.
1544*4882a593Smuzhiyun    </para>
1545*4882a593Smuzhiyun
1546*4882a593Smuzhiyun    <para>The Xinerama extension allows the registration of connection
1547*4882a593Smuzhiyun    block callback functions.  The purpose of these is to allow other
1548*4882a593Smuzhiyun    extensions to do processing at this point.  These callbacks can be
1549*4882a593Smuzhiyun    registered by calling XineramaRegisterConnectionBlockCallback() from
1550*4882a593Smuzhiyun    the other extension's ExtensionInit() function.  Each registered
1551*4882a593Smuzhiyun    connection block callback is called at the end of
1552*4882a593Smuzhiyun    PanoramiXCreateConnectionBlock().
1553*4882a593Smuzhiyun    </para>
1554*4882a593Smuzhiyun</listitem></varlistentry>
1555*4882a593Smuzhiyun</variablelist>
1556*4882a593Smuzhiyun
1557*4882a593Smuzhiyun<sect3>
1558*4882a593Smuzhiyun<title>Xinerama-specific changes to the DIX code</title>
1559*4882a593Smuzhiyun
1560*4882a593Smuzhiyun<para>There are a few types of Xinerama-specific changes within the DIX
1561*4882a593Smuzhiyuncode.  The main ones are described here.
1562*4882a593Smuzhiyun</para>
1563*4882a593Smuzhiyun
1564*4882a593Smuzhiyun<para>Functions that deal with colormap or GC -related operations outside of
1565*4882a593Smuzhiyunthe intercepted protocol requests have a test added to only do the
1566*4882a593Smuzhiyunprocessing for screen numbers &gt; 0.  This is because they are handled for
1567*4882a593Smuzhiyunthe single Xinerama screen and the processing is done once for screen 0.
1568*4882a593Smuzhiyun</para>
1569*4882a593Smuzhiyun
1570*4882a593Smuzhiyun<para>The handling of motion events does some coordinate translation between
1571*4882a593Smuzhiyunthe physical screen's origin and screen zero's origin.  Also, motion
1572*4882a593Smuzhiyunevents must be reported relative to the composite screen origin rather
1573*4882a593Smuzhiyunthan the physical screen origins.
1574*4882a593Smuzhiyun</para>
1575*4882a593Smuzhiyun
1576*4882a593Smuzhiyun<para>There is some special handling for cursor, window and event processing
1577*4882a593Smuzhiyunthat cannot (either not at all or not conveniently) be done via the
1578*4882a593Smuzhiyunintercepted protocol requests.  A particular case is the handling of
1579*4882a593Smuzhiyunpointers moving between physical screens.
1580*4882a593Smuzhiyun</para>
1581*4882a593Smuzhiyun</sect3>
1582*4882a593Smuzhiyun
1583*4882a593Smuzhiyun<sect3>
1584*4882a593Smuzhiyun<title>Xinerama-specific changes to the MI code</title>
1585*4882a593Smuzhiyun
1586*4882a593Smuzhiyun<para>The only Xinerama-specific change to the MI code is in miSendExposures()
1587*4882a593Smuzhiyunto handle the coordinate (and window ID) translation for expose events.
1588*4882a593Smuzhiyun</para>
1589*4882a593Smuzhiyun</sect3>
1590*4882a593Smuzhiyun
1591*4882a593Smuzhiyun<sect3>
1592*4882a593Smuzhiyun<title>Intercepted DIX core requests</title>
1593*4882a593Smuzhiyun
1594*4882a593Smuzhiyun<para>Xinerama breaks up drawing requests for dispatch to each physical
1595*4882a593Smuzhiyunscreen.  It also breaks up windows into pieces for each physical screen.
1596*4882a593SmuzhiyunGCs are translated into per-screen GCs.  Colormaps are replicated on
1597*4882a593Smuzhiyuneach physical screen.  The functions handling the intercepted requests
1598*4882a593Smuzhiyuntake care of breaking the requests and repackaging them so that they can
1599*4882a593Smuzhiyunbe passed to the standard request handling functions for each screen in
1600*4882a593Smuzhiyunturn.  In addition, and to aid the repackaging, the information from
1601*4882a593Smuzhiyunmany of the intercepted requests is used to keep up to date the
1602*4882a593Smuzhiyunnecessary state information for the single composite screen.  Requests
1603*4882a593Smuzhiyun(usually those with replies) that can be satisfied completely from this
1604*4882a593Smuzhiyunstored state information do not call the standard request handling
1605*4882a593Smuzhiyunfunctions.
1606*4882a593Smuzhiyun</para>
1607*4882a593Smuzhiyun
1608*4882a593Smuzhiyun</sect3>
1609*4882a593Smuzhiyun
1610*4882a593Smuzhiyun</sect2>
1611*4882a593Smuzhiyun
1612*4882a593Smuzhiyun</sect1>
1613*4882a593Smuzhiyun
1614*4882a593Smuzhiyun<!-- ============================================================ -->
1615*4882a593Smuzhiyun
1616*4882a593Smuzhiyun<sect1>
1617*4882a593Smuzhiyun<title>Development Results</title>
1618*4882a593Smuzhiyun
1619*4882a593Smuzhiyun<para>In this section the results of each phase of development are
1620*4882a593Smuzhiyundiscussed.  This development took place between approximately June 2001
1621*4882a593Smuzhiyunand July 2003.
1622*4882a593Smuzhiyun</para>
1623*4882a593Smuzhiyun
1624*4882a593Smuzhiyun<sect2>
1625*4882a593Smuzhiyun<title>Phase I</title>
1626*4882a593Smuzhiyun
1627*4882a593Smuzhiyun<para>The initial development phase dealt with the basic implementation
1628*4882a593Smuzhiyunincluding the bootstrap code, which used the shadow framebuffer, and the
1629*4882a593Smuzhiyununoptimized implementation, based on an Xnest-style implementation.
1630*4882a593Smuzhiyun</para>
1631*4882a593Smuzhiyun
1632*4882a593Smuzhiyun<sect3>
1633*4882a593Smuzhiyun<title>Scope</title>
1634*4882a593Smuzhiyun
1635*4882a593Smuzhiyun<para>The goal of Phase I is to provide fundamental functionality that can
1636*4882a593Smuzhiyunact as a foundation for ongoing work:
1637*4882a593Smuzhiyun<orderedlist>
1638*4882a593Smuzhiyun<listitem>
1639*4882a593Smuzhiyun    <para>Develop the proxy X server
1640*4882a593Smuzhiyun    <itemizedlist>
1641*4882a593Smuzhiyun	<listitem>
1642*4882a593Smuzhiyun	<para>The proxy X server will operate on the X11 protocol and
1643*4882a593Smuzhiyun	relay requests as necessary to correctly perform the request.
1644*4882a593Smuzhiyun	</para></listitem>
1645*4882a593Smuzhiyun	<listitem>
1646*4882a593Smuzhiyun	<para>Work will be based on the existing work for Xinerama and
1647*4882a593Smuzhiyun	Xnest.
1648*4882a593Smuzhiyun	</para></listitem>
1649*4882a593Smuzhiyun	<listitem>
1650*4882a593Smuzhiyun	<para>Input events and windowing operations are handled in the
1651*4882a593Smuzhiyun	proxy server and rendering requests are repackaged and sent to
1652*4882a593Smuzhiyun	each of the back-end servers for display.
1653*4882a593Smuzhiyun	</para></listitem>
1654*4882a593Smuzhiyun	<listitem>
1655*4882a593Smuzhiyun	<para>The multiple screen layout (including support for
1656*4882a593Smuzhiyun	overlapping screens) will be user configurable via a
1657*4882a593Smuzhiyun	configuration file or through the configuration tool.
1658*4882a593Smuzhiyun	</para></listitem>
1659*4882a593Smuzhiyun    </itemizedlist>
1660*4882a593Smuzhiyun    </para></listitem>
1661*4882a593Smuzhiyun    <listitem>
1662*4882a593Smuzhiyun    <para>Develop graphical configuration tool
1663*4882a593Smuzhiyun    <itemizedlist>
1664*4882a593Smuzhiyun	<listitem>
1665*4882a593Smuzhiyun	<para>There will be potentially a large number of X servers to
1666*4882a593Smuzhiyun	configure into a single display.  The tool will allow the user
1667*4882a593Smuzhiyun	to specify which servers are involved in the configuration and
1668*4882a593Smuzhiyun	how they should be laid out.
1669*4882a593Smuzhiyun	</para></listitem>
1670*4882a593Smuzhiyun    </itemizedlist>
1671*4882a593Smuzhiyun    </para></listitem>
1672*4882a593Smuzhiyun    <listitem>
1673*4882a593Smuzhiyun    <para>Pass the X Test Suite
1674*4882a593Smuzhiyun    <itemizedlist>
1675*4882a593Smuzhiyun	<listitem>
1676*4882a593Smuzhiyun	<para>The X Test Suite covers the basic X11 operations.  All
1677*4882a593Smuzhiyun	tests known to succeed must correctly operate in the distributed
1678*4882a593Smuzhiyun	X environment.
1679*4882a593Smuzhiyun	</para></listitem>
1680*4882a593Smuzhiyun    </itemizedlist>
1681*4882a593Smuzhiyun    </para></listitem>
1682*4882a593Smuzhiyun</orderedlist>
1683*4882a593Smuzhiyun
1684*4882a593Smuzhiyun</para>
1685*4882a593Smuzhiyun
1686*4882a593Smuzhiyun<para>For this phase, the back-end X servers are assumed to be unmodified X
1687*4882a593Smuzhiyunservers that do not support any DMX-related protocol extensions; future
1688*4882a593Smuzhiyunoptimization pathways are considered, but are not implemented; and the
1689*4882a593Smuzhiyunconfiguration tool is assumed to rely only on libraries in the X source
1690*4882a593Smuzhiyuntree (e.g., Xt).
1691*4882a593Smuzhiyun</para>
1692*4882a593Smuzhiyun</sect3>
1693*4882a593Smuzhiyun
1694*4882a593Smuzhiyun<sect3>
1695*4882a593Smuzhiyun<title>Results</title>
1696*4882a593Smuzhiyun
1697*4882a593Smuzhiyun<para>The proxy X server, Xdmx, was developed to distribute X11 protocol
1698*4882a593Smuzhiyunrequests to the set of back-end X servers.  It opens a window on each
1699*4882a593Smuzhiyunback-end server, which represents the part of the front-end's root
1700*4882a593Smuzhiyunwindow that is visible on that screen.  It mirrors window, pixmap and
1701*4882a593Smuzhiyunother state in each back-end server.  Drawing requests are sent to
1702*4882a593Smuzhiyuneither windows or pixmaps on each back-end server.  This code is based
1703*4882a593Smuzhiyunon Xnest and uses the existing Xinerama extension.
1704*4882a593Smuzhiyun</para>
1705*4882a593Smuzhiyun
1706*4882a593Smuzhiyun<para>Input events can be taken from (1) devices attached to the back-end
1707*4882a593Smuzhiyunserver, (2) core devices attached directly to the Xdmx server, or (3)
1708*4882a593Smuzhiyunfrom a ``console'' window on another X server.  Events for these devices
1709*4882a593Smuzhiyunare gathered, processed and delivered to clients attached to the Xdmx
1710*4882a593Smuzhiyunserver.
1711*4882a593Smuzhiyun</para>
1712*4882a593Smuzhiyun
1713*4882a593Smuzhiyun<para>An intuitive configuration format was developed to help the user
1714*4882a593Smuzhiyuneasily configure the multiple back-end X servers.  It was defined (see
1715*4882a593Smuzhiyungrammar in Xdmx man page) and a parser was implemented that is used by
1716*4882a593Smuzhiyunthe Xdmx server and by a standalone xdmxconfig utility.  The parsing
1717*4882a593Smuzhiyunsupport was implemented such that it can be easily factored out of the X
1718*4882a593Smuzhiyunsource tree for use with other tools (e.g., vdl).  Support for
1719*4882a593Smuzhiyunconverting legacy vdl-format configuration files to the DMX format is
1720*4882a593Smuzhiyunprovided by the vdltodmx utility.
1721*4882a593Smuzhiyun</para>
1722*4882a593Smuzhiyun
1723*4882a593Smuzhiyun<para>Originally, the configuration file was going to be a subsection of
1724*4882a593SmuzhiyunXFree86's XF86Config file, but that was not possible since Xdmx is a
1725*4882a593Smuzhiyuncompletely separate X server.  Thus, a separate config file format was
1726*4882a593Smuzhiyundeveloped.  In addition, a graphical configuration
1727*4882a593Smuzhiyuntool, xdmxconfig, was developed to allow the user to create and arrange
1728*4882a593Smuzhiyunthe screens in the configuration file.  The <emphasis remap="bf">-configfile</emphasis> and <emphasis remap="bf">-config</emphasis>
1729*4882a593Smuzhiyuncommand-line options can be used to start Xdmx using a configuration
1730*4882a593Smuzhiyunfile.
1731*4882a593Smuzhiyun</para>
1732*4882a593Smuzhiyun
1733*4882a593Smuzhiyun<para>An extension that enables remote input testing is required for the X
1734*4882a593SmuzhiyunTest Suite to function.  During this phase, this extension (XTEST) was
1735*4882a593Smuzhiyunimplemented in the Xdmx server.  The results from running the X Test
1736*4882a593SmuzhiyunSuite are described in detail below.
1737*4882a593Smuzhiyun</para>
1738*4882a593Smuzhiyun</sect3>
1739*4882a593Smuzhiyun
1740*4882a593Smuzhiyun<sect3>
1741*4882a593Smuzhiyun<title>X Test Suite</title>
1742*4882a593Smuzhiyun
1743*4882a593Smuzhiyun        <sect4>
1744*4882a593Smuzhiyun          <title>Introduction</title>
1745*4882a593Smuzhiyun            <para>
1746*4882a593Smuzhiyun              The X Test Suite contains tests that verify Xlib functions
1747*4882a593Smuzhiyun              operate correctly.  The test suite is designed to run on a
1748*4882a593Smuzhiyun              single X server; however, since X applications will not be
1749*4882a593Smuzhiyun              able to tell the difference between the DMX server and a
1750*4882a593Smuzhiyun              standard X server, the X Test Suite should also run on the
1751*4882a593Smuzhiyun              DMX server.
1752*4882a593Smuzhiyun            </para>
1753*4882a593Smuzhiyun            <para>
1754*4882a593Smuzhiyun              The Xdmx server was tested with the X Test Suite, and the
1755*4882a593Smuzhiyun              existing failures are noted in this section.  To put these
1756*4882a593Smuzhiyun              results in perspective, we first discuss expected X Test
1757*4882a593Smuzhiyun              failures and how errors in underlying systems can impact
1758*4882a593Smuzhiyun              Xdmx test results.
1759*4882a593Smuzhiyun            </para>
1760*4882a593Smuzhiyun        </sect4>
1761*4882a593Smuzhiyun
1762*4882a593Smuzhiyun        <sect4>
1763*4882a593Smuzhiyun          <title>Expected Failures for a Single Head</title>
1764*4882a593Smuzhiyun            <para>
1765*4882a593Smuzhiyun              A correctly implemented X server with a single screen is
1766*4882a593Smuzhiyun              expected to fail certain X Test tests.  The following
1767*4882a593Smuzhiyun              well-known errors occur because of rounding error in the X
1768*4882a593Smuzhiyun              server code:
1769*4882a593Smuzhiyun              <literallayout>
1770*4882a593SmuzhiyunXDrawArc: Tests 42, 63, 66, 73
1771*4882a593SmuzhiyunXDrawArcs: Tests 45, 66, 69, 76
1772*4882a593Smuzhiyun              </literallayout>
1773*4882a593Smuzhiyun            </para>
1774*4882a593Smuzhiyun            <para>
1775*4882a593Smuzhiyun              The following failures occur because of the high-level X
1776*4882a593Smuzhiyun              server implementation:
1777*4882a593Smuzhiyun              <literallayout>
1778*4882a593SmuzhiyunXLoadQueryFont: Test 1
1779*4882a593SmuzhiyunXListFontsWithInfo: Tests 3, 4
1780*4882a593SmuzhiyunXQueryFont: Tests 1, 2
1781*4882a593Smuzhiyun              </literallayout>
1782*4882a593Smuzhiyun            </para>
1783*4882a593Smuzhiyun            <para>
1784*4882a593Smuzhiyun              The following test fails when running the X server as root
1785*4882a593Smuzhiyun              under Linux because of the way directory modes are
1786*4882a593Smuzhiyun              interpreted:
1787*4882a593Smuzhiyun              <literallayout>
1788*4882a593SmuzhiyunXWriteBitmapFile: Test 3
1789*4882a593Smuzhiyun              </literallayout>
1790*4882a593Smuzhiyun            </para>
1791*4882a593Smuzhiyun            <para>
1792*4882a593Smuzhiyun              Depending on the video card used for the back-end, other
1793*4882a593Smuzhiyun              failures may also occur because of bugs in the low-level
1794*4882a593Smuzhiyun              driver implementation.  Over time, failures of this kind
1795*4882a593Smuzhiyun              are usually fixed by XFree86, but will show up in Xdmx
1796*4882a593Smuzhiyun              testing until then.
1797*4882a593Smuzhiyun            </para>
1798*4882a593Smuzhiyun        </sect4>
1799*4882a593Smuzhiyun
1800*4882a593Smuzhiyun        <sect4>
1801*4882a593Smuzhiyun          <title>Expected Failures for Xinerama</title>
1802*4882a593Smuzhiyun            <para>
1803*4882a593Smuzhiyun              Xinerama fails several X Test Suite tests because of
1804*4882a593Smuzhiyun              design decisions made for the current implementation of
1805*4882a593Smuzhiyun              Xinerama.  Over time, many of these errors will be
1806*4882a593Smuzhiyun              corrected by XFree86 and the group working on a new
1807*4882a593Smuzhiyun              Xinerama implementation.  Therefore, Xdmx will also share
1808*4882a593Smuzhiyun              X Suite Test failures with Xinerama.
1809*4882a593Smuzhiyun            </para>
1810*4882a593Smuzhiyun
1811*4882a593Smuzhiyun            <para>
1812*4882a593Smuzhiyun              We may be able to fix or work-around some of these
1813*4882a593Smuzhiyun              failures at the Xdmx level, but this will require
1814*4882a593Smuzhiyun              additional exploration that was not part of Phase I.
1815*4882a593Smuzhiyun            </para>
1816*4882a593Smuzhiyun
1817*4882a593Smuzhiyun            <para>
1818*4882a593Smuzhiyun              Xinerama is constantly improving, and the list of
1819*4882a593Smuzhiyun              Xinerama-related failures depends on XFree86 version and
1820*4882a593Smuzhiyun              the underlying graphics hardware.  We tested with a
1821*4882a593Smuzhiyun              variety of hardware, including nVidia, S3, ATI Radeon,
1822*4882a593Smuzhiyun              and Matrox G400 (in dual-head mode).  The list below
1823*4882a593Smuzhiyun              includes only those failures that appear to be from the
1824*4882a593Smuzhiyun              Xinerama layer, and does not include failures listed in
1825*4882a593Smuzhiyun              the previous section, or failures that appear to be from
1826*4882a593Smuzhiyun              the low-level graphics driver itself:
1827*4882a593Smuzhiyun            </para>
1828*4882a593Smuzhiyun
1829*4882a593Smuzhiyun            <para>
1830*4882a593Smuzhiyun              These failures were noted with multiple Xinerama
1831*4882a593Smuzhiyun              configurations:
1832*4882a593Smuzhiyun              <literallayout>
1833*4882a593SmuzhiyunXCopyPlane: Tests 13, 22, 31 (well-known Xinerama implementation issue)
1834*4882a593SmuzhiyunXSetFontPath: Test 4
1835*4882a593SmuzhiyunXGetDefault: Test 5
1836*4882a593SmuzhiyunXMatchVisualInfo: Test 1
1837*4882a593Smuzhiyun              </literallayout>
1838*4882a593Smuzhiyun            </para>
1839*4882a593Smuzhiyun            <para>
1840*4882a593Smuzhiyun              These failures were noted only when using one dual-head
1841*4882a593Smuzhiyun              video card with a 4.2.99.x XFree86 server:
1842*4882a593Smuzhiyun              <literallayout>
1843*4882a593SmuzhiyunXListPixmapFormats: Test 1
1844*4882a593SmuzhiyunXDrawRectangles: Test 45
1845*4882a593Smuzhiyun              </literallayout>
1846*4882a593Smuzhiyun            </para>
1847*4882a593Smuzhiyun            <para>
1848*4882a593Smuzhiyun              These failures were noted only when using two video cards
1849*4882a593Smuzhiyun              from different vendors with a 4.1.99.x XFree86 server:
1850*4882a593Smuzhiyun              <literallayout>
1851*4882a593SmuzhiyunXChangeWindowAttributes: Test 32
1852*4882a593SmuzhiyunXCreateWindow: Test 30
1853*4882a593SmuzhiyunXDrawLine: Test 22
1854*4882a593SmuzhiyunXFillArc: Test 22
1855*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
1856*4882a593SmuzhiyunXRebindKeysym: Test 1
1857*4882a593Smuzhiyun              </literallayout>
1858*4882a593Smuzhiyun            </para>
1859*4882a593Smuzhiyun        </sect4>
1860*4882a593Smuzhiyun
1861*4882a593Smuzhiyun        <sect4>
1862*4882a593Smuzhiyun	  <title>Additional Failures from Xdmx</title>
1863*4882a593Smuzhiyun
1864*4882a593Smuzhiyun            <para>
1865*4882a593Smuzhiyun              When running Xdmx, no unexpected failures were noted.
1866*4882a593Smuzhiyun              Since the Xdmx server is based on Xinerama, we expect to
1867*4882a593Smuzhiyun              have most of the Xinerama failures present in the Xdmx
1868*4882a593Smuzhiyun              server.  Similarly, since the Xdmx server must rely on the
1869*4882a593Smuzhiyun              low-level device drivers on each back-end server, we also
1870*4882a593Smuzhiyun              expect that Xdmx will exhibit most of the back-end
1871*4882a593Smuzhiyun              failures.  Here is a summary:
1872*4882a593Smuzhiyun              <literallayout>
1873*4882a593SmuzhiyunXListPixmapFormats: Test 1 (configuration dependent)
1874*4882a593SmuzhiyunXChangeWindowAttributes: Test 32
1875*4882a593SmuzhiyunXCreateWindow: Test 30
1876*4882a593SmuzhiyunXCopyPlane: Test 13, 22, 31
1877*4882a593SmuzhiyunXSetFontPath: Test 4
1878*4882a593SmuzhiyunXGetDefault: Test 5 (configuration dependent)
1879*4882a593SmuzhiyunXMatchVisualInfo: Test 1
1880*4882a593SmuzhiyunXRebindKeysym: Test 1 (configuration dependent)
1881*4882a593Smuzhiyun                </literallayout>
1882*4882a593Smuzhiyun            </para>
1883*4882a593Smuzhiyun            <para>
1884*4882a593Smuzhiyun              Note that this list is shorter than the combined list for
1885*4882a593Smuzhiyun              Xinerama because Xdmx uses different code paths to perform
1886*4882a593Smuzhiyun              some Xinerama operations.  Further, some Xinerama failures
1887*4882a593Smuzhiyun              have been fixed in the XFree86 4.2.99.x CVS repository.
1888*4882a593Smuzhiyun            </para>
1889*4882a593Smuzhiyun        </sect4>
1890*4882a593Smuzhiyun
1891*4882a593Smuzhiyun        <sect4>
1892*4882a593Smuzhiyun          <title>Summary and Future Work</title>
1893*4882a593Smuzhiyun
1894*4882a593Smuzhiyun            <para>
1895*4882a593Smuzhiyun              Running the X Test Suite on Xdmx does not produce any
1896*4882a593Smuzhiyun              failures that cannot be accounted for by the underlying
1897*4882a593Smuzhiyun              Xinerama subsystem used by the front-end or by the
1898*4882a593Smuzhiyun              low-level device-driver code running on the back-end X
1899*4882a593Smuzhiyun              servers.  The Xdmx server therefore is as ``correct'' as
1900*4882a593Smuzhiyun              possible with respect to the standard set of X Test Suite
1901*4882a593Smuzhiyun              tests.
1902*4882a593Smuzhiyun            </para>
1903*4882a593Smuzhiyun
1904*4882a593Smuzhiyun            <para>
1905*4882a593Smuzhiyun              During the following phases, we will continue to verify
1906*4882a593Smuzhiyun              Xdmx correctness using the X Test Suite.  We may also use
1907*4882a593Smuzhiyun              other tests suites or write additional tests that run
1908*4882a593Smuzhiyun              under the X Test Suite that specifically verify the
1909*4882a593Smuzhiyun              expected behavior of DMX.
1910*4882a593Smuzhiyun            </para>
1911*4882a593Smuzhiyun        </sect4>
1912*4882a593Smuzhiyun</sect3>
1913*4882a593Smuzhiyun
1914*4882a593Smuzhiyun<sect3>
1915*4882a593Smuzhiyun<title>Fonts</title>
1916*4882a593Smuzhiyun
1917*4882a593Smuzhiyun<para>In Phase I, fonts are handled directly by both the front-end and the
1918*4882a593Smuzhiyunback-end servers, which is required since we must treat each back-end
1919*4882a593Smuzhiyunserver during this phase as a ``black box''.  What this requires is that
1920*4882a593Smuzhiyun<emphasis remap="bf">the front- and back-end servers must share the exact same font
1921*4882a593Smuzhiyunpath</emphasis>.  There are two ways to help make sure that all servers share the
1922*4882a593Smuzhiyunsame font path:
1923*4882a593Smuzhiyun
1924*4882a593Smuzhiyun<orderedlist>
1925*4882a593Smuzhiyun  <listitem>
1926*4882a593Smuzhiyun    <para>First, each server can be configured to use the same font
1927*4882a593Smuzhiyun    server.  The font server, xfs, can be configured to serve fonts to
1928*4882a593Smuzhiyun    multiple X servers via TCP.
1929*4882a593Smuzhiyun    </para></listitem>
1930*4882a593Smuzhiyun
1931*4882a593Smuzhiyun  <listitem>
1932*4882a593Smuzhiyun    <para>Second, each server can be configured to use the same font
1933*4882a593Smuzhiyun    path and either those font paths can be copied to each back-end
1934*4882a593Smuzhiyun    machine or they can be mounted (e.g., via NFS) on each back-end
1935*4882a593Smuzhiyun    machine.
1936*4882a593Smuzhiyun    </para></listitem>
1937*4882a593Smuzhiyun</orderedlist>
1938*4882a593Smuzhiyun</para>
1939*4882a593Smuzhiyun
1940*4882a593Smuzhiyun<para>One additional concern is that a client program can set its own font
1941*4882a593Smuzhiyunpath, and if it does so, then that font path must be available on each
1942*4882a593Smuzhiyunback-end machine.
1943*4882a593Smuzhiyun</para>
1944*4882a593Smuzhiyun
1945*4882a593Smuzhiyun<para>The -fontpath command line option was added to allow users to
1946*4882a593Smuzhiyuninitialize the font path of the front end server.  This font path is
1947*4882a593Smuzhiyunpropagated to each back-end server when the default font is loaded.  If
1948*4882a593Smuzhiyunthere are any problems, an error message is printed, which will describe
1949*4882a593Smuzhiyunthe problem and list the current font path.  For more information about
1950*4882a593Smuzhiyunsetting the font path, see the -fontpath option description in the man
1951*4882a593Smuzhiyunpage.
1952*4882a593Smuzhiyun</para>
1953*4882a593Smuzhiyun</sect3>
1954*4882a593Smuzhiyun
1955*4882a593Smuzhiyun<sect3>
1956*4882a593Smuzhiyun<title>Performance</title>
1957*4882a593Smuzhiyun
1958*4882a593Smuzhiyun<para>Phase I of development was not intended to optimize performance.  Its
1959*4882a593Smuzhiyunfocus was on completely and correctly handling the base X11 protocol in
1960*4882a593Smuzhiyunthe Xdmx server.  However, several insights were gained during Phase I,
1961*4882a593Smuzhiyunwhich are listed here for reference during the next phase of
1962*4882a593Smuzhiyundevelopment.
1963*4882a593Smuzhiyun</para>
1964*4882a593Smuzhiyun
1965*4882a593Smuzhiyun<orderedlist>
1966*4882a593Smuzhiyun  <listitem>
1967*4882a593Smuzhiyun    <para>Calls to XSync() can slow down rendering since it requires a
1968*4882a593Smuzhiyun    complete round trip to and from a back-end server.  This is
1969*4882a593Smuzhiyun    especially problematic when communicating over long haul networks.
1970*4882a593Smuzhiyun    </para></listitem>
1971*4882a593Smuzhiyun
1972*4882a593Smuzhiyun  <listitem>
1973*4882a593Smuzhiyun    <para>Sending drawing requests to only the screens that they overlap
1974*4882a593Smuzhiyun    should improve performance.
1975*4882a593Smuzhiyun    </para></listitem>
1976*4882a593Smuzhiyun</orderedlist>
1977*4882a593Smuzhiyun</sect3>
1978*4882a593Smuzhiyun
1979*4882a593Smuzhiyun<sect3>
1980*4882a593Smuzhiyun<title>Pixmaps</title>
1981*4882a593Smuzhiyun
1982*4882a593Smuzhiyun<para>Pixmaps were originally expected to be handled entirely in the
1983*4882a593Smuzhiyunfront-end X server; however, it was found that this overly complicated
1984*4882a593Smuzhiyunthe rendering code and would have required sending potentially large
1985*4882a593Smuzhiyunimages to each back server that required them when copying from pixmap
1986*4882a593Smuzhiyunto screen.  Thus, pixmap state is mirrored in the back-end server just
1987*4882a593Smuzhiyunas it is with regular window state.  With this implementation, the same
1988*4882a593Smuzhiyunrendering code that draws to windows can be used to draw to pixmaps on
1989*4882a593Smuzhiyunthe back-end server, and no large image transfers are required to copy
1990*4882a593Smuzhiyunfrom pixmap to window.
1991*4882a593Smuzhiyun</para>
1992*4882a593Smuzhiyun
1993*4882a593Smuzhiyun</sect3>
1994*4882a593Smuzhiyun
1995*4882a593Smuzhiyun</sect2>
1996*4882a593Smuzhiyun
1997*4882a593Smuzhiyun<!-- ============================================================ -->
1998*4882a593Smuzhiyun<sect2>
1999*4882a593Smuzhiyun<title>Phase II</title>
2000*4882a593Smuzhiyun
2001*4882a593Smuzhiyun<para>The second phase of development concentrates on performance
2002*4882a593Smuzhiyunoptimizations.  These optimizations are documented here, with
2003*4882a593Smuzhiyun<command>x11perf</command> data to show how the optimizations improve performance.
2004*4882a593Smuzhiyun</para>
2005*4882a593Smuzhiyun
2006*4882a593Smuzhiyun<para>All benchmarks were performed by running Xdmx on a dual processor
2007*4882a593Smuzhiyun1.4GHz AMD Athlon machine with 1GB of RAM connecting over 100baseT to
2008*4882a593Smuzhiyuntwo single-processor 1GHz Pentium III machines with 256MB of RAM and ATI
2009*4882a593SmuzhiyunRage 128 (RF) video cards.  The front end was running Linux
2010*4882a593Smuzhiyun2.4.20-pre1-ac1 and the back ends were running Linux 2.4.7-10 and
2011*4882a593Smuzhiyunversion 4.2.99.1 of XFree86 pulled from the XFree86 CVS repository on
2012*4882a593SmuzhiyunAugust 7, 2002.  All systems were running Red Hat Linux 7.2.
2013*4882a593Smuzhiyun</para>
2014*4882a593Smuzhiyun
2015*4882a593Smuzhiyun<sect3>
2016*4882a593Smuzhiyun<title>Moving from XFree86 4.1.99.1 to 4.2.0.0</title>
2017*4882a593Smuzhiyun
2018*4882a593Smuzhiyun<para>For phase II, the working source tree was moved to the branch tagged
2019*4882a593Smuzhiyunwith dmx-1-0-branch and was updated from version 4.1.99.1 (20 August
2020*4882a593Smuzhiyun2001) of the XFree86 sources to version 4.2.0.0 (18 January 2002).
2021*4882a593SmuzhiyunAfter this update, the following tests were noted to be more than 10%
2022*4882a593Smuzhiyunfaster:
2023*4882a593Smuzhiyun<screen>
2024*4882a593Smuzhiyun1.13   Fill 300x300 opaque stippled trapezoid (161x145 stipple)
2025*4882a593Smuzhiyun1.16   Fill 1x1 tiled trapezoid (161x145 tile)
2026*4882a593Smuzhiyun1.13   Fill 10x10 tiled trapezoid (161x145 tile)
2027*4882a593Smuzhiyun1.17   Fill 100x100 tiled trapezoid (161x145 tile)
2028*4882a593Smuzhiyun1.16   Fill 1x1 tiled trapezoid (216x208 tile)
2029*4882a593Smuzhiyun1.20   Fill 10x10 tiled trapezoid (216x208 tile)
2030*4882a593Smuzhiyun1.15   Fill 100x100 tiled trapezoid (216x208 tile)
2031*4882a593Smuzhiyun1.37   Circulate Unmapped window (200 kids)
2032*4882a593Smuzhiyun</screen>
2033*4882a593SmuzhiyunAnd the following tests were noted to be more than 10% slower:
2034*4882a593Smuzhiyun<screen>
2035*4882a593Smuzhiyun0.88   Unmap window via parent (25 kids)
2036*4882a593Smuzhiyun0.75   Circulate Unmapped window (4 kids)
2037*4882a593Smuzhiyun0.79   Circulate Unmapped window (16 kids)
2038*4882a593Smuzhiyun0.80   Circulate Unmapped window (25 kids)
2039*4882a593Smuzhiyun0.82   Circulate Unmapped window (50 kids)
2040*4882a593Smuzhiyun0.85   Circulate Unmapped window (75 kids)
2041*4882a593Smuzhiyun</screen>
2042*4882a593Smuzhiyun</para>
2043*4882a593Smuzhiyun
2044*4882a593Smuzhiyun<para>These changes were not caused by any changes in the DMX system, and
2045*4882a593Smuzhiyunmay point to changes in the XFree86 tree or to tests that have more
2046*4882a593Smuzhiyun"jitter" than most other <command>x11perf</command> tests.
2047*4882a593Smuzhiyun</para>
2048*4882a593Smuzhiyun</sect3>
2049*4882a593Smuzhiyun
2050*4882a593Smuzhiyun<sect3>
2051*4882a593Smuzhiyun<title>Global changes</title>
2052*4882a593Smuzhiyun
2053*4882a593Smuzhiyun<para>During the development of the Phase II DMX server, several global
2054*4882a593Smuzhiyunchanges were made.  These changes were also compared with the Phase I
2055*4882a593Smuzhiyunserver.  The following tests were noted to be more than 10% faster:
2056*4882a593Smuzhiyun<screen>
2057*4882a593Smuzhiyun1.13   Fill 300x300 opaque stippled trapezoid (161x145 stipple)
2058*4882a593Smuzhiyun1.15   Fill 1x1 tiled trapezoid (161x145 tile)
2059*4882a593Smuzhiyun1.13   Fill 10x10 tiled trapezoid (161x145 tile)
2060*4882a593Smuzhiyun1.17   Fill 100x100 tiled trapezoid (161x145 tile)
2061*4882a593Smuzhiyun1.16   Fill 1x1 tiled trapezoid (216x208 tile)
2062*4882a593Smuzhiyun1.19   Fill 10x10 tiled trapezoid (216x208 tile)
2063*4882a593Smuzhiyun1.15   Fill 100x100 tiled trapezoid (216x208 tile)
2064*4882a593Smuzhiyun1.15   Circulate Unmapped window (4 kids)
2065*4882a593Smuzhiyun</screen>
2066*4882a593Smuzhiyun</para>
2067*4882a593Smuzhiyun
2068*4882a593Smuzhiyun<para>The following tests were noted to be more than 10% slower:
2069*4882a593Smuzhiyun<screen>
2070*4882a593Smuzhiyun0.69   Scroll 10x10 pixels
2071*4882a593Smuzhiyun0.68   Scroll 100x100 pixels
2072*4882a593Smuzhiyun0.68   Copy 10x10 from window to window
2073*4882a593Smuzhiyun0.68   Copy 100x100 from window to window
2074*4882a593Smuzhiyun0.76   Circulate Unmapped window (75 kids)
2075*4882a593Smuzhiyun0.83   Circulate Unmapped window (100 kids)
2076*4882a593Smuzhiyun</screen>
2077*4882a593Smuzhiyun</para>
2078*4882a593Smuzhiyun
2079*4882a593Smuzhiyun<para>For the remainder of this analysis, the baseline of comparison will
2080*4882a593Smuzhiyunbe the Phase II deliverable with all optimizations disabled (unless
2081*4882a593Smuzhiyunotherwise noted).  This will highlight how the optimizations in
2082*4882a593Smuzhiyunisolation impact performance.
2083*4882a593Smuzhiyun</para>
2084*4882a593Smuzhiyun</sect3>
2085*4882a593Smuzhiyun
2086*4882a593Smuzhiyun<sect3>
2087*4882a593Smuzhiyun<title>XSync() Batching</title>
2088*4882a593Smuzhiyun
2089*4882a593Smuzhiyun<para>During the Phase I implementation, XSync() was called after every
2090*4882a593Smuzhiyunprotocol request made by the DMX server.  This provided the DMX server
2091*4882a593Smuzhiyunwith an interactive feel, but defeated X11's protocol buffering system
2092*4882a593Smuzhiyunand introduced round-trip wire latency into every operation.  During
2093*4882a593SmuzhiyunPhase II, DMX was changed so that protocol requests are no longer
2094*4882a593Smuzhiyunfollowed by calls to XSync().  Instead, the need for an XSync() is
2095*4882a593Smuzhiyunnoted, and XSync() calls are only made every 100mS or when the DMX
2096*4882a593Smuzhiyunserver specifically needs to make a call to guarantee interactivity.
2097*4882a593SmuzhiyunWith this new system, X11 buffers protocol as much as possible during a
2098*4882a593Smuzhiyun100mS interval, and many unnecessary XSync() calls are avoided.
2099*4882a593Smuzhiyun</para>
2100*4882a593Smuzhiyun
2101*4882a593Smuzhiyun<para>Out of more than 300 <command>x11perf</command> tests, 8 tests became more than 100
2102*4882a593Smuzhiyuntimes faster, with 68 more than 50X faster, 114 more than 10X faster,
2103*4882a593Smuzhiyunand 181 more than 2X faster.  See table below for summary.
2104*4882a593Smuzhiyun</para>
2105*4882a593Smuzhiyun
2106*4882a593Smuzhiyun<para>The following tests were noted to be more than 10% slower with
2107*4882a593SmuzhiyunXSync() batching on:
2108*4882a593Smuzhiyun<screen>
2109*4882a593Smuzhiyun0.88   500x500 tiled rectangle (161x145 tile)
2110*4882a593Smuzhiyun0.89   Copy 500x500 from window to window
2111*4882a593Smuzhiyun</screen>
2112*4882a593Smuzhiyun</para>
2113*4882a593Smuzhiyun</sect3>
2114*4882a593Smuzhiyun
2115*4882a593Smuzhiyun<sect3>
2116*4882a593Smuzhiyun<title>Offscreen Optimization</title>
2117*4882a593Smuzhiyun
2118*4882a593Smuzhiyun<para>Windows span one or more of the back-end servers' screens; however,
2119*4882a593Smuzhiyunduring Phase I development, windows were created on every back-end
2120*4882a593Smuzhiyunserver and every rendering request was sent to every window regardless
2121*4882a593Smuzhiyunof whether or not that window was visible.  With the offscreen
2122*4882a593Smuzhiyunoptimization, the DMX server tracks when a window is completely off of a
2123*4882a593Smuzhiyunback-end server's screen and, in that case, it does not send rendering
2124*4882a593Smuzhiyunrequests to those back-end windows.  This optimization saves bandwidth
2125*4882a593Smuzhiyunbetween the front and back-end servers, and it reduces the number of
2126*4882a593SmuzhiyunXSync() calls.  The performance tests were run on a DMX system with only
2127*4882a593Smuzhiyuntwo back-end servers.  Greater performance gains will be had as the
2128*4882a593Smuzhiyunnumber of back-end servers increases.
2129*4882a593Smuzhiyun</para>
2130*4882a593Smuzhiyun
2131*4882a593Smuzhiyun<para>Out of more than 300 <command>x11perf</command> tests, 3 tests were at least twice as
2132*4882a593Smuzhiyunfast, and 146 tests were at least 10% faster.  Two tests were more than
2133*4882a593Smuzhiyun10% slower with the offscreen optimization:
2134*4882a593Smuzhiyun<screen>
2135*4882a593Smuzhiyun0.88   Hide/expose window via popup (4 kids)
2136*4882a593Smuzhiyun0.89   Resize unmapped window (75 kids)
2137*4882a593Smuzhiyun</screen>
2138*4882a593Smuzhiyun</para>
2139*4882a593Smuzhiyun</sect3>
2140*4882a593Smuzhiyun
2141*4882a593Smuzhiyun<sect3>
2142*4882a593Smuzhiyun<title>Lazy Window Creation Optimization</title>
2143*4882a593Smuzhiyun
2144*4882a593Smuzhiyun<para>As mentioned above, during Phase I, windows were created on every
2145*4882a593Smuzhiyunback-end server even if they were not visible on that back-end.  With
2146*4882a593Smuzhiyunthe lazy window creation optimization, the DMX server does not create
2147*4882a593Smuzhiyunwindows on a back-end server until they are either visible or they
2148*4882a593Smuzhiyunbecome the parents of a visible window.  This optimization builds on the
2149*4882a593Smuzhiyunoffscreen optimization (described above) and requires it to be enabled.
2150*4882a593Smuzhiyun</para>
2151*4882a593Smuzhiyun
2152*4882a593Smuzhiyun<para>The lazy window creation optimization works by creating the window
2153*4882a593Smuzhiyundata structures in the front-end server when a client creates a window,
2154*4882a593Smuzhiyunbut delays creation of the window on the back-end server(s).  A private
2155*4882a593Smuzhiyunwindow structure in the DMX server saves the relevant window data and
2156*4882a593Smuzhiyuntracks changes to the window's attributes and stacking order for later
2157*4882a593Smuzhiyunuse.  The only times a window is created on a back-end server are (1)
2158*4882a593Smuzhiyunwhen it is mapped and is at least partially overlapping the back-end
2159*4882a593Smuzhiyunserver's screen (tracked by the offscreen optimization), or (2) when the
2160*4882a593Smuzhiyunwindow becomes the parent of a previously visible window.  The first
2161*4882a593Smuzhiyuncase occurs when a window is mapped or when a visible window is copied,
2162*4882a593Smuzhiyunmoved or resized and now overlaps the back-end server's screen.  The
2163*4882a593Smuzhiyunsecond case occurs when starting a window manager after having created
2164*4882a593Smuzhiyunwindows to which the window manager needs to add decorations.
2165*4882a593Smuzhiyun</para>
2166*4882a593Smuzhiyun
2167*4882a593Smuzhiyun<para>When either case occurs, a window on the back-end server is created
2168*4882a593Smuzhiyunusing the data saved in the DMX server's window private data structure.
2169*4882a593SmuzhiyunThe stacking order is then adjusted to correctly place the window on the
2170*4882a593Smuzhiyunback-end and lastly the window is mapped.  From this time forward, the
2171*4882a593Smuzhiyunwindow is handled exactly as if the window had been created at the time
2172*4882a593Smuzhiyunof the client's request.
2173*4882a593Smuzhiyun</para>
2174*4882a593Smuzhiyun
2175*4882a593Smuzhiyun<para>Note that when a window is no longer visible on a back-end server's
2176*4882a593Smuzhiyunscreen (e.g., it is moved offscreen), the window is not destroyed;
2177*4882a593Smuzhiyunrather, it is kept and reused later if the window once again becomes
2178*4882a593Smuzhiyunvisible on the back-end server's screen.  Originally with this
2179*4882a593Smuzhiyunoptimization, destroying windows was implemented but was later rejected
2180*4882a593Smuzhiyunbecause it increased bandwidth when windows were opaquely moved or
2181*4882a593Smuzhiyunresized, which is common in many window managers.
2182*4882a593Smuzhiyun</para>
2183*4882a593Smuzhiyun
2184*4882a593Smuzhiyun<para>The performance tests were run on a DMX system with only two back-end
2185*4882a593Smuzhiyunservers.  Greater performance gains will be had as the number of
2186*4882a593Smuzhiyunback-end servers increases.
2187*4882a593Smuzhiyun</para>
2188*4882a593Smuzhiyun
2189*4882a593Smuzhiyun<para>This optimization improved the following <command>x11perf</command> tests by more
2190*4882a593Smuzhiyunthan 10%:
2191*4882a593Smuzhiyun<screen>
2192*4882a593Smuzhiyun1.10   500x500 rectangle outline
2193*4882a593Smuzhiyun1.12   Fill 100x100 stippled trapezoid (161x145 stipple)
2194*4882a593Smuzhiyun1.20   Circulate Unmapped window (50 kids)
2195*4882a593Smuzhiyun1.19   Circulate Unmapped window (75 kids)
2196*4882a593Smuzhiyun</screen>
2197*4882a593Smuzhiyun</para>
2198*4882a593Smuzhiyun</sect3>
2199*4882a593Smuzhiyun
2200*4882a593Smuzhiyun<sect3>
2201*4882a593Smuzhiyun<title>Subdividing Rendering Primitives</title>
2202*4882a593Smuzhiyun
2203*4882a593Smuzhiyun<para>X11 imaging requests transfer significant data between the client and
2204*4882a593Smuzhiyunthe X server.  During Phase I, the DMX server would then transfer the
2205*4882a593Smuzhiyunimage data to each back-end server.  Even with the offscreen
2206*4882a593Smuzhiyunoptimization (above), these requests still required transferring
2207*4882a593Smuzhiyunsignificant data to each back-end server that contained a visible
2208*4882a593Smuzhiyunportion of the window.  For example, if the client uses XPutImage() to
2209*4882a593Smuzhiyuncopy an image to a window that overlaps the entire DMX screen, then the
2210*4882a593Smuzhiyunentire image is copied by the DMX server to every back-end server.
2211*4882a593Smuzhiyun</para>
2212*4882a593Smuzhiyun
2213*4882a593Smuzhiyun<para>To reduce the amount of data transferred between the DMX server and
2214*4882a593Smuzhiyunthe back-end servers when XPutImage() is called, the image data is
2215*4882a593Smuzhiyunsubdivided and only the data that will be visible on a back-end server's
2216*4882a593Smuzhiyunscreen is sent to that back-end server.  Xinerama already implements a
2217*4882a593Smuzhiyunsubdivision algorithm for XGetImage() and no further optimization was
2218*4882a593Smuzhiyunneeded.
2219*4882a593Smuzhiyun</para>
2220*4882a593Smuzhiyun
2221*4882a593Smuzhiyun<para>Other rendering primitives were analyzed, but the time required to
2222*4882a593Smuzhiyunsubdivide these primitives was a significant proportion of the time
2223*4882a593Smuzhiyunrequired to send the entire rendering request to the back-end server, so
2224*4882a593Smuzhiyunthis optimization was rejected for the other rendering primitives.
2225*4882a593Smuzhiyun</para>
2226*4882a593Smuzhiyun
2227*4882a593Smuzhiyun<para>Again, the performance tests were run on a DMX system with only two
2228*4882a593Smuzhiyunback-end servers.  Greater performance gains will be had as the number
2229*4882a593Smuzhiyunof back-end servers increases.
2230*4882a593Smuzhiyun</para>
2231*4882a593Smuzhiyun
2232*4882a593Smuzhiyun<para>This optimization improved the following <command>x11perf</command> tests by more
2233*4882a593Smuzhiyunthan 10%:
2234*4882a593Smuzhiyun<screen>
2235*4882a593Smuzhiyun1.12   Fill 100x100 stippled trapezoid (161x145 stipple)
2236*4882a593Smuzhiyun1.26   PutImage 10x10 square
2237*4882a593Smuzhiyun1.83   PutImage 100x100 square
2238*4882a593Smuzhiyun1.91   PutImage 500x500 square
2239*4882a593Smuzhiyun1.40   PutImage XY 10x10 square
2240*4882a593Smuzhiyun1.48   PutImage XY 100x100 square
2241*4882a593Smuzhiyun1.50   PutImage XY 500x500 square
2242*4882a593Smuzhiyun1.45   Circulate Unmapped window (75 kids)
2243*4882a593Smuzhiyun1.74   Circulate Unmapped window (100 kids)
2244*4882a593Smuzhiyun</screen>
2245*4882a593Smuzhiyun</para>
2246*4882a593Smuzhiyun
2247*4882a593Smuzhiyun<para>The following test was noted to be more than 10% slower with this
2248*4882a593Smuzhiyunoptimization:
2249*4882a593Smuzhiyun<screen>
2250*4882a593Smuzhiyun0.88   10-pixel fill chord partial circle
2251*4882a593Smuzhiyun</screen>
2252*4882a593Smuzhiyun</para>
2253*4882a593Smuzhiyun</sect3>
2254*4882a593Smuzhiyun
2255*4882a593Smuzhiyun<sect3>
2256*4882a593Smuzhiyun<title>Summary of x11perf Data</title>
2257*4882a593Smuzhiyun
2258*4882a593Smuzhiyun<para>With all of the optimizations on, 53 <command>x11perf</command> tests are more than
2259*4882a593Smuzhiyun100X faster than the unoptimized Phase II deliverable, with 69 more than
2260*4882a593Smuzhiyun50X faster, 73 more than 10X faster, and 199 more than twice as fast.
2261*4882a593SmuzhiyunNo tests were more than 10% slower than the unoptimized Phase II
2262*4882a593Smuzhiyundeliverable.  (Compared with the Phase I deliverable, only Circulate
2263*4882a593SmuzhiyunUnmapped window (100 kids) was more than 10% slower than the Phase II
2264*4882a593Smuzhiyundeliverable.  As noted above, this test seems to have wider variability
2265*4882a593Smuzhiyunthan other <command>x11perf</command> tests.)
2266*4882a593Smuzhiyun</para>
2267*4882a593Smuzhiyun
2268*4882a593Smuzhiyun<para>The following table summarizes relative <command>x11perf</command> test changes for
2269*4882a593Smuzhiyunall optimizations individually and collectively.  Note that some of the
2270*4882a593Smuzhiyunoptimizations have a synergistic effect when used together.
2271*4882a593Smuzhiyun<screen>
2272*4882a593Smuzhiyun
2273*4882a593Smuzhiyun1: XSync() batching only
2274*4882a593Smuzhiyun2: Off screen optimizations only
2275*4882a593Smuzhiyun3: Window optimizations only
2276*4882a593Smuzhiyun4: Subdivprims only
2277*4882a593Smuzhiyun5: All optimizations
2278*4882a593Smuzhiyun
2279*4882a593Smuzhiyun    1     2    3    4      5 Operation
2280*4882a593Smuzhiyun------ ---- ---- ---- ------ ---------
2281*4882a593Smuzhiyun  2.14 1.85 1.00 1.00   4.13 Dot
2282*4882a593Smuzhiyun  1.67 1.80 1.00 1.00   3.31 1x1 rectangle
2283*4882a593Smuzhiyun  2.38 1.43 1.00 1.00   2.44 10x10 rectangle
2284*4882a593Smuzhiyun  1.00 1.00 0.92 0.98   1.00 100x100 rectangle
2285*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 500x500 rectangle
2286*4882a593Smuzhiyun  1.83 1.85 1.05 1.06   3.54 1x1 stippled rectangle (8x8 stipple)
2287*4882a593Smuzhiyun  2.43 1.43 1.00 1.00   2.41 10x10 stippled rectangle (8x8 stipple)
2288*4882a593Smuzhiyun  0.98 1.00 1.00 1.00   1.00 100x100 stippled rectangle (8x8 stipple)
2289*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (8x8 stipple)
2290*4882a593Smuzhiyun  1.75 1.75 1.00 1.00   3.40 1x1 opaque stippled rectangle (8x8 stipple)
2291*4882a593Smuzhiyun  2.38 1.42 1.00 1.00   2.34 10x10 opaque stippled rectangle (8x8 stipple)
2292*4882a593Smuzhiyun  1.00 1.00 0.97 0.97   1.00 100x100 opaque stippled rectangle (8x8 stipple)
2293*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.99 500x500 opaque stippled rectangle (8x8 stipple)
2294*4882a593Smuzhiyun  1.82 1.82 1.04 1.04   3.56 1x1 tiled rectangle (4x4 tile)
2295*4882a593Smuzhiyun  2.33 1.42 1.00 1.00   2.37 10x10 tiled rectangle (4x4 tile)
2296*4882a593Smuzhiyun  1.00 0.92 1.00 1.00   1.00 100x100 tiled rectangle (4x4 tile)
2297*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 500x500 tiled rectangle (4x4 tile)
2298*4882a593Smuzhiyun  1.94 1.62 1.00 1.00   3.66 1x1 stippled rectangle (17x15 stipple)
2299*4882a593Smuzhiyun  1.74 1.28 1.00 1.00   1.73 10x10 stippled rectangle (17x15 stipple)
2300*4882a593Smuzhiyun  1.00 1.00 1.00 0.89   0.98 100x100 stippled rectangle (17x15 stipple)
2301*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (17x15 stipple)
2302*4882a593Smuzhiyun  1.94 1.62 1.00 1.00   3.67 1x1 opaque stippled rectangle (17x15 stipple)
2303*4882a593Smuzhiyun  1.69 1.26 1.00 1.00   1.66 10x10 opaque stippled rectangle (17x15 stipple)
2304*4882a593Smuzhiyun  1.00 0.95 1.00 1.00   1.00 100x100 opaque stippled rectangle (17x15 stipple)
2305*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.97 500x500 opaque stippled rectangle (17x15 stipple)
2306*4882a593Smuzhiyun  1.93 1.61 0.99 0.99   3.69 1x1 tiled rectangle (17x15 tile)
2307*4882a593Smuzhiyun  1.73 1.27 1.00 1.00   1.72 10x10 tiled rectangle (17x15 tile)
2308*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.98 100x100 tiled rectangle (17x15 tile)
2309*4882a593Smuzhiyun  1.00 1.00 0.97 0.97   1.00 500x500 tiled rectangle (17x15 tile)
2310*4882a593Smuzhiyun  1.95 1.63 1.00 1.00   3.83 1x1 stippled rectangle (161x145 stipple)
2311*4882a593Smuzhiyun  1.80 1.30 1.00 1.00   1.83 10x10 stippled rectangle (161x145 stipple)
2312*4882a593Smuzhiyun  0.97 1.00 1.00 1.00   1.01 100x100 stippled rectangle (161x145 stipple)
2313*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.98 500x500 stippled rectangle (161x145 stipple)
2314*4882a593Smuzhiyun  1.95 1.63 1.00 1.00   3.56 1x1 opaque stippled rectangle (161x145 stipple)
2315*4882a593Smuzhiyun  1.65 1.25 1.00 1.00   1.68 10x10 opaque stippled rectangle (161x145 stipple)
2316*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.01 100x100 opaque stippled rectangle (161x145...
2317*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   0.97 500x500 opaque stippled rectangle (161x145...
2318*4882a593Smuzhiyun  1.95 1.63 0.98 0.99   3.80 1x1 tiled rectangle (161x145 tile)
2319*4882a593Smuzhiyun  1.67 1.26 1.00 1.00   1.67 10x10 tiled rectangle (161x145 tile)
2320*4882a593Smuzhiyun  1.13 1.14 1.14 1.14   1.14 100x100 tiled rectangle (161x145 tile)
2321*4882a593Smuzhiyun  0.88 1.00 1.00 1.00   0.99 500x500 tiled rectangle (161x145 tile)
2322*4882a593Smuzhiyun  1.93 1.63 1.00 1.00   3.53 1x1 tiled rectangle (216x208 tile)
2323*4882a593Smuzhiyun  1.69 1.26 1.00 1.00   1.66 10x10 tiled rectangle (216x208 tile)
2324*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 100x100 tiled rectangle (216x208 tile)
2325*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 500x500 tiled rectangle (216x208 tile)
2326*4882a593Smuzhiyun  1.82 1.70 1.00 1.00   3.38 1-pixel line segment
2327*4882a593Smuzhiyun  2.07 1.56 0.90 1.00   3.31 10-pixel line segment
2328*4882a593Smuzhiyun  1.29 1.10 1.00 1.00   1.27 100-pixel line segment
2329*4882a593Smuzhiyun  1.05 1.06 1.03 1.03   1.09 500-pixel line segment
2330*4882a593Smuzhiyun  1.30 1.13 1.00 1.00   1.29 100-pixel line segment (1 kid)
2331*4882a593Smuzhiyun  1.32 1.15 1.00 1.00   1.32 100-pixel line segment (2 kids)
2332*4882a593Smuzhiyun  1.33 1.16 1.00 1.00   1.33 100-pixel line segment (3 kids)
2333*4882a593Smuzhiyun  1.92 1.64 1.00 1.00   3.73 10-pixel dashed segment
2334*4882a593Smuzhiyun  1.34 1.16 1.00 1.00   1.34 100-pixel dashed segment
2335*4882a593Smuzhiyun  1.24 1.11 0.99 0.97   1.23 100-pixel double-dashed segment
2336*4882a593Smuzhiyun  1.72 1.77 1.00 1.00   3.25 10-pixel horizontal line segment
2337*4882a593Smuzhiyun  1.83 1.66 1.01 1.00   3.54 100-pixel horizontal line segment
2338*4882a593Smuzhiyun  1.86 1.30 1.00 1.00   1.84 500-pixel horizontal line segment
2339*4882a593Smuzhiyun  2.11 1.52 1.00 0.99   3.02 10-pixel vertical line segment
2340*4882a593Smuzhiyun  1.21 1.10 1.00 1.00   1.20 100-pixel vertical line segment
2341*4882a593Smuzhiyun  1.03 1.03 1.00 1.00   1.02 500-pixel vertical line segment
2342*4882a593Smuzhiyun  4.42 1.68 1.00 1.01   4.64 10x1 wide horizontal line segment
2343*4882a593Smuzhiyun  1.83 1.31 1.00 1.00   1.83 100x10 wide horizontal line segment
2344*4882a593Smuzhiyun  1.07 1.00 0.96 1.00   1.07 500x50 wide horizontal line segment
2345*4882a593Smuzhiyun  4.10 1.67 1.00 1.00   4.62 10x1 wide vertical line segment
2346*4882a593Smuzhiyun  1.50 1.24 1.06 1.06   1.48 100x10 wide vertical line segment
2347*4882a593Smuzhiyun  1.06 1.03 1.00 1.00   1.05 500x50 wide vertical line segment
2348*4882a593Smuzhiyun  2.54 1.61 1.00 1.00   3.61 1-pixel line
2349*4882a593Smuzhiyun  2.71 1.48 1.00 1.00   2.67 10-pixel line
2350*4882a593Smuzhiyun  1.19 1.09 1.00 1.00   1.19 100-pixel line
2351*4882a593Smuzhiyun  1.04 1.02 1.00 1.00   1.03 500-pixel line
2352*4882a593Smuzhiyun  2.68 1.51 0.98 1.00   3.17 10-pixel dashed line
2353*4882a593Smuzhiyun  1.23 1.11 0.99 0.99   1.23 100-pixel dashed line
2354*4882a593Smuzhiyun  1.15 1.08 1.00 1.00   1.15 100-pixel double-dashed line
2355*4882a593Smuzhiyun  2.27 1.39 1.00 1.00   2.23 10x1 wide line
2356*4882a593Smuzhiyun  1.20 1.09 1.00 1.00   1.20 100x10 wide line
2357*4882a593Smuzhiyun  1.04 1.02 1.00 1.00   1.04 500x50 wide line
2358*4882a593Smuzhiyun  1.52 1.45 1.00 1.00   1.52 100x10 wide dashed line
2359*4882a593Smuzhiyun  1.54 1.47 1.00 1.00   1.54 100x10 wide double-dashed line
2360*4882a593Smuzhiyun  1.97 1.30 0.96 0.95   1.95 10x10 rectangle outline
2361*4882a593Smuzhiyun  1.44 1.27 1.00 1.00   1.43 100x100 rectangle outline
2362*4882a593Smuzhiyun  3.22 2.16 1.10 1.09   3.61 500x500 rectangle outline
2363*4882a593Smuzhiyun  1.95 1.34 1.00 1.00   1.90 10x10 wide rectangle outline
2364*4882a593Smuzhiyun  1.14 1.14 1.00 1.00   1.13 100x100 wide rectangle outline
2365*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 500x500 wide rectangle outline
2366*4882a593Smuzhiyun  1.57 1.72 1.00 1.00   3.03 1-pixel circle
2367*4882a593Smuzhiyun  1.96 1.35 1.00 1.00   1.92 10-pixel circle
2368*4882a593Smuzhiyun  1.21 1.07 0.86 0.97   1.20 100-pixel circle
2369*4882a593Smuzhiyun  1.08 1.04 1.00 1.00   1.08 500-pixel circle
2370*4882a593Smuzhiyun  1.39 1.19 1.03 1.03   1.38 100-pixel dashed circle
2371*4882a593Smuzhiyun  1.21 1.11 1.00 1.00   1.23 100-pixel double-dashed circle
2372*4882a593Smuzhiyun  1.59 1.28 1.00 1.00   1.58 10-pixel wide circle
2373*4882a593Smuzhiyun  1.22 1.12 0.99 1.00   1.22 100-pixel wide circle
2374*4882a593Smuzhiyun  1.06 1.04 1.00 1.00   1.05 500-pixel wide circle
2375*4882a593Smuzhiyun  1.87 1.84 1.00 1.00   1.85 100-pixel wide dashed circle
2376*4882a593Smuzhiyun  1.90 1.93 1.01 1.01   1.90 100-pixel wide double-dashed circle
2377*4882a593Smuzhiyun  2.13 1.43 1.00 1.00   2.32 10-pixel partial circle
2378*4882a593Smuzhiyun  1.42 1.18 1.00 1.00   1.42 100-pixel partial circle
2379*4882a593Smuzhiyun  1.92 1.85 1.01 1.01   1.89 10-pixel wide partial circle
2380*4882a593Smuzhiyun  1.73 1.67 1.00 1.00   1.73 100-pixel wide partial circle
2381*4882a593Smuzhiyun  1.36 1.95 1.00 1.00   2.64 1-pixel solid circle
2382*4882a593Smuzhiyun  2.02 1.37 1.00 1.00   2.03 10-pixel solid circle
2383*4882a593Smuzhiyun  1.19 1.09 1.00 1.00   1.19 100-pixel solid circle
2384*4882a593Smuzhiyun  1.02 0.99 1.00 1.00   1.01 500-pixel solid circle
2385*4882a593Smuzhiyun  1.74 1.28 1.00 0.88   1.73 10-pixel fill chord partial circle
2386*4882a593Smuzhiyun  1.31 1.13 1.00 1.00   1.31 100-pixel fill chord partial circle
2387*4882a593Smuzhiyun  1.67 1.31 1.03 1.03   1.72 10-pixel fill slice partial circle
2388*4882a593Smuzhiyun  1.30 1.13 1.00 1.00   1.28 100-pixel fill slice partial circle
2389*4882a593Smuzhiyun  2.45 1.49 1.01 1.00   2.71 10-pixel ellipse
2390*4882a593Smuzhiyun  1.22 1.10 1.00 1.00   1.22 100-pixel ellipse
2391*4882a593Smuzhiyun  1.09 1.04 1.00 1.00   1.09 500-pixel ellipse
2392*4882a593Smuzhiyun  1.90 1.28 1.00 1.00   1.89 100-pixel dashed ellipse
2393*4882a593Smuzhiyun  1.62 1.24 0.96 0.97   1.61 100-pixel double-dashed ellipse
2394*4882a593Smuzhiyun  2.43 1.50 1.00 1.00   2.42 10-pixel wide ellipse
2395*4882a593Smuzhiyun  1.61 1.28 1.03 1.03   1.60 100-pixel wide ellipse
2396*4882a593Smuzhiyun  1.08 1.05 1.00 1.00   1.08 500-pixel wide ellipse
2397*4882a593Smuzhiyun  1.93 1.88 1.00 1.00   1.88 100-pixel wide dashed ellipse
2398*4882a593Smuzhiyun  1.94 1.89 1.01 1.00   1.94 100-pixel wide double-dashed ellipse
2399*4882a593Smuzhiyun  2.31 1.48 1.00 1.00   2.67 10-pixel partial ellipse
2400*4882a593Smuzhiyun  1.38 1.17 1.00 1.00   1.38 100-pixel partial ellipse
2401*4882a593Smuzhiyun  2.00 1.85 0.98 0.97   1.98 10-pixel wide partial ellipse
2402*4882a593Smuzhiyun  1.89 1.86 1.00 1.00   1.89 100-pixel wide partial ellipse
2403*4882a593Smuzhiyun  3.49 1.60 1.00 1.00   3.65 10-pixel filled ellipse
2404*4882a593Smuzhiyun  1.67 1.26 1.00 1.00   1.67 100-pixel filled ellipse
2405*4882a593Smuzhiyun  1.06 1.04 1.00 1.00   1.06 500-pixel filled ellipse
2406*4882a593Smuzhiyun  2.38 1.43 1.01 1.00   2.32 10-pixel fill chord partial ellipse
2407*4882a593Smuzhiyun  2.06 1.30 1.00 1.00   2.05 100-pixel fill chord partial ellipse
2408*4882a593Smuzhiyun  2.27 1.41 1.00 1.00   2.27 10-pixel fill slice partial ellipse
2409*4882a593Smuzhiyun  1.98 1.33 1.00 0.97   1.97 100-pixel fill slice partial ellipse
2410*4882a593Smuzhiyun 57.46 1.99 1.01 1.00 114.92 Fill 1x1 equivalent triangle
2411*4882a593Smuzhiyun 56.94 1.98 1.01 1.00  73.89 Fill 10x10 equivalent triangle
2412*4882a593Smuzhiyun  6.07 1.75 1.00 1.00   6.07 Fill 100x100 equivalent triangle
2413*4882a593Smuzhiyun 51.12 1.98 1.00 1.00 102.81 Fill 1x1 trapezoid
2414*4882a593Smuzhiyun 51.42 1.82 1.01 1.00  94.89 Fill 10x10 trapezoid
2415*4882a593Smuzhiyun  6.47 1.80 1.00 1.00   6.44 Fill 100x100 trapezoid
2416*4882a593Smuzhiyun  1.56 1.28 1.00 0.99   1.56 Fill 300x300 trapezoid
2417*4882a593Smuzhiyun 51.27 1.97 0.96 0.97 102.54 Fill 1x1 stippled trapezoid (8x8 stipple)
2418*4882a593Smuzhiyun 51.73 2.00 1.02 1.02  67.92 Fill 10x10 stippled trapezoid (8x8 stipple)
2419*4882a593Smuzhiyun  5.36 1.72 1.00 1.00   5.36 Fill 100x100 stippled trapezoid (8x8 stipple)
2420*4882a593Smuzhiyun  1.54 1.26 1.00 1.00   1.59 Fill 300x300 stippled trapezoid (8x8 stipple)
2421*4882a593Smuzhiyun 51.41 1.94 1.01 1.00 102.82 Fill 1x1 opaque stippled trapezoid (8x8 stipple)
2422*4882a593Smuzhiyun 50.71 1.95 0.99 1.00  65.44 Fill 10x10 opaque stippled trapezoid (8x8...
2423*4882a593Smuzhiyun  5.33 1.73 1.00 1.00   5.36 Fill 100x100 opaque stippled trapezoid (8x8...
2424*4882a593Smuzhiyun  1.58 1.25 1.00 1.00   1.58 Fill 300x300 opaque stippled trapezoid (8x8...
2425*4882a593Smuzhiyun 51.56 1.96 0.99 0.90 103.68 Fill 1x1 tiled trapezoid (4x4 tile)
2426*4882a593Smuzhiyun 51.59 1.99 1.01 1.01  62.25 Fill 10x10 tiled trapezoid (4x4 tile)
2427*4882a593Smuzhiyun  5.38 1.72 1.00 1.00   5.38 Fill 100x100 tiled trapezoid (4x4 tile)
2428*4882a593Smuzhiyun  1.54 1.25 1.00 0.99   1.58 Fill 300x300 tiled trapezoid (4x4 tile)
2429*4882a593Smuzhiyun 51.70 1.98 1.01 1.01 103.98 Fill 1x1 stippled trapezoid (17x15 stipple)
2430*4882a593Smuzhiyun 44.86 1.97 1.00 1.00  44.86 Fill 10x10 stippled trapezoid (17x15 stipple)
2431*4882a593Smuzhiyun  2.74 1.56 1.00 1.00   2.73 Fill 100x100 stippled trapezoid (17x15 stipple)
2432*4882a593Smuzhiyun  1.29 1.14 1.00 1.00   1.27 Fill 300x300 stippled trapezoid (17x15 stipple)
2433*4882a593Smuzhiyun 51.41 1.96 0.96 0.95 103.39 Fill 1x1 opaque stippled trapezoid (17x15...
2434*4882a593Smuzhiyun 45.14 1.96 1.01 1.00  45.14 Fill 10x10 opaque stippled trapezoid (17x15...
2435*4882a593Smuzhiyun  2.68 1.56 1.00 1.00   2.68 Fill 100x100 opaque stippled trapezoid (17x15...
2436*4882a593Smuzhiyun  1.26 1.10 1.00 1.00   1.28 Fill 300x300 opaque stippled trapezoid (17x15...
2437*4882a593Smuzhiyun 51.13 1.97 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (17x15 tile)
2438*4882a593Smuzhiyun 47.58 1.96 1.00 1.00  47.86 Fill 10x10 tiled trapezoid (17x15 tile)
2439*4882a593Smuzhiyun  2.74 1.56 1.00 1.00   2.74 Fill 100x100 tiled trapezoid (17x15 tile)
2440*4882a593Smuzhiyun  1.29 1.14 1.00 1.00   1.28 Fill 300x300 tiled trapezoid (17x15 tile)
2441*4882a593Smuzhiyun 51.13 1.97 0.99 0.97 103.39 Fill 1x1 stippled trapezoid (161x145 stipple)
2442*4882a593Smuzhiyun 45.14 1.97 1.00 1.00  44.29 Fill 10x10 stippled trapezoid (161x145 stipple)
2443*4882a593Smuzhiyun  3.02 1.77 1.12 1.12   3.38 Fill 100x100 stippled trapezoid (161x145 stipple)
2444*4882a593Smuzhiyun  1.31 1.13 1.00 1.00   1.30 Fill 300x300 stippled trapezoid (161x145 stipple)
2445*4882a593Smuzhiyun 51.27 1.97 1.00 1.00 103.10 Fill 1x1 opaque stippled trapezoid (161x145...
2446*4882a593Smuzhiyun 45.01 1.97 1.00 1.00  45.01 Fill 10x10 opaque stippled trapezoid (161x145...
2447*4882a593Smuzhiyun  2.67 1.56 1.00 1.00   2.69 Fill 100x100 opaque stippled trapezoid (161x145..
2448*4882a593Smuzhiyun  1.29 1.13 1.00 1.01   1.27 Fill 300x300 opaque stippled trapezoid (161x145..
2449*4882a593Smuzhiyun 51.41 1.96 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (161x145 tile)
2450*4882a593Smuzhiyun 45.01 1.96 0.98 1.00  45.01 Fill 10x10 tiled trapezoid (161x145 tile)
2451*4882a593Smuzhiyun  2.62 1.36 1.00 1.00   2.69 Fill 100x100 tiled trapezoid (161x145 tile)
2452*4882a593Smuzhiyun  1.27 1.13 1.00 1.00   1.22 Fill 300x300 tiled trapezoid (161x145 tile)
2453*4882a593Smuzhiyun 51.13 1.98 1.00 1.00 103.39 Fill 1x1 tiled trapezoid (216x208 tile)
2454*4882a593Smuzhiyun 45.14 1.97 1.01 0.99  45.14 Fill 10x10 tiled trapezoid (216x208 tile)
2455*4882a593Smuzhiyun  2.62 1.55 1.00 1.00   2.71 Fill 100x100 tiled trapezoid (216x208 tile)
2456*4882a593Smuzhiyun  1.28 1.13 1.00 1.00   1.20 Fill 300x300 tiled trapezoid (216x208 tile)
2457*4882a593Smuzhiyun 50.71 1.95 1.00 1.00  54.70 Fill 10x10 equivalent complex polygon
2458*4882a593Smuzhiyun  5.51 1.71 0.96 0.98   5.47 Fill 100x100 equivalent complex polygons
2459*4882a593Smuzhiyun  8.39 1.97 1.00 1.00  16.75 Fill 10x10 64-gon (Convex)
2460*4882a593Smuzhiyun  8.38 1.83 1.00 1.00   8.43 Fill 100x100 64-gon (Convex)
2461*4882a593Smuzhiyun  8.50 1.96 1.00 1.00  16.64 Fill 10x10 64-gon (Complex)
2462*4882a593Smuzhiyun  8.26 1.83 1.00 1.00   8.35 Fill 100x100 64-gon (Complex)
2463*4882a593Smuzhiyun 14.09 1.87 1.00 1.00  14.05 Char in 80-char line (6x13)
2464*4882a593Smuzhiyun 11.91 1.87 1.00 1.00  11.95 Char in 70-char line (8x13)
2465*4882a593Smuzhiyun 11.16 1.85 1.01 1.00  11.10 Char in 60-char line (9x15)
2466*4882a593Smuzhiyun 10.09 1.78 1.00 1.00  10.09 Char16 in 40-char line (k14)
2467*4882a593Smuzhiyun  6.15 1.75 1.00 1.00   6.31 Char16 in 23-char line (k24)
2468*4882a593Smuzhiyun 11.92 1.90 1.03 1.03  11.88 Char in 80-char line (TR 10)
2469*4882a593Smuzhiyun  8.18 1.78 1.00 0.99   8.17 Char in 30-char line (TR 24)
2470*4882a593Smuzhiyun 42.83 1.44 1.01 1.00  42.11 Char in 20/40/20 line (6x13, TR 10)
2471*4882a593Smuzhiyun 27.45 1.43 1.01 1.01  27.45 Char16 in 7/14/7 line (k14, k24)
2472*4882a593Smuzhiyun 12.13 1.85 1.00 1.00  12.05 Char in 80-char image line (6x13)
2473*4882a593Smuzhiyun 10.00 1.84 1.00 1.00  10.00 Char in 70-char image line (8x13)
2474*4882a593Smuzhiyun  9.18 1.83 1.00 1.00   9.12 Char in 60-char image line (9x15)
2475*4882a593Smuzhiyun  9.66 1.82 0.98 0.95   9.66 Char16 in 40-char image line (k14)
2476*4882a593Smuzhiyun  5.82 1.72 1.00 1.00   5.99 Char16 in 23-char image line (k24)
2477*4882a593Smuzhiyun  8.70 1.80 1.00 1.00   8.65 Char in 80-char image line (TR 10)
2478*4882a593Smuzhiyun  4.67 1.66 1.00 1.00   4.67 Char in 30-char image line (TR 24)
2479*4882a593Smuzhiyun 84.43 1.47 1.00 1.00 124.18 Scroll 10x10 pixels
2480*4882a593Smuzhiyun  3.73 1.50 1.00 0.98   3.73 Scroll 100x100 pixels
2481*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 Scroll 500x500 pixels
2482*4882a593Smuzhiyun 84.43 1.51 1.00 1.00 134.02 Copy 10x10 from window to window
2483*4882a593Smuzhiyun  3.62 1.51 0.98 0.98   3.62 Copy 100x100 from window to window
2484*4882a593Smuzhiyun  0.89 1.00 1.00 1.00   1.00 Copy 500x500 from window to window
2485*4882a593Smuzhiyun 57.06 1.99 1.00 1.00  88.64 Copy 10x10 from pixmap to window
2486*4882a593Smuzhiyun  2.49 2.00 1.00 1.00   2.48 Copy 100x100 from pixmap to window
2487*4882a593Smuzhiyun  1.00 0.91 1.00 1.00   0.98 Copy 500x500 from pixmap to window
2488*4882a593Smuzhiyun  2.04 1.01 1.00 1.00   2.03 Copy 10x10 from window to pixmap
2489*4882a593Smuzhiyun  1.05 1.00 1.00 1.00   1.05 Copy 100x100 from window to pixmap
2490*4882a593Smuzhiyun  1.00 1.00 0.93 1.00   1.04 Copy 500x500 from window to pixmap
2491*4882a593Smuzhiyun 58.52 1.03 1.03 1.02  57.95 Copy 10x10 from pixmap to pixmap
2492*4882a593Smuzhiyun  2.40 1.00 1.00 1.00   2.45 Copy 100x100 from pixmap to pixmap
2493*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 Copy 500x500 from pixmap to pixmap
2494*4882a593Smuzhiyun 51.57 1.92 1.00 1.00  85.75 Copy 10x10 1-bit deep plane
2495*4882a593Smuzhiyun  6.37 1.75 1.01 1.01   6.37 Copy 100x100 1-bit deep plane
2496*4882a593Smuzhiyun  1.26 1.11 1.00 1.00   1.24 Copy 500x500 1-bit deep plane
2497*4882a593Smuzhiyun  4.23 1.63 0.98 0.97   4.38 Copy 10x10 n-bit deep plane
2498*4882a593Smuzhiyun  1.04 1.02 1.00 1.00   1.04 Copy 100x100 n-bit deep plane
2499*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 Copy 500x500 n-bit deep plane
2500*4882a593Smuzhiyun  6.45 1.98 1.00 1.26  12.80 PutImage 10x10 square
2501*4882a593Smuzhiyun  1.10 1.87 1.00 1.83   2.11 PutImage 100x100 square
2502*4882a593Smuzhiyun  1.02 1.93 1.00 1.91   1.91 PutImage 500x500 square
2503*4882a593Smuzhiyun  4.17 1.78 1.00 1.40   7.18 PutImage XY 10x10 square
2504*4882a593Smuzhiyun  1.27 1.49 0.97 1.48   2.10 PutImage XY 100x100 square
2505*4882a593Smuzhiyun  1.00 1.50 1.00 1.50   1.52 PutImage XY 500x500 square
2506*4882a593Smuzhiyun  1.07 1.01 1.00 1.00   1.06 GetImage 10x10 square
2507*4882a593Smuzhiyun  1.01 1.00 1.00 1.00   1.01 GetImage 100x100 square
2508*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 GetImage 500x500 square
2509*4882a593Smuzhiyun  1.56 1.00 0.99 0.97   1.56 GetImage XY 10x10 square
2510*4882a593Smuzhiyun  1.02 1.00 1.00 1.00   1.02 GetImage XY 100x100 square
2511*4882a593Smuzhiyun  1.00 1.00 1.00 1.00   1.00 GetImage XY 500x500 square
2512*4882a593Smuzhiyun  1.00 1.00 1.01 0.98   0.95 X protocol NoOperation
2513*4882a593Smuzhiyun  1.02 1.03 1.04 1.03   1.00 QueryPointer
2514*4882a593Smuzhiyun  1.03 1.02 1.04 1.03   1.00 GetProperty
2515*4882a593Smuzhiyun100.41 1.51 1.00 1.00 198.76 Change graphics context
2516*4882a593Smuzhiyun 45.81 1.00 0.99 0.97  57.10 Create and map subwindows (4 kids)
2517*4882a593Smuzhiyun 78.45 1.01 1.02 1.02  63.07 Create and map subwindows (16 kids)
2518*4882a593Smuzhiyun 73.91 1.01 1.00 1.00  56.37 Create and map subwindows (25 kids)
2519*4882a593Smuzhiyun 73.22 1.00 1.00 1.00  49.07 Create and map subwindows (50 kids)
2520*4882a593Smuzhiyun 72.36 1.01 0.99 1.00  32.14 Create and map subwindows (75 kids)
2521*4882a593Smuzhiyun 70.34 1.00 1.00 1.00  30.12 Create and map subwindows (100 kids)
2522*4882a593Smuzhiyun 55.00 1.00 1.00 0.99  23.75 Create and map subwindows (200 kids)
2523*4882a593Smuzhiyun 55.30 1.01 1.00 1.00 141.03 Create unmapped window (4 kids)
2524*4882a593Smuzhiyun 55.38 1.01 1.01 1.00 163.25 Create unmapped window (16 kids)
2525*4882a593Smuzhiyun 54.75 0.96 1.00 0.99 166.95 Create unmapped window (25 kids)
2526*4882a593Smuzhiyun 54.83 1.00 1.00 0.99 178.81 Create unmapped window (50 kids)
2527*4882a593Smuzhiyun 55.38 1.01 1.01 1.00 181.20 Create unmapped window (75 kids)
2528*4882a593Smuzhiyun 55.38 1.01 1.01 1.00 181.20 Create unmapped window (100 kids)
2529*4882a593Smuzhiyun 54.87 1.01 1.01 1.00 182.05 Create unmapped window (200 kids)
2530*4882a593Smuzhiyun 28.13 1.00 1.00 1.00  30.75 Map window via parent (4 kids)
2531*4882a593Smuzhiyun 36.14 1.01 1.01 1.01  32.58 Map window via parent (16 kids)
2532*4882a593Smuzhiyun 26.13 1.00 0.98 0.95  29.85 Map window via parent (25 kids)
2533*4882a593Smuzhiyun 40.07 1.00 1.01 1.00  27.57 Map window via parent (50 kids)
2534*4882a593Smuzhiyun 23.26 0.99 1.00 1.00  18.23 Map window via parent (75 kids)
2535*4882a593Smuzhiyun 22.91 0.99 1.00 0.99  16.52 Map window via parent (100 kids)
2536*4882a593Smuzhiyun 27.79 1.00 1.00 0.99  12.50 Map window via parent (200 kids)
2537*4882a593Smuzhiyun 22.35 1.00 1.00 1.00  56.19 Unmap window via parent (4 kids)
2538*4882a593Smuzhiyun  9.57 1.00 0.99 1.00  89.78 Unmap window via parent (16 kids)
2539*4882a593Smuzhiyun 80.77 1.01 1.00 1.00 103.85 Unmap window via parent (25 kids)
2540*4882a593Smuzhiyun 96.34 1.00 1.00 1.00 116.06 Unmap window via parent (50 kids)
2541*4882a593Smuzhiyun 99.72 1.00 1.00 1.00 124.93 Unmap window via parent (75 kids)
2542*4882a593Smuzhiyun112.36 1.00 1.00 1.00 125.27 Unmap window via parent (100 kids)
2543*4882a593Smuzhiyun105.41 1.00 1.00 0.99 120.00 Unmap window via parent (200 kids)
2544*4882a593Smuzhiyun 51.29 1.03 1.02 1.02  74.19 Destroy window via parent (4 kids)
2545*4882a593Smuzhiyun 86.75 0.99 0.99 0.99 116.87 Destroy window via parent (16 kids)
2546*4882a593Smuzhiyun106.43 1.01 1.01 1.01 127.49 Destroy window via parent (25 kids)
2547*4882a593Smuzhiyun120.34 1.01 1.01 1.00 140.11 Destroy window via parent (50 kids)
2548*4882a593Smuzhiyun126.67 1.00 0.99 0.99 145.00 Destroy window via parent (75 kids)
2549*4882a593Smuzhiyun126.11 1.01 1.01 1.00 140.56 Destroy window via parent (100 kids)
2550*4882a593Smuzhiyun128.57 1.01 1.00 1.00 137.91 Destroy window via parent (200 kids)
2551*4882a593Smuzhiyun 16.04 0.88 1.00 1.00  20.36 Hide/expose window via popup (4 kids)
2552*4882a593Smuzhiyun 19.04 1.01 1.00 1.00  23.48 Hide/expose window via popup (16 kids)
2553*4882a593Smuzhiyun 19.22 1.00 1.00 1.00  20.44 Hide/expose window via popup (25 kids)
2554*4882a593Smuzhiyun 17.41 1.00 0.91 0.97  17.68 Hide/expose window via popup (50 kids)
2555*4882a593Smuzhiyun 17.29 1.01 1.00 1.01  17.07 Hide/expose window via popup (75 kids)
2556*4882a593Smuzhiyun 16.74 1.00 1.00 1.00  16.17 Hide/expose window via popup (100 kids)
2557*4882a593Smuzhiyun 10.30 1.00 1.00 1.00  10.51 Hide/expose window via popup (200 kids)
2558*4882a593Smuzhiyun 16.48 1.01 1.00 1.00  26.05 Move window (4 kids)
2559*4882a593Smuzhiyun 17.01 0.95 1.00 1.00  23.97 Move window (16 kids)
2560*4882a593Smuzhiyun 16.95 1.00 1.00 1.00  22.90 Move window (25 kids)
2561*4882a593Smuzhiyun 16.05 1.01 1.00 1.00  21.32 Move window (50 kids)
2562*4882a593Smuzhiyun 15.58 1.00 0.98 0.98  19.44 Move window (75 kids)
2563*4882a593Smuzhiyun 14.98 1.02 1.03 1.03  18.17 Move window (100 kids)
2564*4882a593Smuzhiyun 10.90 1.01 1.01 1.00  12.68 Move window (200 kids)
2565*4882a593Smuzhiyun 49.42 1.00 1.00 1.00 198.27 Moved unmapped window (4 kids)
2566*4882a593Smuzhiyun 50.72 0.97 1.00 1.00 193.66 Moved unmapped window (16 kids)
2567*4882a593Smuzhiyun 50.87 1.00 0.99 1.00 195.09 Moved unmapped window (25 kids)
2568*4882a593Smuzhiyun 50.72 1.00 1.00 1.00 189.34 Moved unmapped window (50 kids)
2569*4882a593Smuzhiyun 50.87 1.00 1.00 1.00 191.33 Moved unmapped window (75 kids)
2570*4882a593Smuzhiyun 50.87 1.00 1.00 0.90 186.71 Moved unmapped window (100 kids)
2571*4882a593Smuzhiyun 50.87 1.00 1.00 1.00 179.19 Moved unmapped window (200 kids)
2572*4882a593Smuzhiyun 41.04 1.00 1.00 1.00  56.61 Move window via parent (4 kids)
2573*4882a593Smuzhiyun 69.81 1.00 1.00 1.00 130.82 Move window via parent (16 kids)
2574*4882a593Smuzhiyun 95.81 1.00 1.00 1.00 141.92 Move window via parent (25 kids)
2575*4882a593Smuzhiyun 95.98 1.00 1.00 1.00 149.43 Move window via parent (50 kids)
2576*4882a593Smuzhiyun 96.59 1.01 1.01 1.00 153.98 Move window via parent (75 kids)
2577*4882a593Smuzhiyun 97.19 1.00 1.00 1.00 157.30 Move window via parent (100 kids)
2578*4882a593Smuzhiyun 96.67 1.00 0.99 0.96 159.44 Move window via parent (200 kids)
2579*4882a593Smuzhiyun 17.75 1.01 1.00 1.00  27.61 Resize window (4 kids)
2580*4882a593Smuzhiyun 17.94 1.00 1.00 0.99  25.42 Resize window (16 kids)
2581*4882a593Smuzhiyun 17.92 1.01 1.00 1.00  24.47 Resize window (25 kids)
2582*4882a593Smuzhiyun 17.24 0.97 1.00 1.00  24.14 Resize window (50 kids)
2583*4882a593Smuzhiyun 16.81 1.00 1.00 0.99  22.75 Resize window (75 kids)
2584*4882a593Smuzhiyun 16.08 1.00 1.00 1.00  21.20 Resize window (100 kids)
2585*4882a593Smuzhiyun 12.92 1.00 0.99 1.00  16.26 Resize window (200 kids)
2586*4882a593Smuzhiyun 52.94 1.01 1.00 1.00 327.12 Resize unmapped window (4 kids)
2587*4882a593Smuzhiyun 53.60 1.01 1.01 1.01 333.71 Resize unmapped window (16 kids)
2588*4882a593Smuzhiyun 52.99 1.00 1.00 1.00 337.29 Resize unmapped window (25 kids)
2589*4882a593Smuzhiyun 51.98 1.00 1.00 1.00 329.38 Resize unmapped window (50 kids)
2590*4882a593Smuzhiyun 53.05 0.89 1.00 1.00 322.60 Resize unmapped window (75 kids)
2591*4882a593Smuzhiyun 53.05 1.00 1.00 1.00 318.08 Resize unmapped window (100 kids)
2592*4882a593Smuzhiyun 53.11 1.00 1.00 0.99 306.21 Resize unmapped window (200 kids)
2593*4882a593Smuzhiyun 16.76 1.00 0.96 1.00  19.46 Circulate window (4 kids)
2594*4882a593Smuzhiyun 17.24 1.00 1.00 0.97  16.24 Circulate window (16 kids)
2595*4882a593Smuzhiyun 16.30 1.03 1.03 1.03  15.85 Circulate window (25 kids)
2596*4882a593Smuzhiyun 13.45 1.00 1.00 1.00  14.90 Circulate window (50 kids)
2597*4882a593Smuzhiyun 12.91 1.00 1.00 1.00  13.06 Circulate window (75 kids)
2598*4882a593Smuzhiyun 11.30 0.98 1.00 1.00  11.03 Circulate window (100 kids)
2599*4882a593Smuzhiyun  7.58 1.01 1.01 0.99   7.47 Circulate window (200 kids)
2600*4882a593Smuzhiyun  1.01 1.01 0.98 1.00   0.95 Circulate Unmapped window (4 kids)
2601*4882a593Smuzhiyun  1.07 1.07 1.01 1.07   1.02 Circulate Unmapped window (16 kids)
2602*4882a593Smuzhiyun  1.04 1.09 1.06 1.05   0.97 Circulate Unmapped window (25 kids)
2603*4882a593Smuzhiyun  1.04 1.23 1.20 1.18   1.05 Circulate Unmapped window (50 kids)
2604*4882a593Smuzhiyun  1.18 1.53 1.19 1.45   1.24 Circulate Unmapped window (75 kids)
2605*4882a593Smuzhiyun  1.08 1.02 1.01 1.74   1.01 Circulate Unmapped window (100 kids)
2606*4882a593Smuzhiyun  1.01 1.12 0.98 0.91   0.97 Circulate Unmapped window (200 kids)
2607*4882a593Smuzhiyun</screen>
2608*4882a593Smuzhiyun</para>
2609*4882a593Smuzhiyun</sect3>
2610*4882a593Smuzhiyun
2611*4882a593Smuzhiyun<sect3>
2612*4882a593Smuzhiyun<title>Profiling with OProfile</title>
2613*4882a593Smuzhiyun
2614*4882a593Smuzhiyun<para>OProfile (available from http://oprofile.sourceforge.net/) is a
2615*4882a593Smuzhiyunsystem-wide profiler for Linux systems that uses processor-level
2616*4882a593Smuzhiyuncounters to collect sampling data.  OProfile can provide information
2617*4882a593Smuzhiyunthat is similar to that provided by <command>gprof</command>, but without the
2618*4882a593Smuzhiyunnecessity of recompiling the program with special instrumentation (i.e.,
2619*4882a593SmuzhiyunOProfile can collect statistical profiling information about optimized
2620*4882a593Smuzhiyunprograms).  A test harness was developed to collect OProfile data for
2621*4882a593Smuzhiyuneach <command>x11perf</command> test individually.
2622*4882a593Smuzhiyun</para>
2623*4882a593Smuzhiyun
2624*4882a593Smuzhiyun<para>Test runs were performed using the RETIRED_INSNS counter on the AMD
2625*4882a593SmuzhiyunAthlon and the CPU_CLK_HALTED counter on the Intel Pentium III (with a
2626*4882a593Smuzhiyuntest configuration different from the one described above).  We have
2627*4882a593Smuzhiyunexamined OProfile output and have compared it with <command>gprof</command> output.
2628*4882a593SmuzhiyunThis investigation has not produced results that yield performance
2629*4882a593Smuzhiyunincreases in <command>x11perf</command> numbers.
2630*4882a593Smuzhiyun</para>
2631*4882a593Smuzhiyun
2632*4882a593Smuzhiyun</sect3>
2633*4882a593Smuzhiyun
2634*4882a593Smuzhiyun<!--
2635*4882a593Smuzhiyun<sect3>Retired Instructions
2636*4882a593Smuzhiyun
2637*4882a593Smuzhiyun<p>The initial tests using OProfile were done using the RETIRED_INSNS
2638*4882a593Smuzhiyuncounter with DMX running on the dual-processor AMD Athlon machine - the
2639*4882a593Smuzhiyunsame test configuration that was described above and that was used for
2640*4882a593Smuzhiyunother tests.  The RETIRED_INSNS counter counts retired instructions and
2641*4882a593Smuzhiyunshowed drawing, text, copying, and image tests to be dominated (&gt;
2642*4882a593Smuzhiyun30%) by calls to Hash(), SecurityLookupIDByClass(),
2643*4882a593SmuzhiyunSecurityLookupIDByType(), and StandardReadRequestFromClient().  Some of
2644*4882a593Smuzhiyunthese tests also executed significant instructions in
2645*4882a593SmuzhiyunWaitForSomething().
2646*4882a593Smuzhiyun
2647*4882a593Smuzhiyun<p>In contrast, the window tests executed significant
2648*4882a593Smuzhiyuninstructions in SecurityLookupIDByType(), Hash(),
2649*4882a593SmuzhiyunStandardReadRequestFromClient(), but also executed significant
2650*4882a593Smuzhiyuninstructions in other routines, such as ConfigureWindow().  Some time
2651*4882a593Smuzhiyunwas spent looking at Hash() function, but optimizations in this routine
2652*4882a593Smuzhiyundid not lead to a dramatic increase in <tt/x11perf/ performance.
2653*4882a593Smuzhiyun-->
2654*4882a593Smuzhiyun
2655*4882a593Smuzhiyun<!--
2656*4882a593Smuzhiyun<sect3>Clock Cycles
2657*4882a593Smuzhiyun
2658*4882a593Smuzhiyun<p>Retired instructions can be misleading because Intel/AMD instructions
2659*4882a593Smuzhiyunexecute in variable amounts of time.  The OProfile tests were repeated
2660*4882a593Smuzhiyunusing the Intel CPU_CLK_HALTED counter with DMX running on the second
2661*4882a593Smuzhiyunback-end machine.  Note that this is a different test configuration that
2662*4882a593Smuzhiyunthe one described above.  However, these tests show the amount of time
2663*4882a593Smuzhiyun(as measured in CPU cycles) that are spent in each routine.  Because
2664*4882a593Smuzhiyun<tt/x11perf/ was running on the first back-end machine and because
2665*4882a593Smuzhiyunwindow optimizations were on, the load on the second back-end machine
2666*4882a593Smuzhiyunwas not significant.
2667*4882a593Smuzhiyun
2668*4882a593Smuzhiyun<p>Using CPU_CLK_HALTED, DMX showed simple drawing
2669*4882a593Smuzhiyuntests spending more than 10% of their time in
2670*4882a593SmuzhiyunStandardReadRequestFromClient(), with significant time (&gt; 20% total)
2671*4882a593Smuzhiyunspent in SecurityLookupIDByClass(), WaitForSomething(), and Dispatch().
2672*4882a593SmuzhiyunFor these tests, &lt; 5% of the time was spent in Hash(), which explains
2673*4882a593Smuzhiyunwhy optimizing the Hash() routine did not impact <tt/x11perf/ results.
2674*4882a593Smuzhiyun
2675*4882a593Smuzhiyun<p>The trapezoid, text, scrolling, copying, and image tests were
2676*4882a593Smuzhiyundominated by time in ProcFillPoly(), PanoramiXFillPoly(), dmxFillPolygon(),
2677*4882a593SmuzhiyunSecurityLookupIDByClass(), SecurityLookupIDByType(), and
2678*4882a593SmuzhiyunStandardReadRequestFromClient().  Hash() time was generally above 5% but
2679*4882a593Smuzhiyunless than 10% of total time.
2680*4882a593Smuzhiyun-->
2681*4882a593Smuzhiyun
2682*4882a593Smuzhiyun<sect3>
2683*4882a593Smuzhiyun<title>X Test Suite</title>
2684*4882a593Smuzhiyun
2685*4882a593Smuzhiyun<para>The X Test Suite was run on the fully optimized DMX server using the
2686*4882a593Smuzhiyunconfiguration described above.  The following failures were noted:
2687*4882a593Smuzhiyun<screen>
2688*4882a593SmuzhiyunXListPixmapFormats: Test 1              [1]
2689*4882a593SmuzhiyunXChangeWindowAttributes: Test 32        [1]
2690*4882a593SmuzhiyunXCreateWindow: Test 30                  [1]
2691*4882a593SmuzhiyunXFreeColors: Test 4                     [3]
2692*4882a593SmuzhiyunXCopyArea: Test 13, 17, 21, 25, 30      [2]
2693*4882a593SmuzhiyunXCopyPlane: Test 11, 15, 27, 31         [2]
2694*4882a593SmuzhiyunXSetFontPath: Test 4                    [1]
2695*4882a593SmuzhiyunXChangeKeyboardControl: Test 9, 10      [1]
2696*4882a593Smuzhiyun
2697*4882a593Smuzhiyun[1] Previously documented errors expected from the Xinerama
2698*4882a593Smuzhiyun    implementation (see Phase I discussion).
2699*4882a593Smuzhiyun[2] Newly noted errors that have been verified as expected
2700*4882a593Smuzhiyun    behavior of the Xinerama implementation.
2701*4882a593Smuzhiyun[3] Newly noted error that has been verified as a Xinerama
2702*4882a593Smuzhiyun    implementation bug.
2703*4882a593Smuzhiyun</screen>
2704*4882a593Smuzhiyun</para>
2705*4882a593Smuzhiyun
2706*4882a593Smuzhiyun</sect3>
2707*4882a593Smuzhiyun
2708*4882a593Smuzhiyun</sect2>
2709*4882a593Smuzhiyun
2710*4882a593Smuzhiyun<!-- ============================================================ -->
2711*4882a593Smuzhiyun<sect2>
2712*4882a593Smuzhiyun<title>Phase III</title>
2713*4882a593Smuzhiyun
2714*4882a593Smuzhiyun<para>During the third phase of development, support was provided for the
2715*4882a593Smuzhiyunfollowing extensions: SHAPE, RENDER, XKEYBOARD, XInput.
2716*4882a593Smuzhiyun</para>
2717*4882a593Smuzhiyun
2718*4882a593Smuzhiyun<sect3>
2719*4882a593Smuzhiyun<title>SHAPE</title>
2720*4882a593Smuzhiyun
2721*4882a593Smuzhiyun<para>The SHAPE extension is supported.  Test applications (e.g., xeyes and
2722*4882a593Smuzhiyunoclock) and window managers that make use of the SHAPE extension will
2723*4882a593Smuzhiyunwork as expected.
2724*4882a593Smuzhiyun</para>
2725*4882a593Smuzhiyun</sect3>
2726*4882a593Smuzhiyun
2727*4882a593Smuzhiyun<sect3>
2728*4882a593Smuzhiyun<title>RENDER</title>
2729*4882a593Smuzhiyun
2730*4882a593Smuzhiyun<para>The RENDER extension is supported.  The version included in the DMX
2731*4882a593SmuzhiyunCVS tree is version 0.2, and this version is fully supported by Xdmx.
2732*4882a593SmuzhiyunApplications using only version 0.2 functions will work correctly;
2733*4882a593Smuzhiyunhowever, some apps that make use of functions from later versions do not
2734*4882a593Smuzhiyunproperly check the extension's major/minor version numbers.  These apps
2735*4882a593Smuzhiyunwill fail with a Bad Implementation error when using post-version 0.2
2736*4882a593Smuzhiyunfunctions.  This is expected behavior.  When the DMX CVS tree is updated
2737*4882a593Smuzhiyunto include newer versions of RENDER, support for these newer functions
2738*4882a593Smuzhiyunwill be added to the DMX X server.
2739*4882a593Smuzhiyun</para>
2740*4882a593Smuzhiyun</sect3>
2741*4882a593Smuzhiyun
2742*4882a593Smuzhiyun<sect3>
2743*4882a593Smuzhiyun<title>XKEYBOARD</title>
2744*4882a593Smuzhiyun
2745*4882a593Smuzhiyun<para>The XKEYBOARD extension is supported.  If present on the back-end X
2746*4882a593Smuzhiyunservers, the XKEYBOARD extension will be used to obtain information
2747*4882a593Smuzhiyunabout the type of the keyboard for initialization.  Otherwise, the
2748*4882a593Smuzhiyunkeyboard will be initialized using defaults.  Note that this departs
2749*4882a593Smuzhiyunfrom older behavior: when Xdmx is compiled without XKEYBOARD support,
2750*4882a593Smuzhiyunthe map from the back-end X server will be preserved.  With XKEYBOARD
2751*4882a593Smuzhiyunsupport, the map is not preserved because better information and control
2752*4882a593Smuzhiyunof the keyboard is available.
2753*4882a593Smuzhiyun</para>
2754*4882a593Smuzhiyun</sect3>
2755*4882a593Smuzhiyun
2756*4882a593Smuzhiyun<sect3>
2757*4882a593Smuzhiyun<title>XInput</title>
2758*4882a593Smuzhiyun
2759*4882a593Smuzhiyun<para>The XInput extension is supported.  Any device can be used as a core
2760*4882a593Smuzhiyundevice and be used as an XInput extension device, with the exception of
2761*4882a593Smuzhiyuncore devices on the back-end servers.  This limitation is present
2762*4882a593Smuzhiyunbecause cursor handling on the back-end requires that the back-end
2763*4882a593Smuzhiyuncursor sometimes track the Xdmx core cursor -- behavior that is
2764*4882a593Smuzhiyunincompatible with using the back-end pointer as a non-core device.
2765*4882a593Smuzhiyun</para>
2766*4882a593Smuzhiyun
2767*4882a593Smuzhiyun<para>Currently, back-end extension devices are not available as Xdmx
2768*4882a593Smuzhiyunextension devices, but this limitation should be removed in the future.
2769*4882a593Smuzhiyun</para>
2770*4882a593Smuzhiyun
2771*4882a593Smuzhiyun<para>To demonstrate the XInput extension, and to provide more examples for
2772*4882a593Smuzhiyunlow-level input device driver writers, USB device drivers have been
2773*4882a593Smuzhiyunwritten for mice (usb-mou), keyboards (usb-kbd), and
2774*4882a593Smuzhiyunnon-mouse/non-keyboard USB devices (usb-oth).  Please see the man page
2775*4882a593Smuzhiyunfor information on Linux kernel drivers that are required for using
2776*4882a593Smuzhiyunthese Xdmx drivers.
2777*4882a593Smuzhiyun</para>
2778*4882a593Smuzhiyun</sect3>
2779*4882a593Smuzhiyun
2780*4882a593Smuzhiyun<sect3>
2781*4882a593Smuzhiyun<title>DPMS</title>
2782*4882a593Smuzhiyun
2783*4882a593Smuzhiyun<para>The DPMS extension is exported but does not do anything at this time.
2784*4882a593Smuzhiyun</para>
2785*4882a593Smuzhiyun
2786*4882a593Smuzhiyun</sect3>
2787*4882a593Smuzhiyun
2788*4882a593Smuzhiyun<sect3>
2789*4882a593Smuzhiyun<title>Other Extensions</title>
2790*4882a593Smuzhiyun
2791*4882a593Smuzhiyun<para>The LBX,
2792*4882a593Smuzhiyun       SECURITY,
2793*4882a593Smuzhiyun       XC-APPGROUP, and
2794*4882a593Smuzhiyun       XFree86-Bigfont
2795*4882a593Smuzhiyunextensions do not require any special Xdmx support and have been exported.
2796*4882a593Smuzhiyun</para>
2797*4882a593Smuzhiyun
2798*4882a593Smuzhiyun<para>The
2799*4882a593Smuzhiyun    BIG-REQUESTS,
2800*4882a593Smuzhiyun    DEC-XTRAP,
2801*4882a593Smuzhiyun    DOUBLE-BUFFER,
2802*4882a593Smuzhiyun    Extended-Visual-Information,
2803*4882a593Smuzhiyun    FontCache,
2804*4882a593Smuzhiyun    GLX,
2805*4882a593Smuzhiyun    MIT-SCREEN-SAVER,
2806*4882a593Smuzhiyun    MIT-SHM,
2807*4882a593Smuzhiyun    MIT-SUNDRY-NONSTANDARD,
2808*4882a593Smuzhiyun    RECORD,
2809*4882a593Smuzhiyun    SECURITY,
2810*4882a593Smuzhiyun    SGI-GLX,
2811*4882a593Smuzhiyun    SYNC,
2812*4882a593Smuzhiyun    TOG-CUP,
2813*4882a593Smuzhiyun    X-Resource,
2814*4882a593Smuzhiyun    XC-MISC,
2815*4882a593Smuzhiyun    XFree86-DGA,
2816*4882a593Smuzhiyun    XFree86-DRI,
2817*4882a593Smuzhiyun    XFree86-Misc,
2818*4882a593Smuzhiyun    XFree86-VidModeExtension, and
2819*4882a593Smuzhiyun    XVideo
2820*4882a593Smuzhiyunextensions are <emphasis remap="it">not</emphasis> supported at this time, but will be evaluated
2821*4882a593Smuzhiyunfor inclusion in future DMX releases.  <emphasis remap="bf">See below for additional work
2822*4882a593Smuzhiyunon extensions after Phase III.</emphasis>
2823*4882a593Smuzhiyun</para>
2824*4882a593Smuzhiyun</sect3>
2825*4882a593Smuzhiyun</sect2>
2826*4882a593Smuzhiyun
2827*4882a593Smuzhiyun<sect2>
2828*4882a593Smuzhiyun<title>Phase IV</title>
2829*4882a593Smuzhiyun
2830*4882a593Smuzhiyun<sect3>
2831*4882a593Smuzhiyun<title>Moving to XFree86 4.3.0</title>
2832*4882a593Smuzhiyun
2833*4882a593Smuzhiyun<para>For Phase IV, the recent release of XFree86 4.3.0 (27 February 2003)
2834*4882a593Smuzhiyunwas merged onto the dmx.sourceforge.net CVS trunk and all work is
2835*4882a593Smuzhiyunproceeding using this tree.
2836*4882a593Smuzhiyun</para>
2837*4882a593Smuzhiyun</sect3>
2838*4882a593Smuzhiyun
2839*4882a593Smuzhiyun<sect3>
2840*4882a593Smuzhiyun<title>Extensions </title>
2841*4882a593Smuzhiyun
2842*4882a593Smuzhiyun<sect4>
2843*4882a593Smuzhiyun<title>XC-MISC (supported)</title>
2844*4882a593Smuzhiyun
2845*4882a593Smuzhiyun<para>XC-MISC is used internally by the X library to recycle XIDs from the
2846*4882a593SmuzhiyunX server.  This is important for long-running X server sessions.  Xdmx
2847*4882a593Smuzhiyunsupports this extension.  The X Test Suite passed and failed the exact
2848*4882a593Smuzhiyunsame tests before and after this extension was enabled.
2849*4882a593Smuzhiyun<!-- Tested February/March 2003 -->
2850*4882a593Smuzhiyun</para>
2851*4882a593Smuzhiyun</sect4>
2852*4882a593Smuzhiyun
2853*4882a593Smuzhiyun<sect4>
2854*4882a593Smuzhiyun<title>Extended-Visual-Information (supported)</title>
2855*4882a593Smuzhiyun
2856*4882a593Smuzhiyun<para>The Extended-Visual-Information extension provides a method for an X
2857*4882a593Smuzhiyunclient to obtain detailed visual information.  Xdmx supports this
2858*4882a593Smuzhiyunextension.  It was tested using the <filename>hw/dmx/examples/evi</filename> example
2859*4882a593Smuzhiyunprogram.  <emphasis remap="bf">Note that this extension is not Xinerama-aware</emphasis> -- it will
2860*4882a593Smuzhiyunreturn visual information for each screen even though Xinerama is
2861*4882a593Smuzhiyuncausing the X server to export a single logical screen.
2862*4882a593Smuzhiyun<!-- Tested March 2003 -->
2863*4882a593Smuzhiyun</para>
2864*4882a593Smuzhiyun</sect4>
2865*4882a593Smuzhiyun
2866*4882a593Smuzhiyun<sect4>
2867*4882a593Smuzhiyun<title>RES (supported)</title>
2868*4882a593Smuzhiyun
2869*4882a593Smuzhiyun<para>The X-Resource extension provides a mechanism for a client to obtain
2870*4882a593Smuzhiyundetailed information about the resources used by other clients.  This
2871*4882a593Smuzhiyunextension was tested with the <filename>hw/dmx/examples/res</filename> program.  The
2872*4882a593SmuzhiyunX Test Suite passed and failed the exact same tests before and after
2873*4882a593Smuzhiyunthis extension was enabled.
2874*4882a593Smuzhiyun<!-- Tested March 2003 -->
2875*4882a593Smuzhiyun</para>
2876*4882a593Smuzhiyun</sect4>
2877*4882a593Smuzhiyun
2878*4882a593Smuzhiyun<sect4>
2879*4882a593Smuzhiyun<title>BIG-REQUESTS (supported)</title>
2880*4882a593Smuzhiyun
2881*4882a593Smuzhiyun<para>This extension enables the X11 protocol to handle requests longer
2882*4882a593Smuzhiyunthan 262140 bytes.  The X Test Suite passed and failed the exact same
2883*4882a593Smuzhiyuntests before and after this extension was enabled.
2884*4882a593Smuzhiyun<!-- Tested March 2003 -->
2885*4882a593Smuzhiyun</para>
2886*4882a593Smuzhiyun</sect4>
2887*4882a593Smuzhiyun
2888*4882a593Smuzhiyun<sect4>
2889*4882a593Smuzhiyun<title>XSYNC (supported)</title>
2890*4882a593Smuzhiyun
2891*4882a593Smuzhiyun<para>This extension provides facilities for two different X clients to
2892*4882a593Smuzhiyunsynchronize their requests.  This extension was minimally tested with
2893*4882a593Smuzhiyun<command>xdpyinfo</command> and the X Test Suite passed and failed the exact same
2894*4882a593Smuzhiyuntests before and after this extension was enabled.
2895*4882a593Smuzhiyun<!-- Tested March 2003 -->
2896*4882a593Smuzhiyun</para>
2897*4882a593Smuzhiyun</sect4>
2898*4882a593Smuzhiyun
2899*4882a593Smuzhiyun<sect4>
2900*4882a593Smuzhiyun<title>XTEST, RECORD, DEC-XTRAP (supported) and XTestExtension1 (not supported)</title>
2901*4882a593Smuzhiyun
2902*4882a593Smuzhiyun<para>The XTEST and RECORD extension were developed by the X Consortium for
2903*4882a593Smuzhiyunuse in the X Test Suite and are supported as a standard in the X11R6
2904*4882a593Smuzhiyuntree.  They are also supported in Xdmx.  When X Test Suite tests that
2905*4882a593Smuzhiyunmake use of the XTEST extension are run, Xdmx passes and fails exactly
2906*4882a593Smuzhiyunthe same tests as does a standard XFree86 X server.  When the
2907*4882a593Smuzhiyun<literal remap="tt">rcrdtest</literal> test (a part of the X Test Suite that verifies the RECORD
2908*4882a593Smuzhiyunextension) is run, Xdmx passes and fails exactly the same tests as does
2909*4882a593Smuzhiyuna standard XFree86 X server. <!-- Tested February/March 2003 -->
2910*4882a593Smuzhiyun</para>
2911*4882a593Smuzhiyun
2912*4882a593Smuzhiyun<para>There are two older XTEST-like extensions: DEC-XTRAP and
2913*4882a593SmuzhiyunXTestExtension1.  The XTestExtension1 extension was developed for use by
2914*4882a593Smuzhiyunthe X Testing Consortium for use with a test suite that eventually
2915*4882a593Smuzhiyunbecame (part of?) the X Test Suite.  Unlike XTEST, which only allows
2916*4882a593Smuzhiyunevents to be sent to the server, the XTestExtension1 extension also
2917*4882a593Smuzhiyunallowed events to be recorded (similar to the RECORD extension).  The
2918*4882a593Smuzhiyunsecond is the DEC-XTRAP extension that was developed by the Digital
2919*4882a593SmuzhiyunEquipment Corporation.
2920*4882a593Smuzhiyun</para>
2921*4882a593Smuzhiyun
2922*4882a593Smuzhiyun<para>The DEC-XTRAP extension is available from Xdmx and has been tested
2923*4882a593Smuzhiyunwith the <command>xtrap*</command> tools which are distributed as standard X11R6
2924*4882a593Smuzhiyunclients. <!-- Tested March 2003 -->
2925*4882a593Smuzhiyun</para>
2926*4882a593Smuzhiyun
2927*4882a593Smuzhiyun<para>The XTestExtension1 is <emphasis>not</emphasis> supported because it does not appear
2928*4882a593Smuzhiyunto be used by any modern X clients (the few that support it also support
2929*4882a593SmuzhiyunXTEST) and because there are no good methods available for testing that
2930*4882a593Smuzhiyunit functions correctly (unlike XTEST and DEC-XTRAP, the code for
2931*4882a593SmuzhiyunXTestExtension1 is not part of the standard X server source tree, so
2932*4882a593Smuzhiyunadditional testing is important). <!-- Tested March 2003 -->
2933*4882a593Smuzhiyun</para>
2934*4882a593Smuzhiyun
2935*4882a593Smuzhiyun<para>Most of these extensions are documented in the X11R6 source tree.
2936*4882a593SmuzhiyunFurther, several original papers exist that this author was unable to
2937*4882a593Smuzhiyunlocate -- for completeness and historical interest, citations are
2938*4882a593Smuzhiyunprovide:
2939*4882a593Smuzhiyun<variablelist>
2940*4882a593Smuzhiyun<varlistentry>
2941*4882a593Smuzhiyun<term>XRECORD</term>
2942*4882a593Smuzhiyun<listitem>
2943*4882a593Smuzhiyun<para>Martha Zimet. Extending X For Recording.  8th Annual X
2944*4882a593SmuzhiyunTechnical Conference Boston, MA January 24-26, 1994.
2945*4882a593Smuzhiyun</para></listitem></varlistentry>
2946*4882a593Smuzhiyun<varlistentry>
2947*4882a593Smuzhiyun<term>DEC-XTRAP</term>
2948*4882a593Smuzhiyun<listitem>
2949*4882a593Smuzhiyun<para>Dick Annicchiarico, Robert Chesler, Alan Jamison. XTrap
2950*4882a593SmuzhiyunArchitecture. Digital Equipment Corporation, July 1991.
2951*4882a593Smuzhiyun</para></listitem></varlistentry>
2952*4882a593Smuzhiyun<varlistentry>
2953*4882a593Smuzhiyun<term>XTestExtension1</term>
2954*4882a593Smuzhiyun<listitem>
2955*4882a593Smuzhiyun<para>Larry Woestman. X11 Input Synthesis Extension
2956*4882a593SmuzhiyunProposal. Hewlett Packard, November 1991.
2957*4882a593Smuzhiyun</para></listitem></varlistentry>
2958*4882a593Smuzhiyun</variablelist>
2959*4882a593Smuzhiyun</para>
2960*4882a593Smuzhiyun</sect4>
2961*4882a593Smuzhiyun
2962*4882a593Smuzhiyun<sect4>
2963*4882a593Smuzhiyun<title>MIT-MISC (not supported)</title>
2964*4882a593Smuzhiyun
2965*4882a593Smuzhiyun<para>The MIT-MISC extension is used to control a bug-compatibility flag
2966*4882a593Smuzhiyunthat provides compatibility with xterm programs from X11R1 and X11R2.
2967*4882a593SmuzhiyunThere does not appear to be a single client available that makes use of
2968*4882a593Smuzhiyunthis extension and there is not way to verify that it works correctly.
2969*4882a593SmuzhiyunThe Xdmx server does <emphasis>not</emphasis> support MIT-MISC.
2970*4882a593Smuzhiyun</para>
2971*4882a593Smuzhiyun</sect4>
2972*4882a593Smuzhiyun
2973*4882a593Smuzhiyun<sect4>
2974*4882a593Smuzhiyun<title>SCREENSAVER (not supported)</title>
2975*4882a593Smuzhiyun
2976*4882a593Smuzhiyun<para>This extension provides special support for the X screen saver.  It
2977*4882a593Smuzhiyunwas tested with beforelight, which appears to be the only client that
2978*4882a593Smuzhiyunworks with it.  When Xinerama was not active, <command>beforelight</command> behaved
2979*4882a593Smuzhiyunas expected.  However, when Xinerama was active, <command>beforelight</command> did
2980*4882a593Smuzhiyunnot behave as expected.  Further, when this extension is not active,
2981*4882a593Smuzhiyun<command>xscreensaver</command> (a widely-used X screen saver program) did not behave
2982*4882a593Smuzhiyunas expected.  Since this extension is not Xinerama-aware and is not
2983*4882a593Smuzhiyuncommonly used with expected results by clients, we have left this
2984*4882a593Smuzhiyunextension disabled at this time.
2985*4882a593Smuzhiyun</para>
2986*4882a593Smuzhiyun</sect4>
2987*4882a593Smuzhiyun
2988*4882a593Smuzhiyun<sect4>
2989*4882a593Smuzhiyun<title>GLX (supported)</title>
2990*4882a593Smuzhiyun
2991*4882a593Smuzhiyun<para>The GLX extension provides OpenGL and GLX windowing support.  In
2992*4882a593SmuzhiyunXdmx, the extension is called glxProxy, and it is Xinerama aware.  It
2993*4882a593Smuzhiyunworks by either feeding requests forward through Xdmx to each of the
2994*4882a593Smuzhiyunback-end servers or handling them locally.  All rendering requests are
2995*4882a593Smuzhiyunhandled on the back-end X servers.  This code was donated to the DMX
2996*4882a593Smuzhiyunproject by SGI.  For the X Test Suite results comparison, see below.
2997*4882a593Smuzhiyun</para>
2998*4882a593Smuzhiyun</sect4>
2999*4882a593Smuzhiyun
3000*4882a593Smuzhiyun<sect4>
3001*4882a593Smuzhiyun<title>RENDER (supported)</title>
3002*4882a593Smuzhiyun
3003*4882a593Smuzhiyun<para>The X Rendering Extension (RENDER) provides support for digital image
3004*4882a593Smuzhiyuncomposition.  Geometric and text rendering are supported.  RENDER is
3005*4882a593Smuzhiyunpartially Xinerama-aware, with text and the most basic compositing
3006*4882a593Smuzhiyunoperator; however, its higher level primitives (triangles, triangle
3007*4882a593Smuzhiyunstrips, and triangle fans) are not yet Xinerama-aware.  The RENDER
3008*4882a593Smuzhiyunextension is still under development, and is currently at version 0.8.
3009*4882a593SmuzhiyunAdditional support will be required in DMX as more primitives and/or
3010*4882a593Smuzhiyunrequests are added to the extension.
3011*4882a593Smuzhiyun</para>
3012*4882a593Smuzhiyun
3013*4882a593Smuzhiyun<para>There is currently no test suite for the X Rendering Extension;
3014*4882a593Smuzhiyunhowever, there has been discussion of developing a test suite as the
3015*4882a593Smuzhiyunextension matures.  When that test suite becomes available, additional
3016*4882a593Smuzhiyuntesting can be performed with Xdmx.  The X Test Suite passed and failed
3017*4882a593Smuzhiyunthe exact same tests before and after this extension was enabled.
3018*4882a593Smuzhiyun</para>
3019*4882a593Smuzhiyun</sect4>
3020*4882a593Smuzhiyun
3021*4882a593Smuzhiyun<sect4>
3022*4882a593Smuzhiyun<title>Summary</title>
3023*4882a593Smuzhiyun
3024*4882a593Smuzhiyun<!-- WARNING: this list is duplicated in the "Common X extension
3025*4882a593Smuzhiyunsupport" section -->
3026*4882a593Smuzhiyun<para>To summarize, the following extensions are currently supported:
3027*4882a593Smuzhiyun    BIG-REQUESTS,
3028*4882a593Smuzhiyun    DEC-XTRAP,
3029*4882a593Smuzhiyun    DMX,
3030*4882a593Smuzhiyun    DPMS,
3031*4882a593Smuzhiyun    Extended-Visual-Information,
3032*4882a593Smuzhiyun    GLX,
3033*4882a593Smuzhiyun    LBX,
3034*4882a593Smuzhiyun    RECORD,
3035*4882a593Smuzhiyun    RENDER,
3036*4882a593Smuzhiyun    SECURITY,
3037*4882a593Smuzhiyun    SHAPE,
3038*4882a593Smuzhiyun    SYNC,
3039*4882a593Smuzhiyun    X-Resource,
3040*4882a593Smuzhiyun    XC-APPGROUP,
3041*4882a593Smuzhiyun    XC-MISC,
3042*4882a593Smuzhiyun    XFree86-Bigfont,
3043*4882a593Smuzhiyun    XINERAMA,
3044*4882a593Smuzhiyun    XInputExtension,
3045*4882a593Smuzhiyun    XKEYBOARD, and
3046*4882a593Smuzhiyun    XTEST.
3047*4882a593Smuzhiyun</para>
3048*4882a593Smuzhiyun
3049*4882a593Smuzhiyun<para>The following extensions are <emphasis>not</emphasis> supported at this time:
3050*4882a593Smuzhiyun    DOUBLE-BUFFER,
3051*4882a593Smuzhiyun    FontCache,
3052*4882a593Smuzhiyun    MIT-SCREEN-SAVER,
3053*4882a593Smuzhiyun    MIT-SHM,
3054*4882a593Smuzhiyun    MIT-SUNDRY-NONSTANDARD,
3055*4882a593Smuzhiyun    TOG-CUP,
3056*4882a593Smuzhiyun    XFree86-DGA,
3057*4882a593Smuzhiyun    XFree86-Misc,
3058*4882a593Smuzhiyun    XFree86-VidModeExtension,
3059*4882a593Smuzhiyun    XTestExtensionExt1, and
3060*4882a593Smuzhiyun    XVideo.
3061*4882a593Smuzhiyun</para>
3062*4882a593Smuzhiyun</sect4>
3063*4882a593Smuzhiyun</sect3>
3064*4882a593Smuzhiyun
3065*4882a593Smuzhiyun<sect3>
3066*4882a593Smuzhiyun<title>Additional Testing with the X Test Suite</title>
3067*4882a593Smuzhiyun
3068*4882a593Smuzhiyun<sect4>
3069*4882a593Smuzhiyun<title>XFree86 without XTEST</title>
3070*4882a593Smuzhiyun
3071*4882a593Smuzhiyun<para>After the release of XFree86 4.3.0, we retested the XFree86 X server
3072*4882a593Smuzhiyunwith and without using the XTEST extension.  When the XTEST extension
3073*4882a593Smuzhiyunwas <emphasis>not</emphasis> used for testing, the XFree86 4.3.0 server running on our
3074*4882a593Smuzhiyunusual test system with a Radeon VE card reported unexpected failures in
3075*4882a593Smuzhiyunthe following tests:
3076*4882a593Smuzhiyun<literallayout>
3077*4882a593SmuzhiyunXListPixmapFormats: Test 1
3078*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
3079*4882a593SmuzhiyunXGetDefault: Test 5
3080*4882a593SmuzhiyunXRebindKeysym: Test 1
3081*4882a593Smuzhiyun</literallayout>
3082*4882a593Smuzhiyun</para>
3083*4882a593Smuzhiyun</sect4>
3084*4882a593Smuzhiyun
3085*4882a593Smuzhiyun<sect4>
3086*4882a593Smuzhiyun<title>XFree86 with XTEST</title>
3087*4882a593Smuzhiyun
3088*4882a593Smuzhiyun<para>When using the XTEST extension, the XFree86 4.3.0 server reported the
3089*4882a593Smuzhiyunfollowing errors:
3090*4882a593Smuzhiyun<literallayout>
3091*4882a593SmuzhiyunXListPixmapFormats: Test 1
3092*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
3093*4882a593SmuzhiyunXGetDefault: Test 5
3094*4882a593SmuzhiyunXRebindKeysym: Test 1
3095*4882a593Smuzhiyun
3096*4882a593SmuzhiyunXAllowEvents: Tests 20, 21, 24
3097*4882a593SmuzhiyunXGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
3098*4882a593SmuzhiyunXGrabKey: Test 8
3099*4882a593SmuzhiyunXSetPointerMapping: Test 3
3100*4882a593SmuzhiyunXUngrabButton: Test 4
3101*4882a593Smuzhiyun</literallayout>
3102*4882a593Smuzhiyun</para>
3103*4882a593Smuzhiyun
3104*4882a593Smuzhiyun<para>While these errors may be important, they will probably be fixed
3105*4882a593Smuzhiyuneventually in the XFree86 source tree.  We are particularly interested
3106*4882a593Smuzhiyunin demonstrating that the Xdmx server does not introduce additional
3107*4882a593Smuzhiyunfailures that are not known Xinerama failures.
3108*4882a593Smuzhiyun</para>
3109*4882a593Smuzhiyun</sect4>
3110*4882a593Smuzhiyun
3111*4882a593Smuzhiyun<sect4>
3112*4882a593Smuzhiyun<title>Xdmx with XTEST, without Xinerama, without GLX</title>
3113*4882a593Smuzhiyun
3114*4882a593Smuzhiyun<para>Without Xinerama, but using the XTEST extension, the following errors
3115*4882a593Smuzhiyunwere reported from Xdmx (note that these are the same as for the XFree86
3116*4882a593Smuzhiyun4.3.0, except that XGetDefault no longer fails):
3117*4882a593Smuzhiyun<literallayout>
3118*4882a593SmuzhiyunXListPixmapFormats: Test 1
3119*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
3120*4882a593SmuzhiyunXRebindKeysym: Test 1
3121*4882a593Smuzhiyun
3122*4882a593SmuzhiyunXAllowEvents: Tests  20, 21, 24
3123*4882a593SmuzhiyunXGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
3124*4882a593SmuzhiyunXGrabKey: Test 8
3125*4882a593SmuzhiyunXSetPointerMapping: Test 3
3126*4882a593SmuzhiyunXUngrabButton: Test 4
3127*4882a593Smuzhiyun</literallayout>
3128*4882a593Smuzhiyun</para>
3129*4882a593Smuzhiyun</sect4>
3130*4882a593Smuzhiyun
3131*4882a593Smuzhiyun<sect4>
3132*4882a593Smuzhiyun<title>Xdmx with XTEST, with Xinerama, without GLX</title>
3133*4882a593Smuzhiyun
3134*4882a593Smuzhiyun<para>With Xinerama, using the XTEST extension, the following errors
3135*4882a593Smuzhiyunwere reported from Xdmx:
3136*4882a593Smuzhiyun<literallayout>
3137*4882a593SmuzhiyunXListPixmapFormats: Test 1
3138*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
3139*4882a593SmuzhiyunXRebindKeysym: Test 1
3140*4882a593Smuzhiyun
3141*4882a593SmuzhiyunXAllowEvents: Tests 20, 21, 24
3142*4882a593SmuzhiyunXGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
3143*4882a593SmuzhiyunXGrabKey: Test 8
3144*4882a593SmuzhiyunXSetPointerMapping: Test 3
3145*4882a593SmuzhiyunXUngrabButton: Test 4
3146*4882a593Smuzhiyun
3147*4882a593SmuzhiyunXCopyPlane: Tests 13, 22, 31 (well-known XTEST/Xinerama interaction issue)
3148*4882a593SmuzhiyunXDrawLine: Test 67
3149*4882a593SmuzhiyunXDrawLines: Test 91
3150*4882a593SmuzhiyunXDrawSegments: Test 68
3151*4882a593Smuzhiyun</literallayout>
3152*4882a593SmuzhiyunNote that the first two sets of errors are the same as for the XFree86
3153*4882a593Smuzhiyun4.3.0 server, and that the XCopyPlane error is a well-known error
3154*4882a593Smuzhiyunresulting from an XTEST/Xinerama interaction when the request crosses a
3155*4882a593Smuzhiyunscreen boundary.  The XDraw* errors are resolved when the tests are run
3156*4882a593Smuzhiyunindividually and they do not cross a screen boundary.  We will
3157*4882a593Smuzhiyuninvestigate these errors further to determine their cause.
3158*4882a593Smuzhiyun</para>
3159*4882a593Smuzhiyun</sect4>
3160*4882a593Smuzhiyun
3161*4882a593Smuzhiyun<sect4>
3162*4882a593Smuzhiyun<title>Xdmx with XTEST, with Xinerama, with GLX</title>
3163*4882a593Smuzhiyun
3164*4882a593Smuzhiyun<para>With GLX enabled, using the XTEST extension, the following errors
3165*4882a593Smuzhiyunwere reported from Xdmx (these results are from early during the Phase
3166*4882a593SmuzhiyunIV development, but were confirmed with a late Phase IV snapshot):
3167*4882a593Smuzhiyun<literallayout>
3168*4882a593SmuzhiyunXListPixmapFormats: Test 1
3169*4882a593SmuzhiyunXChangeKeyboardControl: Tests 9, 10
3170*4882a593SmuzhiyunXRebindKeysym: Test 1
3171*4882a593Smuzhiyun
3172*4882a593SmuzhiyunXAllowEvents: Tests 20, 21, 24
3173*4882a593SmuzhiyunXGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25
3174*4882a593SmuzhiyunXGrabKey: Test 8
3175*4882a593SmuzhiyunXSetPointerMapping: Test 3
3176*4882a593SmuzhiyunXUngrabButton: Test 4
3177*4882a593Smuzhiyun
3178*4882a593SmuzhiyunXClearArea: Test 8
3179*4882a593SmuzhiyunXCopyArea: Tests 4, 5, 11, 14, 17, 23, 25, 27, 30
3180*4882a593SmuzhiyunXCopyPlane: Tests 6, 7, 10, 19, 22, 31
3181*4882a593SmuzhiyunXDrawArcs: Tests 89, 100, 102
3182*4882a593SmuzhiyunXDrawLine: Test 67
3183*4882a593SmuzhiyunXDrawSegments: Test 68
3184*4882a593Smuzhiyun</literallayout>
3185*4882a593SmuzhiyunNote that the first two sets of errors are the same as for the XFree86
3186*4882a593Smuzhiyun4.3.0 server, and that the third set has different failures than when
3187*4882a593SmuzhiyunXdmx does not include GLX support.  Since the GLX extension adds new
3188*4882a593Smuzhiyunvisuals to support GLX's visual configs and the X Test Suite runs tests
3189*4882a593Smuzhiyunover the entire set of visuals, additional rendering tests were run and
3190*4882a593Smuzhiyunpresumably more of them crossed a screen boundary.  This conclusion is
3191*4882a593Smuzhiyunsupported by the fact that nearly all of the rendering errors reported
3192*4882a593Smuzhiyunare resolved when the tests are run individually and they do no cross a
3193*4882a593Smuzhiyunscreen boundary.
3194*4882a593Smuzhiyun</para>
3195*4882a593Smuzhiyun
3196*4882a593Smuzhiyun<para>Further, when hardware rendering is disabled on the back-end displays,
3197*4882a593Smuzhiyunmany of the errors in the third set are eliminated, leaving only:
3198*4882a593Smuzhiyun<literallayout>
3199*4882a593SmuzhiyunXClearArea: Test 8
3200*4882a593SmuzhiyunXCopyArea: Test 4, 5, 11, 14, 17, 23, 25, 27, 30
3201*4882a593SmuzhiyunXCopyPlane: Test 6, 7, 10, 19, 22, 31
3202*4882a593Smuzhiyun</literallayout>
3203*4882a593Smuzhiyun</para>
3204*4882a593Smuzhiyun</sect4>
3205*4882a593Smuzhiyun
3206*4882a593Smuzhiyun<sect4>
3207*4882a593Smuzhiyun<title>Conclusion</title>
3208*4882a593Smuzhiyun
3209*4882a593Smuzhiyun<para>We conclude that all of the X Test Suite errors reported for Xdmx are
3210*4882a593Smuzhiyunthe result of errors in the back-end X server or the Xinerama
3211*4882a593Smuzhiyunimplementation.  Further, all of these errors that can be reasonably
3212*4882a593Smuzhiyunfixed at the Xdmx layer have been.  (Where appropriate, we have
3213*4882a593Smuzhiyunsubmitted patches to the XFree86 and Xinerama upstream maintainers.)
3214*4882a593Smuzhiyun</para>
3215*4882a593Smuzhiyun</sect4>
3216*4882a593Smuzhiyun</sect3>
3217*4882a593Smuzhiyun
3218*4882a593Smuzhiyun<sect3>
3219*4882a593Smuzhiyun<title>Dynamic Reconfiguration</title>
3220*4882a593Smuzhiyun
3221*4882a593Smuzhiyun<para>During this development phase, dynamic reconfiguration support was
3222*4882a593Smuzhiyunadded to DMX.  This support allows an application to change the position
3223*4882a593Smuzhiyunand offset of a back-end server's screen.  For example, if the
3224*4882a593Smuzhiyunapplication would like to shift a screen slightly to the left, it could
3225*4882a593Smuzhiyunquery Xdmx for the screen's &lt;x,y&gt; position and then dynamically
3226*4882a593Smuzhiyunreconfigure that screen to be at position &lt;x+10,y&gt;.  When a screen
3227*4882a593Smuzhiyunis dynamically reconfigured, input handling and a screen's root window
3228*4882a593Smuzhiyundimensions are adjusted as needed.  These adjustments are transparent to
3229*4882a593Smuzhiyunthe user.
3230*4882a593Smuzhiyun</para>
3231*4882a593Smuzhiyun
3232*4882a593Smuzhiyun<sect4>
3233*4882a593Smuzhiyun<title>Dynamic reconfiguration extension</title>
3234*4882a593Smuzhiyun
3235*4882a593Smuzhiyun<para>The application interface to DMX's dynamic reconfiguration is through
3236*4882a593Smuzhiyuna function in the DMX extension library:
3237*4882a593Smuzhiyun<programlisting>
3238*4882a593SmuzhiyunBool DMXReconfigureScreen(Display *dpy, int screen, int x, int y)
3239*4882a593Smuzhiyun</programlisting>
3240*4882a593Smuzhiyunwhere <parameter>dpy</parameter> is DMX server's display, <parameter>screen</parameter> is the number of the
3241*4882a593Smuzhiyunscreen to be reconfigured, and <parameter>x</parameter> and <parameter>y</parameter> are the new upper,
3242*4882a593Smuzhiyunleft-hand coordinates of the screen to be reconfigured.
3243*4882a593Smuzhiyun</para>
3244*4882a593Smuzhiyun
3245*4882a593Smuzhiyun<para>The coordinates are not limited other than as required by the X
3246*4882a593Smuzhiyunprotocol, which limits all coordinates to a signed 16 bit number.  In
3247*4882a593Smuzhiyunaddition, all coordinates within a screen must also be legal values.
3248*4882a593SmuzhiyunTherefore, setting a screen's upper, left-hand coordinates such that the
3249*4882a593Smuzhiyunright or bottom edges of the screen is greater than 32,767 is illegal.
3250*4882a593Smuzhiyun</para>
3251*4882a593Smuzhiyun</sect4>
3252*4882a593Smuzhiyun
3253*4882a593Smuzhiyun<sect4>
3254*4882a593Smuzhiyun<title>Bounding box</title>
3255*4882a593Smuzhiyun
3256*4882a593Smuzhiyun<para>When the Xdmx server is started, a bounding box is calculated from
3257*4882a593Smuzhiyunthe screens' layout given either on the command line or in the
3258*4882a593Smuzhiyunconfiguration file.  This bounding box is currently fixed for the
3259*4882a593Smuzhiyunlifetime of the Xdmx server.
3260*4882a593Smuzhiyun</para>
3261*4882a593Smuzhiyun
3262*4882a593Smuzhiyun<para>While it is possible to move a screen outside of the bounding box, it
3263*4882a593Smuzhiyunis currently not possible to change the dimensions of the bounding box.
3264*4882a593SmuzhiyunFor example, it is possible to specify coordinates of &lt;-100,-100&gt;
3265*4882a593Smuzhiyunfor the upper, left-hand corner of the bounding box, which was
3266*4882a593Smuzhiyunpreviously at coordinates &lt;0,0&gt;.  As expected, the screen is moved
3267*4882a593Smuzhiyundown and to the right; however, since the bounding box is fixed, the
3268*4882a593Smuzhiyunleft side and upper portions of the screen exposed by the
3269*4882a593Smuzhiyunreconfiguration are no longer accessible on that screen.  Those
3270*4882a593Smuzhiyuninaccessible regions are filled with black.
3271*4882a593Smuzhiyun</para>
3272*4882a593Smuzhiyun
3273*4882a593Smuzhiyun<para>This fixed bounding box limitation will be addressed in a future
3274*4882a593Smuzhiyundevelopment phase.
3275*4882a593Smuzhiyun</para>
3276*4882a593Smuzhiyun</sect4>
3277*4882a593Smuzhiyun
3278*4882a593Smuzhiyun<sect4>
3279*4882a593Smuzhiyun<title>Sample applications</title>
3280*4882a593Smuzhiyun
3281*4882a593Smuzhiyun<para>An example of where this extension is useful is in setting up a video
3282*4882a593Smuzhiyunwall.  It is not always possible to get everything perfectly aligned,
3283*4882a593Smuzhiyunand sometimes the positions are changed (e.g., someone might bump into a
3284*4882a593Smuzhiyunprojector).  Instead of physically moving projectors or monitors, it is
3285*4882a593Smuzhiyunnow possible to adjust the positions of the back-end server's screens
3286*4882a593Smuzhiyunusing the dynamic reconfiguration support in DMX.
3287*4882a593Smuzhiyun</para>
3288*4882a593Smuzhiyun
3289*4882a593Smuzhiyun<para>Other applications, such as automatic setup and calibration tools,
3290*4882a593Smuzhiyuncan make use of dynamic reconfiguration to correct for projector
3291*4882a593Smuzhiyunalignment problems, as long as the projectors are still arranged
3292*4882a593Smuzhiyunrectilinearly.  Horizontal and vertical keystone correction could be
3293*4882a593Smuzhiyunapplied to projectors to correct for non-rectilinear alignment problems;
3294*4882a593Smuzhiyunhowever, this must be done external to Xdmx.
3295*4882a593Smuzhiyun</para>
3296*4882a593Smuzhiyun
3297*4882a593Smuzhiyun<para>A sample test program is included in the DMX server's examples
3298*4882a593Smuzhiyundirectory to demonstrate the interface and how an application might use
3299*4882a593Smuzhiyundynamic reconfiguration.  See <filename>dmxreconfig.c</filename> for details.
3300*4882a593Smuzhiyun</para>
3301*4882a593Smuzhiyun</sect4>
3302*4882a593Smuzhiyun
3303*4882a593Smuzhiyun<sect4>
3304*4882a593Smuzhiyun<title>Additional notes</title>
3305*4882a593Smuzhiyun
3306*4882a593Smuzhiyun<para>In the original development plan, Phase IV was primarily devoted to
3307*4882a593Smuzhiyunadding OpenGL support to DMX; however, SGI became interested in the DMX
3308*4882a593Smuzhiyunproject and developed code to support OpenGL/GLX.  This code was later
3309*4882a593Smuzhiyundonated to the DMX project and integrated into the DMX code base, which
3310*4882a593Smuzhiyunfreed the DMX developers to concentrate on dynamic reconfiguration (as
3311*4882a593Smuzhiyundescribed above).
3312*4882a593Smuzhiyun</para>
3313*4882a593Smuzhiyun</sect4>
3314*4882a593Smuzhiyun</sect3>
3315*4882a593Smuzhiyun
3316*4882a593Smuzhiyun<sect3>
3317*4882a593Smuzhiyun<title>Doxygen documentation</title>
3318*4882a593Smuzhiyun
3319*4882a593Smuzhiyun<para>Doxygen is an open-source (GPL) documentation system for generating
3320*4882a593Smuzhiyunbrowseable documentation from stylized comments in the source code.  We
3321*4882a593Smuzhiyunhave placed all of the Xdmx server and DMX protocol source code files
3322*4882a593Smuzhiyununder Doxygen so that comprehensive documentation for the Xdmx source
3323*4882a593Smuzhiyuncode is available in an easily browseable format.
3324*4882a593Smuzhiyun</para>
3325*4882a593Smuzhiyun</sect3>
3326*4882a593Smuzhiyun
3327*4882a593Smuzhiyun<sect3>
3328*4882a593Smuzhiyun<title>Valgrind</title>
3329*4882a593Smuzhiyun
3330*4882a593Smuzhiyun<para>Valgrind, an open-source (GPL) memory debugger for Linux, was used to
3331*4882a593Smuzhiyunsearch for memory management errors.  Several memory leaks were detected
3332*4882a593Smuzhiyunand repaired.  The following errors were not addressed:
3333*4882a593Smuzhiyun<orderedlist>
3334*4882a593Smuzhiyun    <listitem><para>
3335*4882a593Smuzhiyun        When the X11 transport layer sends a reply to the client, only
3336*4882a593Smuzhiyun        those fields that are required by the protocol are filled in --
3337*4882a593Smuzhiyun        unused fields are left as uninitialized memory and are therefore
3338*4882a593Smuzhiyun        noted by valgrind.  These instances are not errors and were not
3339*4882a593Smuzhiyun        repaired.
3340*4882a593Smuzhiyun    </para></listitem>
3341*4882a593Smuzhiyun    <listitem><para>
3342*4882a593Smuzhiyun        At each server generation, glxInitVisuals allocates memory that
3343*4882a593Smuzhiyun        is never freed.  The amount of memory lost each generation
3344*4882a593Smuzhiyun        approximately equal to 128 bytes for each back-end visual.
3345*4882a593Smuzhiyun        Because the code involved is automatically generated, this bug
3346*4882a593Smuzhiyun        has not been fixed and will be referred to SGI.
3347*4882a593Smuzhiyun    </para></listitem>
3348*4882a593Smuzhiyun    <listitem><para>
3349*4882a593Smuzhiyun        At each server generation, dmxRealizeFont calls XLoadQueryFont,
3350*4882a593Smuzhiyun        which allocates a font structure that is not freed.
3351*4882a593Smuzhiyun        dmxUnrealizeFont can free the font structure for the first
3352*4882a593Smuzhiyun        screen, but cannot free it for the other screens since they are
3353*4882a593Smuzhiyun        already closed by the time dmxUnrealizeFont could free them.
3354*4882a593Smuzhiyun        The amount of memory lost each generation is approximately equal
3355*4882a593Smuzhiyun        to 80 bytes per font per back-end.  When this bug is fixed in
3356*4882a593Smuzhiyun        the the X server's device-independent (dix) code, DMX will be
3357*4882a593Smuzhiyun        able to properly free the memory allocated by XLoadQueryFont.
3358*4882a593Smuzhiyun    </para></listitem>
3359*4882a593Smuzhiyun</orderedlist>
3360*4882a593Smuzhiyun</para>
3361*4882a593Smuzhiyun</sect3>
3362*4882a593Smuzhiyun
3363*4882a593Smuzhiyun<sect3>
3364*4882a593Smuzhiyun<title>RATS</title>
3365*4882a593Smuzhiyun
3366*4882a593Smuzhiyun<para>RATS (Rough Auditing Tool for Security) is an open-source (GPL)
3367*4882a593Smuzhiyunsecurity analysis tool that scans source code for common
3368*4882a593Smuzhiyunsecurity-related programming errors (e.g., buffer overflows and TOCTOU
3369*4882a593Smuzhiyunraces).  RATS was used to audit all of the code in the hw/dmx directory
3370*4882a593Smuzhiyunand all "High" notations were checked manually.  The code was either
3371*4882a593Smuzhiyunre-written to eliminate the warning, or a comment containing "RATS" was
3372*4882a593Smuzhiyuninserted on the line to indicate that a human had checked the code.
3373*4882a593SmuzhiyunUnrepaired warnings are as follows:
3374*4882a593Smuzhiyun<orderedlist>
3375*4882a593Smuzhiyun    <listitem><para>
3376*4882a593Smuzhiyun        Fixed-size buffers are used in many areas, but code has been
3377*4882a593Smuzhiyun        added to protect against buffer overflows (e.g., snprintf).
3378*4882a593Smuzhiyun        The only instances that have not yet been fixed are in
3379*4882a593Smuzhiyun        config/xdmxconfig.c (which is not part of the Xdmx server) and
3380*4882a593Smuzhiyun        input/usb-common.c.
3381*4882a593Smuzhiyun    </para></listitem>
3382*4882a593Smuzhiyun    <listitem><para>
3383*4882a593Smuzhiyun        vprintf and vfprintf are used in the logging routines.  In
3384*4882a593Smuzhiyun        general, all uses of these functions (e.g., dmxLog) provide a
3385*4882a593Smuzhiyun        constant format string from a trusted source, so the use is
3386*4882a593Smuzhiyun        relatively benign.
3387*4882a593Smuzhiyun    </para></listitem>
3388*4882a593Smuzhiyun    <listitem><para>
3389*4882a593Smuzhiyun        glxProxy/glxscreens.c uses getenv and strcat.  The use of these
3390*4882a593Smuzhiyun        functions is safe and will remain safe as long as
3391*4882a593Smuzhiyun        ExtensionsString is longer then GLXServerExtensions (ensuring
3392*4882a593Smuzhiyun        this may not be ovious to the casual programmer, but this is in
3393*4882a593Smuzhiyun        automatically generated code, so we hope that the generator
3394*4882a593Smuzhiyun        enforces this constraint).
3395*4882a593Smuzhiyun    </para></listitem>
3396*4882a593Smuzhiyun</orderedlist>
3397*4882a593Smuzhiyun
3398*4882a593Smuzhiyun</para>
3399*4882a593Smuzhiyun
3400*4882a593Smuzhiyun</sect3>
3401*4882a593Smuzhiyun
3402*4882a593Smuzhiyun</sect2>
3403*4882a593Smuzhiyun
3404*4882a593Smuzhiyun</sect1>
3405*4882a593Smuzhiyun
3406*4882a593Smuzhiyun</appendix>
3407*4882a593Smuzhiyun
3408*4882a593Smuzhiyun  </article>
3409*4882a593Smuzhiyun
3410*4882a593Smuzhiyun  <!-- Local Variables: -->
3411*4882a593Smuzhiyun  <!-- fill-column: 72  -->
3412*4882a593Smuzhiyun  <!-- End:             -->
3413