scaled.xml 37 KB

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