~ubuntu-branches/ubuntu/precise/xorg-server/precise

« back to all changes in this revision

Viewing changes to hw/dmx/doc/scaled.txt

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2011-01-31 19:45:19 UTC
  • mfrom: (1.1.38 upstream) (0.1.19 experimental)
  • Revision ID: james.westby@ubuntu.com-20110131194519-fx30d1zsg83invba
Tags: 2:1.9.99.901+git20110131.be3be758-0ubuntu1
* Merge from (unreleased) debian-experimental.  Remaining Ubuntu changes:
  - rules:
    + Disable SELinux, libaudit-dev is not in main yet. (LP: #406226)
    + Enable xcsecurity. (LP: #247537)
    + Add --with-extra-module-dir to support GL alternatives.
  - control: 
    + Xvfb depends on xauth, x11-xkb-utils. (LP: #500102)
    + Add breaks for incompatible drivers. (LP: #614993)
    + Drop libaudit-dev from build-deps.
  - local/xvfb-run*: Add correct docs about error codes. (LP #328205)
  - debian/patches:
    + 100_rethrow_signals.patch:
      When aborting, re-raise signals for apport
    + 109_fix-swcursor-crash.patch:
      Avoid dereferencing null pointer while reloading cursors during
      resume. (LP: #371405)
    + 111_armel-drv-fallbacks.patch:
      Add support for armel driver fallbacks.
    + 121_only_switch_vt_when_active.diff:
      Add a check to prevent the X server from changing the VT when killing
      GDM from the console.
    + 122_xext_fix_card32_overflow_in_xauth.patch:
      Fix server crash when “xauth generate” is called with large timeout.
    + 157_check_null_modes.patch, 162_null_crtc_in_rotation.patch,
      166_nullptr_xinerama_keyrepeat.patch, 167_nullptr_xisbread.patch
      169_mipointer_nullptr_checks.patch,
      172_cwgetbackingpicture_nullptr_check.patch:
      Fix various segfaults in xserver by checking pointers for NULL
      values before dereferencing them.
    + 165_man_xorg_conf_no_device_ident.patch
      Correct man page
    + 168_glibc_trace_to_stderr.patch:
      Report abort traces to stderr instead of terminal
    + 184_virtual_devices_autodetect.patch:
      Use vesa for qemu device, which is not supported by cirrus
    + 188_default_primary_to_first_busid.patch:
      Pick the first device and carry on (LP: #459512)
    + 190_cache-xkbcomp_output_for_fast_start_up.patch:
    + 191-Xorg-add-an-extra-module-path.patch:
      Add support for the alternatives module path.
    + 198_nohwaccess.patch:
      Adds a -nohwaccess argument to make X not access the hardware
      ports directly.
    + 200_randr-null.patch:
      Clarify a pointer initialization.
    + 206_intel_8xx_default_to_fbdev.patch:
      Makes 8xx class intel GPUs default to fbdev for stability. (LP: #633593)
* Refresh 121_only_switch_vt_when_active.diff for new upstream.
* Drop 187_edid_quirk_hp_nc8430.patch; upstream.
* Drop 189_xserver_1.5.0_bg_none_root.patch; functionality now upstream.
* Refresh 190_cache-xkbcomp_output_for_fast_start_up.patch for new upstream.
* Drop 197_xvfb-randr.patch:
  - miRandR, which this used, has been removed from the server. 
* Drop 204_fix-neg-sync-transition.patch; upstream.
* Drop 207_dga_master_device.patch; upstream.
* Drop 208_switch_on_release.diff; upstream.
* debian/patches/209_add_legacy_bgnone_option.patch:
  - Add "-nr" as a synonym for "-background none" to ease the transition from
    the old 189_xserver_1.5.0_bg_none_root.patch patch.  Can be dropped once
    all the ?DM have been updated to use the new option.
* debian/control:
  - Add Breaks: to xserver-xorg-video-8 and current fglrx.  These proprietary
    drivers don't yet have appropriate dependency information, so manually
    handle them here to prevent broken upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Scaled Window Support in DMX
2
 
 
3
 
Kevin E. Martin
4
 
 
5
 
Rickard E. Faith
6
 
 
7
 
15 October 2003 (created 19 September 2003)
8
 
 
9
 
This document investigates the possibility of adding scaled window support to
10
 
the DMX X server, thereby allowing a window or some selected part of the
11
 
logical DMX area to be displayed using a scaling factor. For example, this
12
 
might allow the contents of a window to be magnified for easier viewing. In
13
 
particular, scaling for the VNC client is explored. Copyright 2003 by Red Hat,
14
 
Inc., Raleigh, North Carolina
15
 
 
16
 
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
17
 
 
18
 
Table of Contents
19
 
 
20
 
Introduction
21
 
 
22
 
    DMX
23
 
    Problem Statement
24
 
    Task
25
 
 
26
 
Previous Work
27
 
 
28
 
    VNC
29
 
    The X Video Extension
30
 
 
31
 
Possible Solutions
32
 
 
33
 
    VNC-like Scaling
34
 
    Application-transparent Scaling for DMX
35
 
    XCreateScaledWindow API
36
 
 
37
 
Conclusion and Recommendations
38
 
 
39
 
Introduction
40
 
 
41
 
DMX
42
 
 
43
 
The DMX X server (Xdmx) is a proxy server that is designed to allow X servers
44
 
on multiple machines to be combined into a single multi-headed X server.
45
 
Combined with Xinerama, these heads can appear as a single very high-resolution
46
 
screen. Typical applications include the creation of a video wall with 16
47
 
1280x1024 displays arranged in a rectangle, for a total resolution of of
48
 
5120x4096.
49
 
 
50
 
Problem Statement
51
 
 
52
 
Applications displayed on a physically large video wall that provides high
53
 
pixel-resolution may be difficult to see, especially if the application is
54
 
designed for use on a typical desktop computer with a relatively small display
55
 
located close to the human operator. The goal of this paper is to describe and
56
 
discuss solutions to this problem.
57
 
 
58
 
The original driving problem for this work is to provide scaling for the
59
 
vncviewer application when displayed using DMX (VNC scaling is currently
60
 
available only with the Windows client, and there is no plan to extend that
61
 
capability to other clients). While this specific problem will be addressed in
62
 
this paper, the general solution space will also be explored, since this may
63
 
lead to a good solution not only for vncviewer but also for other applications.
64
 
 
65
 
Task
66
 
 
67
 
For reference, here is the original description of the task this paper
68
 
addresses:
69
 
 
70
 
  ● Scaled window support (for VNC)
71
 
 
72
 
      ○ Investigate possibility of implementing a "scaled window" extension:
73
 
 
74
 
          □ Add XCreateScaledWindow call that could be used in place of
75
 
            XCreateWindow
76
 
 
77
 
          □ All primitives drawn to scaled window would be scaled by
78
 
            appropriate (integral?) scaling factor
79
 
 
80
 
      ○ Alternate approach: special case VNC support
81
 
 
82
 
Previous Work
83
 
 
84
 
This section reviews relevant previous work.
85
 
 
86
 
VNC
87
 
 
88
 
Scaling under VNC
89
 
 
90
 
When using the vncviewer program for Windows, it is possible to specify a
91
 
scaling factor (as numerator and denominator). When scaling is in effect, the
92
 
viewer software uses StretchBlt (instead of BitBlt) to display the pixels for
93
 
the user. When this call is made, the viewer already has received all of the
94
 
pixel information (at full unscaled resolution).
95
 
 
96
 
The scaling in VNC is primitive. It does not conserve bandwidth, it does not
97
 
treat textual information differently (i.e., by using a suitably scaled font),
98
 
and it does not provide any anti-aliasing other than that provided by the
99
 
underlying (Windows-only) system library.
100
 
 
101
 
The X Video Extension
102
 
 
103
 
The X Video Extension is a widely-available extension to the X11 protocol that
104
 
provides support for streaming video. Integral to this support is the ability
105
 
to arbitrarily scale the output. In version 2.2 of the X Video specification,
106
 
support for scaled still images was provided, using both shared memory and
107
 
traditional transport. The API for this support uses calls that are quite
108
 
similar to XCreateWindow, XPutImage, and XShmPutImage. Currently, most of the
109
 
drivers implemented in XFree86 only support data in various YUV formats.
110
 
However, several modern video adaptors support RGB as well.
111
 
 
112
 
Note, though, that the target output for this scaling is an overlay plane -- so
113
 
X Video provides functionality that is fundamentally different from that
114
 
provided by the Windows StrechBlt call.
115
 
 
116
 
Possible Solutions
117
 
 
118
 
This section briefly discusses possible solutions, including major advantages
119
 
and disadvantages from both the implementation and the end-user programmer
120
 
standpoint.
121
 
 
122
 
VNC-like Scaling
123
 
 
124
 
Software Scaling
125
 
 
126
 
The vncviewer application could be modified to provide software scaling. This
127
 
is not a general solution, but it does solve one of the goals of this work.
128
 
 
129
 
A prototype of this solution was implemented and a patch against
130
 
vnc-3.3.7-unixsrc is available in the dmx/external directory. Because of
131
 
limited time available for this work, all of the edge cases were not considered
132
 
and the solution works well mainly for integer scaling.
133
 
 
134
 
Currently, vncviewer writes to the X display with XPutImage, XCopyArea, and
135
 
XFillRectangle. All instances of these calls have to be aware of scaling and
136
 
must round correctly. In the prototype solution, rounding is incorrect and can
137
 
cause artifacts.
138
 
 
139
 
A better solution would be to cache all updates to the desktop image in
140
 
vncviewer and only send the damaged area to the X display with XPutImage. This
141
 
would allow the damaged area to be computed so that rounding errors do not
142
 
create artifacts. This method is probably similar to what is used in the Window
143
 
client. (The whole VNC suite is being re-written in C++ and the forthcoming
144
 
version 4 has not been evaluated.)
145
 
 
146
 
Scaling with the X Video Extension
147
 
 
148
 
The scaling in the Windows vncviewer application makes use of a scaled blit
149
 
that is supplied by the underlying system library. Several video cards
150
 
currently provide support for a scaled blit, and some X servers (including
151
 
XFree86) expose this capability to applications via the XvPutImage interface of
152
 
the X Video Extension. The capability exposed by XvPutImage results in the
153
 
scaled image being drawn to an overlay plane. Most video cards also provide
154
 
support for a scaled blit into the normal output planes, but this is not
155
 
exposed via XvPutImage.
156
 
 
157
 
The vncviewer program could be modified to use the X Video Extension to provide
158
 
scaling under X11 that is similar to the scaling currently provided under
159
 
Windows. Unfortunately, Xdmx does not currently export the X Video Extension,
160
 
so this would not provide an immediate solution usable with DMX.
161
 
 
162
 
A very early-stage proof-of-concept prototype was implemented and a preliminary
163
 
patch against vnc-3.3.7-unixsrc is available in the dmx/external directory.
164
 
This prototype was implemented to better understand the problems that must be
165
 
solved to make this solution viable:
166
 
 
167
 
  ● As noted under the software scaling section above, vncviewer writes to the
168
 
    X display with several different calls. These calls write to the normal
169
 
    output planes and are compatible with XvPutImage, which writes to an
170
 
    overlay plane. To eliminate artifacts caused by this problem, vncviewer
171
 
    should be modified so that a cached copy of the desktop is available,
172
 
    either as a client-side image or a server-side off-screen pixmap, so that
173
 
    XvPutImage would be the only method for writing to the X display.
174
 
 
175
 
  ● Although several modern graphics adaptors support hardware scaling using an
176
 
    RGB format (e.g., ATI Radeon, nVidia, etc.), XFree86 drivers typically only
177
 
    implement YUV formats. YUV generally compress the pixel information in some
178
 
    way. For example, two commonly implemented formats, YUY2 and UYVY provide
179
 
    intensity information for every RGB pixel, but only provide chroma and
180
 
    luminance information for pairs of horizontal pixels. Since VNC uses
181
 
    pixel-resolution for communicating updates on the wire, additional
182
 
    artifacts are introduced (because there may not be enough information from
183
 
    the wire to update a pair of pixels).
184
 
 
185
 
    Further, the well-known problem with YUV encoding is even more evident when
186
 
    the image is a desktop instead of a movie. For example, consider a
187
 
    1-pixel-wide vertical window border. If the border changes in color but not
188
 
    intensity (e.g., because a window manager uses color to indicate focus),
189
 
    there may or may not be a change in the YUY2 image, depending on the
190
 
    algorithm used for RGB to YUV conversion and on how the border pixel is
191
 
    ordered in the pair of pixels used by the algorithm.
192
 
 
193
 
    Many of these artifacts could be eliminated if vncviewer cached a complete
194
 
    RGB image of the desktop, and only did the conversion to YUV for properly
195
 
    aligned areas of damage. The remaining artifacts could be eliminated if an
196
 
    RGB format was used with X Video (which may require the extension of
197
 
    existing XFree86 drivers to support RGB).
198
 
 
199
 
  ● Most modern video cards support exactly one overlay plane that is suitable
200
 
    for use with X Video. Therefore, only one application can use X Video at
201
 
    any given time. This is a severe limitation in a desktop environment.
202
 
 
203
 
Implementing the X Video Extension for DMX
204
 
 
205
 
The user-level API for X Video is fairly simple, but the underlying support
206
 
required for the full specification is large. However, since the API provides a
207
 
method to query supported capabilities, a usable subset of X Video can be
208
 
implemented that would support XvPutImage and little else. This would require
209
 
support for the following:
210
 
 
211
 
  ● X Video Extension API calls, including the following:
212
 
 
213
 
      ○ XvQueryExtension
214
 
 
215
 
      ○ XvQueryAdaptors
216
 
 
217
 
      ○ XvQueryPortAttributes
218
 
 
219
 
      ○ XvFreeAdaptorInfo
220
 
 
221
 
      ○ XvListImageFormats
222
 
 
223
 
      ○ XvGrabPort
224
 
 
225
 
      ○ XvCreateImage
226
 
 
227
 
      ○ XvPutImage
228
 
 
229
 
      ○ XvShmCreateImage
230
 
 
231
 
      ○ XvShmPutImage
232
 
 
233
 
  ● Support for querying back-end X Video Extension capabilities.
234
 
 
235
 
  ● Support for sending the image to the back-ends. Because X Video requires
236
 
    sending full images, there may be a trade-off between bandwidth limitations
237
 
    and additional complexity to divide the image up such that is scales
238
 
    properly.
239
 
 
240
 
  ● Possible support for a software fall-back. For example, if all of the
241
 
    back-ends do not support the X Video Extension, software scaling can be
242
 
    implemented such that the image is sent to the back-end with XPutImage.
243
 
    This pathway would have poor performance.
244
 
 
245
 
Supporting RGB formats for the X Video Extension
246
 
 
247
 
Assuming an XFree86 driver already supports the X Video Extension, and assuming
248
 
the target hardware supports an RGB format, then adding support for that format
249
 
is relatively simple and straightforward.
250
 
 
251
 
Scaling with an XPutImageScaled Extension
252
 
 
253
 
Instead of (or in addition to) implementing the X Video Extension in DMX, one
254
 
obvious solution would be to implement a new extension that provides access to
255
 
hardware-assisted scaled blits, similar to the StretchBlt call available under
256
 
Windows. This call would scale RGB images and would not use the overlay plane
257
 
(unlike the X Video Extension).
258
 
 
259
 
This approach has many of the same advantages and disadvantages as the
260
 
XCopyAreaScaled Extension, discussed in the next section. Discussion of
261
 
XPutImageScaled is deferred in favor of XCopyAreaScaled for the following
262
 
reasons:
263
 
 
264
 
  ● XPutImageScaled can be emulated with XCopyAreaScaled by first using
265
 
    XPutImage to copy the image to an off-screen pixmap, and then calling
266
 
    XCopyAreaScaled between that off-screen pixmap and the target drawable.
267
 
 
268
 
  ● Since XCopyAreaScaled would copy between two areas of on-screen or
269
 
    off-screen memory, it has additional uses and can be viewed as efficiently
270
 
    providing a superset of XPutImageScaled functionality.
271
 
 
272
 
Scaling with an XCopyAreaScaled Extension
273
 
 
274
 
As noted in the previous section, because XCopyAreaScaled provides a superset
275
 
of the functionality provided by XPutImageScaled, we will consider this
276
 
extension instead.
277
 
 
278
 
First, XCopyAreaScaled would provide for RGB scaling between pixmaps (i.e.,
279
 
on-screen or off-screen areas of memory that reside on the video card). Unlike
280
 
the X Video Extension, which writes into an overlay plane, XCopyAreaScaled
281
 
would write into the non-overlay areas of the screen. Key points to consider
282
 
are as follows:
283
 
 
284
 
  ● Because different planes are involved, the two scaling operations are
285
 
    usually implemented in hardware differently, so an XCopyAreaScaled
286
 
    extension could be added in a manner that would neither conflict with nor
287
 
    interact with the X Video extension in any way.
288
 
 
289
 
  ● The XCopyAreaScaled extension provides new functionality that the X Video
290
 
    Extension does not provide. Based on anecdotal feedback, we believe that
291
 
    many people outside the DMX and VNC communities would be excited about this
292
 
    extension.
293
 
 
294
 
  ● The main drawback to this extension is that it is new and needs to be
295
 
    implemented at the driver level in XFree86 for each video card to be
296
 
    supported. At the present time, it is more likely that the X Video
297
 
    Extension will be implemented for a particular piece hardware because the X
298
 
    Video extension has multimedia uses. However, over time, we would expect
299
 
    the XCopyAreaScaled extension to be implemented along with the X Video
300
 
    extension, especially if it becomes popular.
301
 
 
302
 
  ● Another drawback is that not all modern cards provide support for a simple
303
 
    scaled blit operation. However, these cards usually do provide a 3D
304
 
    pipeline which could be used to provide this functionality in a manner that
305
 
    is transparent to the client application that is using the XCopyAreaScaled
306
 
    extension. However, this implementation pathway would make this extension
307
 
    somewhat more difficult to implement on certain cards.
308
 
 
309
 
Scaling with OpenGL
310
 
 
311
 
Another general solution to the scaling problem is to use the texture scaling
312
 
found in all 3D hardware. This ability is already exposed through OpenGL and
313
 
can be exploited by clients without X server modification (i.e., other than the
314
 
ability to support OpenGL). An application using OpenGL would transmit the
315
 
non-scaled image to the X server as a texture, and would then display a single
316
 
non-transformed rect using that texture. This also works around the single
317
 
overlay problem with the X Video Extension as well as the need to implement
318
 
additional scaled primitive extensions.
319
 
 
320
 
The downside is that most OpenGL implementations require power of 2 texture
321
 
sizes and this can be very wasteful of memory if, for example, the application
322
 
needs to scale a 1025x1025 image, which would require a 2048x2048 texture area
323
 
(even a 640x480 image would require a 1024x512 texture). Another downside is
324
 
that some OpenGL implementations have a limited about of texture memory and
325
 
cannot handle textures that are very large. For example, they might limit the
326
 
texture size to 1024x1024.
327
 
 
328
 
Application-transparent Scaling for DMX
329
 
 
330
 
Back-end Scaling Without Disconnect/Reconnect
331
 
 
332
 
VNC does scaling on the client side (in the vncviewer application).
333
 
Implementing a similar solution for DMX would require support in the back-end X
334
 
servers and, therefore, is not a general solution.
335
 
 
336
 
XFree86 already implements some support for "scaling" that could be used with
337
 
DMX: if, in the XF86Config file, multiple Modes are listed in the Display
338
 
Subsection of the Screen Section, then pressing Ctrl-Alt-Plus and
339
 
Ctrl-Alt-Minus can be used to iterate through the listed modes. The display
340
 
dimensions will change to the dimensions in the Modes line, but the logical
341
 
dimensions of the X server (i.e., the dimensions that Xdmx knows about) will
342
 
not change.
343
 
 
344
 
Further, the dimensions of the XFree86 display are under software control (via
345
 
the XFree86-VidModeExtension), so the Xdmx server could change the screen
346
 
dimensions on a per-display basis, thereby scaling the information on part of
347
 
that display.
348
 
 
349
 
However, this scaling appears to have limited use. For example, assume a 4 by 4
350
 
display wall consisting of 16 1280x1024 displays. If all of the back-end
351
 
servers were simultaneously configured to display 640x480, the left hand corner
352
 
of each display would be magnified, but the composite result would be
353
 
unreadable. Magnifying one display at a time could be usable, but could have
354
 
limited utility, since the result would still be no larger than a single
355
 
display.
356
 
 
357
 
Back-end Scaling With Disconnect/Reconnect
358
 
 
359
 
Disconnect and reconnect features are not currently supported in DMX, but are
360
 
scheduled to be implemented in the future. These features, combined with the
361
 
XFree86-VidModeExtension Extension, would allow an application to do the
362
 
following:
363
 
 
364
 
  ● Disconnect a specific back-end server (via the DMX Extension),
365
 
 
366
 
  ● reconfigure the XFree86 back-end server resolution, and
367
 
 
368
 
  ● reconnect the back-end server to DMX -- at a new origin with the new screen
369
 
    resolution.
370
 
 
371
 
For example, consider a display wall consisting of 16 1280x1024 displays with a
372
 
total resolution of 5120x4096. All of the screens could be disconnected,
373
 
repositioned, and reconnected each at a resolution of 640x480. The total
374
 
resolution of the display wall would be 2560x1920, allowing a view of a
375
 
selected area approximately one-fourth of the size of the DMX display. This
376
 
change would be completely application independent (except, perhaps, for a
377
 
DMX-aware window manager). When work at the increased resolution was completed,
378
 
the back-end servers could be disconnected, reconfigured, and reconnected for
379
 
the original 5120x4096 view.
380
 
 
381
 
Support for this type of scaling can be implemented in a DMX-aware X11 client
382
 
assuming the DMX server support arbitrary disconnect and reconnect semantics.
383
 
Because this application cannot be written before disconnect/reconnect is
384
 
implemented, this solution will not be discussed further in this paper.
385
 
 
386
 
Server-side Scaling
387
 
 
388
 
In earlier versions of DMX, a frame buffer was maintained on the server side,
389
 
and XPutImage was used to move the information from the server to the client
390
 
(similar to some early VNC implementations). The use of a server-side frame
391
 
buffer would allow the server to do scaling, but is not a recommended solution
392
 
because of overall performance issues and server-side memory issues (i.e., the
393
 
frame buffer would be very large for large display walls).
394
 
 
395
 
Exploration of this path is not recommended.
396
 
 
397
 
XCreateScaledWindow API
398
 
 
399
 
The implementation of X Video Extension in DMX, and the use of XvPutImage by
400
 
applications requiring scaling requires significant changes in DMX Further,
401
 
XvPutImage is, essentially a scaled blit, and it is only useful for
402
 
applications which are already using (or can be modified to use) XPutImage.
403
 
Therefore, a more general API will be discussed as another possibility.
404
 
 
405
 
X applications typically create windows with the XCreateWindow call. A new
406
 
extension could provide an XCreateScaledWindow call that could be used in place
407
 
of the XCreateWindow call and be otherwise transparent to the application. This
408
 
would allow applications, even those that do not depend on XPutImage, to take
409
 
advantage of window scaling. In this section we describe how the call would
410
 
work, what transparency it provides, and how to solve the potential problems
411
 
that transparency creates.
412
 
 
413
 
XCreateWindow
414
 
 
415
 
The XCreateWindow call takes width and height as parameters. An
416
 
XCreateScaledWindow call could take all the same parameters, with the addition
417
 
of a scaling factor.
418
 
 
419
 
XSetWindowAttributes
420
 
 
421
 
An X11 window has several attributes that would have to be scaled:
422
 
 
423
 
  ● Background and border pixmaps
424
 
 
425
 
  ● Border width
426
 
 
427
 
  ● Cursor
428
 
 
429
 
XGetWindowAttributes, XGetGeometry
430
 
 
431
 
For transparency, calls that query the window attributes should return unscaled
432
 
information. This suggests that all unscaled pixmaps and window attributes
433
 
should be cached.
434
 
 
435
 
Unfortunately, a window manager requires the scaled geometry to properly
436
 
decorate the window. The X server can probably determine which client is acting
437
 
as the window manager (e.g., because that client will select events that are
438
 
used exclusively by the window manager). However, other Scaled Window Extension
439
 
aware clients may also need to determine the scaled geometry. Therefore, at
440
 
least two additional extension calls should be implemented:
441
 
XGetScaledWindowAttributes and XGetScaledGeometry.
442
 
 
443
 
Popup and Child window positions
444
 
 
445
 
Some applications may position popup and child windows based on an unscaled
446
 
notion of the main window geometry. In this case, additional modifications to
447
 
the client would be required.
448
 
 
449
 
Events
450
 
 
451
 
Most events (e.g., for mouse motion) return information about the coordinates
452
 
at which the even occurred. These coordinates would have to be modified so that
453
 
unscaled values were presented to the client.
454
 
 
455
 
Implementation
456
 
 
457
 
There are many implementation issues, some of which are similar to the issues
458
 
involved in implementing the X Video Extension for DMX. The window contents
459
 
must be scaled, either by performing all operations to a frame buffer and then
460
 
writing the image to the display (perhaps using hardware scaling support), or
461
 
by modifying all of the various drawing operations to perform scaling. Because
462
 
of the complexity involved, the frame buffer option is recommended.
463
 
 
464
 
Conclusion and Recommendations
465
 
 
466
 
We recommend a three phase implementation strategy, based on how an application
467
 
could be written to take advantage of scaling:
468
 
 
469
 
 1. The XCopyAreaScaled extension should be implemented, since this is the
470
 
    ideal solution for applications like VNC, and since making use of this
471
 
    extension will require minimal changes to applications that already use
472
 
    XPutImage or XCopyArea.
473
 
 
474
 
    The initial implementation work would include the design of the X protocol
475
 
    extension, writing this up in the usual format for extension documentation,
476
 
    implementation of the protocol transport pieces in XFree86, implementation
477
 
    of a software fall-back in XFree86 and DMX, one example hardware
478
 
    implementation for XFree86, and implementation of support for this
479
 
    extension in DMX.
480
 
 
481
 
    We suggest implementing the extension first on the ATI Radeon cards.
482
 
    However, since these cards do not provide a 2D scaled blit primitive, the
483
 
    implementation would have to make use of the 3D texture engine to emulate a
484
 
    scaled blit. This is recommended, since other modern graphics cards also do
485
 
    not provide a simple 2D scaled blit operation and an example of the more
486
 
    difficult implementation pathway would be helpful to others.
487
 
 
488
 
 2. Until XCopyAreaScaled is widely supported, applications that require
489
 
    scaling will have to fall back to another scaling method. We suggest OpenGL
490
 
    as the first fall-back method because it is widely available and supported
491
 
    by DMX.
492
 
 
493
 
    A project centered around OpenGL-based scaling would implement this scaling
494
 
    in VNC as an example. This work would include re-writing the vncviewer
495
 
    rendering engine to cache a master copy of the desktop image for all
496
 
    operations.
497
 
 
498
 
 3. Since OpenGL is not implemented everywhere, and may not provide
499
 
    hardware-assisted performance in every implementation, an application that
500
 
    requires scaling should also fall back to using the X Video Extension.
501
 
 
502
 
    This project would add support for the X Video Extension to DMX and would
503
 
    add support to VNC to take advantage of this extension without introducing
504
 
    artifacts. This would require modifying the vncviewer rendering engine to
505
 
    cache a master copy of the desktop image for all operations. This project
506
 
    should also add support for the RGB format to at least one XFree86 driver
507
 
    (e.g., ATI Radeon).
508
 
 
509
 
    The X Video Extension is one of the few popular extensions that DMX does
510
 
    not support. We recommend implementing the X Video Extension even if
511
 
    scaling is the specific goal of that work.
512
 
 
513
 
We do not recommend implementation of the XCreateScaledWindow extension because
514
 
of the complexity involved. We do not recommend implementation of the
515
 
XPutImageScaled extension because it requires the same amount of work as the
516
 
XCopyAreaScaled extension, but provides less functionality. Further,
517
 
server-side scaling with a large frame buffer is not recommended because of the
518
 
performance implications.
519
 
 
520
 
The back-end scaling, especially with disconnect/reconnect support should be
521
 
explored in the future after disconnect/reconnect is implemented, but not at
522
 
the present time.
523