1ea1d6981Smrg<?xml version="1.0" encoding="UTF-8" ?>
2ea1d6981Smrg<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3ea1d6981Smrg                   "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
4ea1d6981Smrg[
5ea1d6981Smrg<!ENTITY % defs SYSTEM "defs.ent"> %defs;
6ea1d6981Smrg]>
7ea1d6981Smrg
8ea1d6981Smrg
9ea1d6981Smrg<!-- lifted from troff+ms+XMan by doclifter -->
10ea1d6981Smrg<book id="multibuf">
11ea1d6981Smrg
12ea1d6981Smrg<bookinfo>
13ea1d6981Smrg   <title>Extending X for Double-Buffering, Multi-Buffering, and Stereo</title>
14ea1d6981Smrg   <authorgroup>
15ea1d6981Smrg      <othercredit>
16ea1d6981Smrg         <firstname>Jeffrey</firstname><surname>Friedberg</surname>
17ea1d6981Smrg      </othercredit>
18ea1d6981Smrg      <othercredit>
19ea1d6981Smrg         <firstname>Larry</firstname><surname>Seiler</surname>
20ea1d6981Smrg      </othercredit>
21ea1d6981Smrg      <othercredit>
22ea1d6981Smrg         <firstname>Jeff</firstname><surname>Vroom</surname>
23ea1d6981Smrg      </othercredit>
24ea1d6981Smrg   </authorgroup>
25ea1d6981Smrg   <copyright><year>1989</year><holder>Digital Equipment Corporation</holder></copyright>
26ea1d6981Smrg   <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
27ea1d6981Smrg   <releaseinfo>Version 3.3</releaseinfo>
28ea1d6981Smrg
29ea1d6981Smrg<legalnotice>
30ea1d6981Smrg<para>
31ea1d6981SmrgPermission to use, copy, modify, and distribute this documentation for any
32ea1d6981Smrgpurpose and without fee is hereby granted, provided that the above copyright
33ea1d6981Smrgnotice and this permission notice appear in all copies.
34ea1d6981SmrgDigital Equipment Corporation makes no representations
35ea1d6981Smrgabout the suitability for any purpose of the information in
36ea1d6981Smrgthis document.  This documentation is provided "as is"
37ea1d6981Smrgwithout express or implied warranty.  This document
38ea1d6981Smrgis subject to change.
39ea1d6981Smrg</para>
40ea1d6981Smrg</legalnotice>
41ea1d6981Smrg
42ea1d6981Smrg<legalnotice>
43ea1d6981Smrg<para role="multiLicensing">Copyright © 1989, 1994 X Consortium</para>
44ea1d6981Smrg<para>
45ea1d6981SmrgPermission is hereby granted, free of charge, to any person obtaining a copy
46ea1d6981Smrgof this software and associated documentation files (the ``Software''), to deal
47ea1d6981Smrgin the Software without restriction, including without limitation the rights
48ea1d6981Smrgto use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49ea1d6981Smrgcopies of the Software, and to permit persons to whom the Software is
50ea1d6981Smrgfurnished to do so, subject to the following conditions:
51ea1d6981Smrg</para>
52ea1d6981Smrg<para>
53ea1d6981SmrgThe above copyright notice and this permission notice shall be included in
54ea1d6981Smrgall copies or substantial portions of the Software.
55ea1d6981Smrg</para>
56ea1d6981Smrg<para>
57ea1d6981SmrgTHE SOFTWARE IS PROVIDED &ldquo;AS IS&rdquo;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58ea1d6981SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59ea1d6981SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
60ea1d6981SmrgX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
61ea1d6981SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
62ea1d6981SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
63ea1d6981Smrg</para>
64ea1d6981Smrg<para>
65ea1d6981SmrgExcept as contained in this notice, the name of the X Consortium shall not be
66ea1d6981Smrgused in advertising or otherwise to promote the sale, use or other dealings
67ea1d6981Smrgin this Software without prior written authorization from the X Consortium.
68ea1d6981Smrg</para>
69ea1d6981Smrg<para>X Window System is a trademark of The OpenGroup.</para>
70ea1d6981Smrg
71ea1d6981Smrg</legalnotice>
72ea1d6981Smrg</bookinfo>
73ea1d6981Smrg
74ea1d6981Smrg<preface><title>Warning</title>
75ea1d6981Smrg<warning><para>
76ea1d6981SmrgThe <emphasis remap='I'>Multi-Buffering</emphasis> extension described here
77ea1d6981Smrgwas a draft standard of the X Consortium prior to Release 6.1.  It has been
78ea1d6981Smrgsuperseded by the Double Buffer
79ea1d6981SmrgExtension (DBE).  DBE is an X Consortium Standard as of Release 6.1.
80ea1d6981Smrg</para></warning>
81ea1d6981Smrg</preface>
82ea1d6981Smrg
83ea1d6981Smrg<chapter id='Introduction'>
84ea1d6981Smrg<title>Introduction</title>
85ea1d6981Smrg
86ea1d6981Smrg<para>
87ea1d6981SmrgSeveral proposals have been written that address some of the
88ea1d6981Smrgissues surrounding the support of double-buffered, multi-buffered,
89ea1d6981Smrgand stereo windows in the X Window System:
90ea1d6981Smrg</para>
91ea1d6981Smrg
92ea1d6981Smrg<itemizedlist>
93ea1d6981Smrg  <listitem>
94ea1d6981Smrg    <para>
95ea1d6981Smrg<emphasis remap='I'>Extending X for Double-Buffering,</emphasis>
96ea1d6981SmrgJeffrey Friedberg, Larry Seiler, Randi Rost.
97ea1d6981Smrg    </para>
98ea1d6981Smrg  </listitem>
99ea1d6981Smrg  <listitem>
100ea1d6981Smrg    <para>
101ea1d6981Smrg<emphasis remap='I'>(Proposal for) Double-Buffering Extensions</emphasis>,
102ea1d6981SmrgJeff Vroom.
103ea1d6981Smrg    </para>
104ea1d6981Smrg  </listitem>
105ea1d6981Smrg  <listitem>
106ea1d6981Smrg    <para>
107ea1d6981Smrg<emphasis remap='I'>An Extension to X.11 for Displays with Multiple Buffers,</emphasis>
108ea1d6981SmrgDavid S.H. Rosenthal.
109ea1d6981Smrg    </para>
110ea1d6981Smrg  </listitem>
111ea1d6981Smrg  <listitem>
112ea1d6981Smrg    <para>
113ea1d6981Smrg<emphasis remap='I'>A Multiple Buffering/Stereo Proposal</emphasis>,
114ea1d6981SmrgMark Patrick.
115ea1d6981Smrg    </para>
116ea1d6981Smrg  </listitem>
117ea1d6981Smrg</itemizedlist>
118ea1d6981Smrg
119ea1d6981Smrg<para>
120ea1d6981SmrgThe authors of this proposal have tried to unify the above documents
121ea1d6981Smrgto yield a proposal that incorporates support for double-buffering,
122ea1d6981Smrgmulti-buffering, and stereo in a way that is acceptable to all concerned.
123ea1d6981Smrg</para>
124ea1d6981Smrg</chapter>
125ea1d6981Smrg
126ea1d6981Smrg<chapter id='Goals'>
127ea1d6981Smrg<title>Goals</title>
128ea1d6981Smrg
129ea1d6981Smrg<para>
130ea1d6981SmrgClients should be able to:
131ea1d6981Smrg</para>
132ea1d6981Smrg
133ea1d6981Smrg<itemizedlist>
134ea1d6981Smrg  <listitem>
135ea1d6981Smrg    <para>
136ea1d6981SmrgAssociate multiple buffers with a window.
137ea1d6981Smrg    </para>
138ea1d6981Smrg  </listitem>
139ea1d6981Smrg  <listitem>
140ea1d6981Smrg    <para>
141ea1d6981SmrgPaint in any buffer associated with a window.
142ea1d6981Smrg    </para>
143ea1d6981Smrg  </listitem>
144ea1d6981Smrg  <listitem>
145ea1d6981Smrg    <para>
146ea1d6981SmrgDisplay any buffer associated with a window.
147ea1d6981Smrg    </para>
148ea1d6981Smrg  </listitem>
149ea1d6981Smrg  <listitem>
150ea1d6981Smrg    <para>
151ea1d6981SmrgDisplay a series of buffers in a window in rapid succession
152ea1d6981Smrgto achieve a <emphasis remap='I'>smooth</emphasis> animation.
153ea1d6981Smrg    </para>
154ea1d6981Smrg  </listitem>
155ea1d6981Smrg  <listitem>
156ea1d6981Smrg    <para>
157ea1d6981SmrgRequest simultaneous display of different buffers in different windows.
158ea1d6981Smrg    </para>
159ea1d6981Smrg  </listitem>
160ea1d6981Smrg</itemizedlist>
161ea1d6981Smrg
162ea1d6981Smrg<para>
163ea1d6981SmrgIn addition, the extension should:
164ea1d6981Smrg</para>
165ea1d6981Smrg
166ea1d6981Smrg<itemizedlist>
167ea1d6981Smrg  <listitem>
168ea1d6981Smrg    <para>
169ea1d6981SmrgAllow existing X applications to run unchanged.
170ea1d6981Smrg    </para>
171ea1d6981Smrg  </listitem>
172ea1d6981Smrg  <listitem>
173ea1d6981Smrg    <para>
174ea1d6981SmrgSupport a range of implementation methods that can capitalize on
175ea1d6981Smrgexisting hardware features.
176ea1d6981Smrg    </para>
177ea1d6981Smrg  </listitem>
178ea1d6981Smrg</itemizedlist>
179ea1d6981Smrg
180ea1d6981Smrg</chapter>
181ea1d6981Smrg
182ea1d6981Smrg<chapter id='Image_Buffers'>
183ea1d6981Smrg<title>Image Buffers</title>
184ea1d6981Smrg
185ea1d6981Smrg<para>
186ea1d6981SmrgNormal windows are created using the standard
187ea1d6981Smrg<function>CreateWindow</function> request:
188ea1d6981Smrg</para>
189ea1d6981Smrg
190ea1d6981Smrg<literallayout class="monospaced">
191ea1d6981SmrgCreateWindow
192ea1d6981Smrg     parent          : WINDOW
193ea1d6981Smrg     w_id            : WINDOW
194ea1d6981Smrg     depth           : CARD8
195ea1d6981Smrg     visual          : VISUALID or CopyFromParent
196ea1d6981Smrg     x, y            : INT16
197ea1d6981Smrg     width, height   : INT16
198ea1d6981Smrg     border_width    : INT16
199ea1d6981Smrg     value_mask      : BITMASK
200ea1d6981Smrg     value_list      : LISTofVALUE
201ea1d6981Smrg</literallayout>
202ea1d6981Smrg
203ea1d6981Smrg<para>
204ea1d6981SmrgThis request allocates a set of window attributes and
205ea1d6981Smrga buffer into which an image can be drawn.
206ea1d6981SmrgThe contents of this <emphasis remap='I'>image buffer</emphasis> will
207ea1d6981Smrgbe displayed when the window is mapped to the screen.
208ea1d6981Smrg</para>
209ea1d6981Smrg
210ea1d6981Smrg<para>
211ea1d6981SmrgTo support double-buffering and multi-buffering,
212ea1d6981Smrgwe introduce the notion that additional image buffers can
213ea1d6981Smrgbe created and bound together to form groups.
214ea1d6981SmrgThe following rules will apply:
215ea1d6981Smrg</para>
216ea1d6981Smrg
217ea1d6981Smrg<itemizedlist>
218ea1d6981Smrg  <listitem>
219ea1d6981Smrg    <para>
220ea1d6981SmrgAll image buffers in a group will have the same
221ea1d6981Smrgvisual type, depth, and geometry (ie: width and height).
222ea1d6981Smrg    </para>
223ea1d6981Smrg  </listitem>
224ea1d6981Smrg  <listitem>
225ea1d6981Smrg    <para>
226ea1d6981SmrgOnly one image buffer per group can be displayed
227ea1d6981Smrgat a time.
228ea1d6981Smrg    </para>
229ea1d6981Smrg  </listitem>
230ea1d6981Smrg  <listitem>
231ea1d6981Smrg    <para>
232ea1d6981SmrgDraw operations can occur to any image buffer at
233ea1d6981Smrgany time.
234ea1d6981Smrg    </para>
235ea1d6981Smrg  </listitem>
236ea1d6981Smrg  <listitem>
237ea1d6981Smrg    <para>
238ea1d6981SmrgWindow management requests (<function>MapWindow</function>, <function>DestroyWindow</function>,
239ea1d6981Smrg<function>ConfigureWindow</function>, etc...)
240ea1d6981Smrgaffect all image buffers associated with a window.
241ea1d6981Smrg    </para>
242ea1d6981Smrg  </listitem>
243ea1d6981Smrg  <listitem>
244ea1d6981Smrg    <para>
245ea1d6981SmrgAppropriate resize and exposure events will be generated
246ea1d6981Smrgfor every image buffer that is affected by a window
247ea1d6981Smrgmanagement operation.
248ea1d6981Smrg    </para>
249ea1d6981Smrg  </listitem>
250ea1d6981Smrg</itemizedlist>
251ea1d6981Smrg
252ea1d6981Smrg<para>
253ea1d6981SmrgBy allowing draw operations to occur on any image buffer at any time,
254ea1d6981Smrga client could, on a multi-threaded multi-processor server,
255ea1d6981Smrgsimultaneously build up images for display.
256ea1d6981SmrgTo support this, each buffer must have its own resource ID.
257ea1d6981SmrgSince buffers are different than windows and pixmaps
258ea1d6981Smrg(buffers are not hierarchical and pixmaps cannot be displayed)
259ea1d6981Smrga new resource, <function>Buffer</function>, is introduced.
260ea1d6981SmrgFurthermore, a <function>Buffer</function> is also a <function>Drawable</function>, thus
261ea1d6981Smrgdraw operations may also be performed on buffers simply
262ea1d6981Smrgby passing a buffer ID to the existing pixmap/window
263ea1d6981Smrginterface.
264ea1d6981Smrg</para>
265ea1d6981Smrg
266ea1d6981Smrg<para>
267ea1d6981SmrgTo allow existing X applications to work unchanged, we assume
268ea1d6981Smrga window ID passed in a draw request, for a multi-buffered
269ea1d6981Smrgwindow, will be an <emphasis remap='I'>alias</emphasis> for the ID of the currently
270ea1d6981Smrgdisplayed image buffer.  Any draw requests (eq: <function>GetImage</function>) on
271ea1d6981Smrgthe window will be relative to the displayed image buffer.
272ea1d6981Smrg</para>
273ea1d6981Smrg
274ea1d6981Smrg<para>
275ea1d6981SmrgIn window management requests, only a window ID will be
276ea1d6981Smrgaccepted.  Requests like <function>QueryTree</function>, will continue to
277ea1d6981Smrgreturn only window ID's.  Most events will return
278ea1d6981Smrgjust the window ID.  Some new events, described in a subsequent
279ea1d6981Smrgsection, will return a buffer ID.
280ea1d6981Smrg</para>
281ea1d6981Smrg
282ea1d6981Smrg<para>
283ea1d6981SmrgWhen a window has backing store the contents of the window
284ea1d6981Smrgare saved off-screen.  Likewise, when the contents of an image
285ea1d6981Smrgbuffer of a multi-buffer window is saved off-screen, it is
286ea1d6981Smrgsaid to have backing store.  This applies to all image buffers,
287ea1d6981Smrgwhether or not they are selected for display.
288ea1d6981Smrg</para>
289ea1d6981Smrg
290ea1d6981Smrg<para>
291ea1d6981SmrgIn some multi-buffer implementations, undisplayed buffers might be
292ea1d6981Smrgimplemented using pixmaps.  Since the contents of pixmaps exist
293ea1d6981Smrgoff-screen and are not affected by occlusion, these image buffers
294ea1d6981Smrgin effect have backing store.
295ea1d6981Smrg</para>
296ea1d6981Smrg
297ea1d6981Smrg<para>
298ea1d6981SmrgOn the other hand, both the displayed and undisplayed image buffers
299ea1d6981Smrgmight be implemented using a subset of the on-screen pixels.
300ea1d6981SmrgIn this case, unless the contents of an image buffer are saved
301ea1d6981Smrgoff-screen, these image buffers in effect do not have backing store.
302ea1d6981Smrg</para>
303ea1d6981Smrg
304ea1d6981Smrg<para>
305ea1d6981SmrgOutput to any image buffer of an unmapped multi-buffered window
306ea1d6981Smrgthat does not have backing store is discarded.  Output to any
307ea1d6981Smrgimage buffer of a mapped multi-buffer window will be performed;
308ea1d6981Smrghowever, portions of an image buffer may be occluded or clipped.
309ea1d6981Smrg</para>
310ea1d6981Smrg
311ea1d6981Smrg<para>
312ea1d6981SmrgWhen an unmapped multi-buffered window becomes mapped, the contents
313ea1d6981Smrgof any image buffer buffer that did not have backing store is
314ea1d6981Smrgtiled with the background and zero or more exposure events are
315ea1d6981Smrggenerated.  If no background is defined for the window, then
316ea1d6981Smrgthe screen contents are not altered and the contents of any
317ea1d6981Smrgundisplayed image buffers are undefined.  If backing store was
318ea1d6981Smrgmaintained for an image buffer, then no exposure events are generated.
319ea1d6981Smrg</para>
320ea1d6981Smrg</chapter>
321ea1d6981Smrg
322ea1d6981Smrg<chapter id='New_Requests'>
323ea1d6981Smrg<title>New Requests</title>
324ea1d6981Smrg
325ea1d6981Smrg<para>
326ea1d6981SmrgThe new request, <function>CreateImageBuffers</function>, creates a group of
327ea1d6981Smrgimage buffers and associates them with a normal X window:
328ea1d6981Smrg</para>
329ea1d6981Smrg
330ea1d6981Smrg<literallayout class="monospaced">
331ea1d6981SmrgCreateImageBuffers
332ea1d6981Smrg     w_id           : WINDOW
333ea1d6981Smrg     buffers        : LISTofBUFFER
334ea1d6981Smrg     update_action  : {Undefined,Background,Untouched,Copied}
335ea1d6981Smrg     update_hint    : {Frequent,Intermittent,Static}
336ea1d6981Smrg     =&gt;
337ea1d6981Smrg     number_buffers : CARD16
338ea1d6981Smrg
339ea1d6981Smrg     (Errors: Window, IDChoice, Value)
340ea1d6981Smrg</literallayout>
341ea1d6981Smrg
342ea1d6981Smrg<para>
343ea1d6981SmrgOne image buffer will be associated with each ID passed in
344ea1d6981Smrg<emphasis remap='I'>buffers</emphasis>.
345ea1d6981SmrgThe first buffer of the list is referred to as buffer[0], the next
346ea1d6981Smrgbuffer[1], and so on.  Each buffer will have the same visual type
347ea1d6981Smrgand geometry as the window.
348ea1d6981SmrgBuffer[0] will refer to the image buffer already associated
349ea1d6981Smrgwith the window ID and its contents will not be modified.
350ea1d6981SmrgThe displayed image buffer attribute is set to buffer[0].
351ea1d6981Smrg</para>
352ea1d6981Smrg
353ea1d6981Smrg<para>
354ea1d6981SmrgImage buffers for the remaining ID's (buffer[1],...) are allocated.
355ea1d6981SmrgIf the window is mapped, or if these image buffers have backing
356ea1d6981Smrgstore, their contents will be tiled with the window background
357ea1d6981Smrg(if no background is defined, the buffer contents are undefined),
358ea1d6981Smrgand zero or more expose events will be generated for each of these
359ea1d6981Smrgbuffers.  The contents of an image buffer is undefined when
360ea1d6981Smrgthe window is unmapped and the buffer does not have backing store.
361ea1d6981Smrg</para>
362ea1d6981Smrg
363ea1d6981Smrg<para>
364ea1d6981SmrgIf the window already has a group of image buffers
365ea1d6981Smrgassociated with it (ie: from a previous <function>CreateImageBuffers</function> request)
366ea1d6981Smrgthe actions described for <function>DestroyImageBuffers</function> are performed first
367ea1d6981Smrg(this will delete the association of the previous buffer ID's and
368ea1d6981Smrgtheir buffers as well as de-allocate all buffers except for the
369ea1d6981Smrgone already associated with the window ID).
370ea1d6981Smrg</para>
371ea1d6981Smrg
372ea1d6981Smrg<para>
373ea1d6981SmrgTo allow a server implementation to efficiently allocate the
374ea1d6981Smrgbuffers, the total number of buffers required and
375ea1d6981Smrgthe update action (how they will behave during an update)
376ea1d6981Smrgis specified "up front" in the request.
377ea1d6981SmrgIf the server cannot allocate all the buffers requested, the
378ea1d6981Smrgtotal number of buffers actually allocated will be returned.
379ea1d6981SmrgNo <function>Alloc</function> errors will be generated \- buffer[0] can
380ea1d6981Smrgalways be associated with the existing displayed image buffer.
381ea1d6981Smrg</para>
382ea1d6981Smrg
383ea1d6981Smrg<para>
384ea1d6981SmrgFor example, an application that wants to animate a short movie
385ea1d6981Smrgloop may request 64 image buffers.  The server may only be able to
386ea1d6981Smrgsupport 16 image buffers of this type, size, and depth.
387ea1d6981SmrgThe application can then decide 16 buffers is sufficient and may
388ea1d6981Smrgtruncate the movie loop, or it may decide it really needs
389ea1d6981Smrg64 and will free the buffers and complain to the user.
390ea1d6981Smrg</para>
391ea1d6981Smrg
392ea1d6981Smrg<para>
393ea1d6981SmrgOne might be tempted to provide a request that inquires whether
394ea1d6981Smrg<emphasis remap='I'>n</emphasis>
395ea1d6981Smrgbuffers of a particular type, size, and depth
396ea1d6981Smrg<emphasis remap='I'>could</emphasis> be allocated.
397ea1d6981SmrgBut if the query is decoupled from the actual allocation,
398ea1d6981Smrganother client could sneak in and take the buffers before the
399ea1d6981Smrgoriginal client has allocated them.
400ea1d6981Smrg</para>
401ea1d6981Smrg
402ea1d6981Smrg<para>
403ea1d6981SmrgWhile any buffer of a group can be selected for display,
404ea1d6981Smrgsome applications may display buffers in a predictable order
405ea1d6981Smrg(ie: the movie loop application).  The
406ea1d6981Smrg<emphasis remap='I'>list order</emphasis>
407ea1d6981Smrg(buffer[0], buffer[1], ...) will be used as a hint by the
408ea1d6981Smrgserver as to which buffer will be displayed next.
409ea1d6981SmrgA client displaying buffers in this order may see a
410ea1d6981Smrgperformance improvement.
411ea1d6981Smrg</para>
412ea1d6981Smrg
413ea1d6981Smrg<para>
414ea1d6981Smrg<emphasis remap='I'>update_action</emphasis> indicates what should happen to a previously
415ea1d6981Smrgdisplayed buffer when a different buffer becomes displayed.
416ea1d6981SmrgPossible actions are:
417ea1d6981Smrg</para>
418ea1d6981Smrg
419ea1d6981Smrg<variablelist>
420ea1d6981Smrg  <varlistentry>
421ea1d6981Smrg    <term>Undefined</term>
422ea1d6981Smrg    <listitem>
423ea1d6981Smrg      <para>
424ea1d6981SmrgThe contents of the buffer that was
425ea1d6981Smrglast displayed will become undefined after the update.  This
426ea1d6981Smrgis the most efficient action since it allows the implementation
427ea1d6981Smrgto trash the contents of the buffer if it needs to.
428ea1d6981Smrg      </para>
429ea1d6981Smrg    </listitem>
430ea1d6981Smrg  </varlistentry>
431ea1d6981Smrg  <varlistentry>
432ea1d6981Smrg    <term>Background</term>
433ea1d6981Smrg    <listitem>
434ea1d6981Smrg      <para>
435ea1d6981SmrgThe contents of the buffer that was
436ea1d6981Smrglast displayed will be set to the background of the window after the update.
437ea1d6981SmrgThe background action allows devices to use a fast clear
438ea1d6981Smrgcapability during an update.
439ea1d6981Smrg      </para>
440ea1d6981Smrg    </listitem>
441ea1d6981Smrg  </varlistentry>
442ea1d6981Smrg  <varlistentry>
443ea1d6981Smrg    <term>Untouched</term>
444ea1d6981Smrg    <listitem>
445ea1d6981Smrg      <para>
446ea1d6981SmrgThe contents of the buffer that was
447ea1d6981Smrglast displayed will be untouched after the update.  Used
448ea1d6981Smrgprimarily when cycling through images that have already
449ea1d6981Smrgbeen drawn.
450ea1d6981Smrg      </para>
451ea1d6981Smrg    </listitem>
452ea1d6981Smrg  </varlistentry>
453ea1d6981Smrg  <varlistentry>
454ea1d6981Smrg    <term>Copied</term>
455ea1d6981Smrg    <listitem>
456ea1d6981Smrg      <para>
457ea1d6981SmrgThe contents of the buffer that was
458ea1d6981Smrglast displayed will become the same as those that are being
459ea1d6981Smrgdisplayed after the update.  This is useful when incrementally
460ea1d6981Smrgadding to an image.
461ea1d6981Smrg      </para>
462ea1d6981Smrg    </listitem>
463ea1d6981Smrg  </varlistentry>
464ea1d6981Smrg</variablelist>
465ea1d6981Smrg
466ea1d6981Smrg
467ea1d6981Smrg
468ea1d6981Smrg<para>
469ea1d6981Smrg<emphasis remap='I'>update_hint</emphasis> indicates how often the client will
470ea1d6981Smrgrequest a different buffer to be displayed.
471ea1d6981SmrgThis hint will allow smart server implementations to choose the
472ea1d6981Smrgmost efficient means to support a multi-buffered window based
473ea1d6981Smrgon the current need of the application (dumb implementations
474ea1d6981Smrgmay choose to ignore this hint).  Possible hints are:
475ea1d6981Smrg</para>
476ea1d6981Smrg
477ea1d6981Smrg<variablelist>
478ea1d6981Smrg  <varlistentry>
479ea1d6981Smrg    <term>Frequent</term>
480ea1d6981Smrg    <listitem>
481ea1d6981Smrg      <para>
482ea1d6981SmrgAn animation or movie loop is
483ea1d6981Smrgbeing attempted and the fastest, most efficient means for
484ea1d6981Smrgmulti-buffering should be employed.
485ea1d6981Smrg      </para>
486ea1d6981Smrg    </listitem>
487ea1d6981Smrg  </varlistentry>
488ea1d6981Smrg  <varlistentry>
489ea1d6981Smrg    <term>Intermittent</term>
490ea1d6981Smrg    <listitem>
491ea1d6981Smrg      <para>
492ea1d6981SmrgThe displayed image will be
493ea1d6981Smrgchanged every so often.  This is common for images that are
494ea1d6981Smrgdisplayed at a rate slower than a second.  For example, a
495ea1d6981Smrgclock that is updated only once a minute.
496ea1d6981Smrg      </para>
497ea1d6981Smrg    </listitem>
498ea1d6981Smrg  </varlistentry>
499ea1d6981Smrg  <varlistentry>
500ea1d6981Smrg    <term>Static</term>
501ea1d6981Smrg    <listitem>
502ea1d6981Smrg      <para>
503ea1d6981SmrgThe displayed image buffer will
504ea1d6981Smrgnot be changed any time soon.  Typically set by an application
505ea1d6981Smrgwhenever there is a pause in the animation.
506ea1d6981Smrg      </para>
507ea1d6981Smrg    </listitem>
508ea1d6981Smrg  </varlistentry>
509ea1d6981Smrg</variablelist>
510ea1d6981Smrg
511ea1d6981Smrg<para>
512ea1d6981SmrgTo display an image buffer the following request can be used:
513ea1d6981Smrg</para>
514ea1d6981Smrg
515ea1d6981Smrg<literallayout class="monospaced">
516ea1d6981SmrgDisplayImageBuffers
517ea1d6981Smrg     buffers         : LISTofBUFFER
518ea1d6981Smrg     min_delay       : CARD16
519ea1d6981Smrg     max_delay       : CARD16
520ea1d6981Smrg
521ea1d6981Smrg     (Errors: Buffer, Match)
522ea1d6981Smrg</literallayout>
523ea1d6981Smrg
524ea1d6981Smrg<para>
525ea1d6981SmrgThe image buffers listed will become displayed as simultaneously
526ea1d6981Smrgas possible and the update action, bound at
527ea1d6981Smrg<function>CreateImageBuffers</function>
528ea1d6981Smrgtime, will be performed.
529ea1d6981Smrg</para>
530ea1d6981Smrg
531ea1d6981Smrg<para>
532ea1d6981SmrgA list of buffers is specified to
533ea1d6981Smrgallow the server to efficiently change the display of more than one
534ea1d6981Smrgwindow at a time (ie: when a global screen swap method is used).
535ea1d6981SmrgAttempting to simultaneously display
536ea1d6981Smrgmultiple image buffers from the same window is an error
537ea1d6981Smrg(<function>Match</function>) since it violates the rule that only one
538ea1d6981Smrgimage buffer per group can be displayed at a time.
539ea1d6981Smrg</para>
540ea1d6981Smrg
541ea1d6981Smrg<para>
542ea1d6981SmrgIf a specified buffer is already displayed,
543ea1d6981Smrgany delays and update action will still be
544ea1d6981Smrgperformed for that buffer.  In this instance,
545ea1d6981Smrgonly the update action of <emphasis remap='I'>Background</emphasis>
546ea1d6981Smrg(and possibly
547ea1d6981Smrg<emphasis remap='I'>Undefined</emphasis>) will have any affect on the
548ea1d6981Smrgcontents of the displayed buffer.  These semantics allow
549ea1d6981Smrgan animation application to successfully execute
550ea1d6981Smrgeven when there is only a single buffer available
551ea1d6981Smrgfor a window.
552ea1d6981Smrg</para>
553ea1d6981Smrg<para>
554ea1d6981Smrg<!-- .LP -->
555ea1d6981SmrgWhen a <function>DisplayImageBuffers</function> request is made to an unmapped
556ea1d6981Smrgmulti-buffered window, the effect of the update action depends
557ea1d6981Smrgon whether the image buffers involved have backing store.
558ea1d6981SmrgWhen the target of the update action is an image buffer that
559ea1d6981Smrgdoes not have backing store, output is discarded.  When the
560ea1d6981Smrgtarget image buffer does have backing store, the update is performed;
561ea1d6981Smrghowever, when the source of the update is an image buffer does not
562ea1d6981Smrghave backing store (as in the case of update action
563ea1d6981Smrg<emphasis remap='I'>Copied</emphasis>), the
564ea1d6981Smrgcontents of target image buffer will become undefined.
565ea1d6981Smrg</para>
566ea1d6981Smrg<para>
567ea1d6981Smrg<!-- .LP -->
568ea1d6981Smrg<emphasis remap='I'>min_delay</emphasis> and
569ea1d6981Smrg<emphasis remap='I'>max_delay</emphasis> put a bound on how long the
570ea1d6981Smrgserver should wait before processing the display request.
571ea1d6981SmrgFor each of the windows to be updated by this request, at least
572ea1d6981Smrg<emphasis remap='I'>min_delay</emphasis> milli-seconds should elapse since
573ea1d6981Smrgthe last
574ea1d6981Smrgtime any of the windows were updated; conversely, no window
575ea1d6981Smrgshould have to wait more than <emphasis remap='I'>max_delay</emphasis>
576ea1d6981Smrgmilli-seconds before being updated.
577ea1d6981Smrg</para>
578ea1d6981Smrg
579ea1d6981Smrg<para>
580ea1d6981Smrg<emphasis remap='I'>min_delay</emphasis> allows an application to
581ea1d6981Smrg<emphasis remap='I'>slow down</emphasis> an animation or movie loop so that
582ea1d6981Smrgit appears
583ea1d6981Smrgsynchronized at a rate the server can support given the current load.
584ea1d6981SmrgFor example, a <emphasis remap='I'>min_delay</emphasis> of 100 indicates the
585ea1d6981Smrgserver should
586ea1d6981Smrgwait at least 1/10 of a second since the last time any of the
587ea1d6981Smrgwindows were updated.  A <emphasis remap='I'>min_delay</emphasis> of zero
588ea1d6981Smrgindicates no waiting is necessary.
589ea1d6981Smrg</para>
590ea1d6981Smrg
591ea1d6981Smrg<para>
592ea1d6981Smrg<emphasis remap='I'>max_delay</emphasis> can be thought of as an additional
593ea1d6981Smrgdelay beyond <emphasis remap='I'>min_delay</emphasis> the server is allowed
594ea1d6981Smrgto wait
595ea1d6981Smrgto facilitate such things as efficient update of multiple windows.
596ea1d6981SmrgIf <emphasis remap='I'>max_delay</emphasis> would require an update before
597ea1d6981Smrg<emphasis remap='I'>min_delay</emphasis>
598ea1d6981Smrgis satisfied, then the server should process the display request as
599ea1d6981Smrgsoon as the <emphasis remap='I'>min_delay</emphasis> requirement is met.  A
600ea1d6981Smrgtypical value for <emphasis remap='I'>max_delay</emphasis> is zero.
601ea1d6981Smrg</para>
602ea1d6981Smrg
603ea1d6981Smrg<para>
604ea1d6981SmrgTo implement the above functionality, the time since the last
605ea1d6981Smrgupdate by a <function>DisplayImageBuffers</function> request for each
606ea1d6981Smrgmulti-buffered
607ea1d6981Smrgwindow needs to be saved as state by the server.
608ea1d6981SmrgThe server may delay execution of the <function>DisplayImageBuffers</function>
609ea1d6981Smrgrequest until the appropriate time (e.g. by requeuing the
610ea1d6981Smrgrequest after computing the timeout);
611ea1d6981Smrghowever, the entire request must be processed in one operation.
612ea1d6981SmrgRequest execution indivisibility must be maintained.  When
613ea1d6981Smrga server is implemented with internal concurrency, the
614ea1d6981Smrgextension must adhere to the same concurrency semantics
615ea1d6981Smrgas those defined for the core protocol.
616ea1d6981Smrg</para>
617ea1d6981Smrg
618ea1d6981Smrg<para>
619ea1d6981SmrgTo explicitly clear a rectangular area of an image buffer to
620ea1d6981Smrgthe window background, the following request can be used:
621ea1d6981Smrg</para>
622ea1d6981Smrg
623ea1d6981Smrg<literallayout class="monospaced">
624ea1d6981SmrgClearImageBufferArea
625ea1d6981Smrg     buffer          : BUFFER
626ea1d6981Smrg     x, y            : INT16
627ea1d6981Smrg     w, h            : CARD16
628ea1d6981Smrg     exposures       : BOOL
629ea1d6981Smrg
630ea1d6981Smrg     (Errors: Buffer, Value)
631ea1d6981Smrg</literallayout>
632ea1d6981Smrg
633ea1d6981Smrg<para>
634ea1d6981SmrgLike the X <function>ClearArea</function> request,
635ea1d6981Smrg<emphasis remap='I'>x</emphasis> and <emphasis remap='I'>y</emphasis>
636ea1d6981Smrgare relative to
637ea1d6981Smrgthe window's origin and specify the upper-left corner of the rectangle.
638ea1d6981SmrgIf <emphasis remap='I'>width</emphasis> is zero, it is replaced with the
639ea1d6981Smrgcurrent window width
640ea1d6981Smrgminus <emphasis remap='I'>x</emphasis>.  If
641ea1d6981Smrg<emphasis remap='I'>height</emphasis> is zero it is replaced with the current
642ea1d6981Smrgwindow height minus <emphasis remap='I'>y</emphasis>.  If the window has a
643ea1d6981Smrgdefined background tile, the rectangle is tiled with a plane mask of all ones,
644ea1d6981Smrga function of <emphasis remap='I'>Copy</emphasis>, and a subwindow-mode of
645ea1d6981Smrg<emphasis remap='I'>ClipByChildren</emphasis>.
646ea1d6981SmrgIf the window has background <emphasis remap='I'>None</emphasis>, the
647ea1d6981Smrgcontents of the buffer
648ea1d6981Smrgare not changed.  In either case, if
649ea1d6981Smrg<emphasis remap='I'>exposures</emphasis> is true, then one or
650ea1d6981Smrgmore exposure events are generated for regions of the rectangle that are
651ea1d6981Smrgeither visible or are being retained in backing store.
652ea1d6981Smrg</para>
653ea1d6981Smrg
654ea1d6981Smrg<para>
655ea1d6981Smrg<!-- .LP -->
656ea1d6981SmrgThe group of image buffers allocated by a
657ea1d6981Smrg<function>CreateImageBuffers</function>
658ea1d6981Smrgrequest can be destroyed with the following request:
659ea1d6981Smrg</para>
660ea1d6981Smrg
661ea1d6981Smrg<literallayout class="monospaced">
662ea1d6981SmrgDestroyImageBuffers
663ea1d6981Smrg     w_id          : WINDOW
664ea1d6981Smrg
665ea1d6981Smrg     (Error: Window)
666ea1d6981Smrg</literallayout>
667ea1d6981Smrg
668ea1d6981Smrg<para>
669ea1d6981SmrgThe association between the buffer ID's and their corresponding
670ea1d6981Smrgimage buffers are deleted.  Any image buffers not selected for
671ea1d6981Smrgdisplay are de-allocated.  If the window is not multi-buffered,
672ea1d6981Smrgthe request is ignored.
673ea1d6981Smrg</para>
674ea1d6981Smrg
675ea1d6981Smrg</chapter>
676ea1d6981Smrg
677ea1d6981Smrg<chapter id='Attributes'>
678ea1d6981Smrg<title>Attributes</title>
679ea1d6981Smrg
680ea1d6981Smrg<para>
681ea1d6981SmrgThe following attributes will be associated with each window that
682ea1d6981Smrgis multi-buffered:
683ea1d6981Smrg</para>
684ea1d6981Smrg
685ea1d6981Smrg<literallayout class="monospaced">
686ea1d6981Smrg     displayed_buffer : CARD16
687ea1d6981Smrg     update_action    : {Undefined,Background,Untouched,Copied}
688ea1d6981Smrg     update_hint      : {Frequent,Intermittent,Static}
689ea1d6981Smrg     window_mode      : {Mono,Stereo}
690ea1d6981Smrg     buffers          : LISTofBUFFER
691ea1d6981Smrg</literallayout>
692ea1d6981Smrg
693ea1d6981Smrg<para>
694ea1d6981Smrg<emphasis remap='I'>displayed_buffer</emphasis> is set to the
695ea1d6981Smrg<emphasis remap='I'>index</emphasis> of the currently
696ea1d6981Smrgdisplayed image buffer (for stereo windows, this will be
697ea1d6981Smrgthe index of the left buffer \- the index of the right buffer
698ea1d6981Smrgis simply <emphasis remap='I'>index</emphasis>+1).
699ea1d6981Smrg<emphasis remap='I'>window_mode</emphasis> indicates whether this window is
700ea1d6981Smrg<emphasis remap='I'>Mono</emphasis> or <emphasis remap='I'>Stereo</emphasis>.
701ea1d6981SmrgThe ID for each buffer associated with the window is recorded
702ea1d6981Smrgin the <emphasis remap='I'>buffers</emphasis> list.
703ea1d6981SmrgThe above attributes can be queried with the following request:
704ea1d6981Smrg</para>
705ea1d6981Smrg
706ea1d6981Smrg<literallayout class="monospaced">
707ea1d6981SmrgGetMultiBufferAttributes
708ea1d6981Smrg     w_id             : WINDOW
709ea1d6981Smrg     =&gt;
710ea1d6981Smrg     displayed_buffer : CARD16
711ea1d6981Smrg     update_action    : {Undefined,Background,Untouched,Copied}
712ea1d6981Smrg     update_hint      : {Frequent,Intermittent,Static}
713ea1d6981Smrg     window_mode      : {Mono,Stereo}
714ea1d6981Smrg     buffers          : LISTofBUFFER
715ea1d6981Smrg
716ea1d6981Smrg     (Errors: Window, Access, Value)
717ea1d6981Smrg</literallayout>
718ea1d6981Smrg
719ea1d6981Smrg<para>
720ea1d6981SmrgIf the window is not multi-buffered, a <function>Access</function> error
721ea1d6981Smrgwill be generated.
722ea1d6981SmrgThe only multi-buffer attribute that can be explicitly set
723ea1d6981Smrgis <emphasis remap='I'>update_hint</emphasis>.  Rather than have a specific
724ea1d6981Smrgrequest to set this attribute, a generic set request is provided to
725ea1d6981Smrgallow for future expansion:
726ea1d6981Smrg</para>
727ea1d6981Smrg
728ea1d6981Smrg<literallayout class="monospaced">
729ea1d6981SmrgSetMultiBufferAttributes
730ea1d6981Smrg     w_id            : WINDOW
731ea1d6981Smrg     value_mask      : BITMASK
732ea1d6981Smrg     value_list      : LISTofVALUE
733ea1d6981Smrg
734ea1d6981Smrg     (Errors: Window, Match, Value)
735ea1d6981Smrg</literallayout>
736ea1d6981Smrg
737ea1d6981Smrg<para>
738ea1d6981SmrgIf the window is not multi-buffered, a <function>Match</function> error
739ea1d6981Smrgwill be generated.
740ea1d6981SmrgThe following attributes are maintained for each buffer of a
741ea1d6981Smrgmulti-buffered window:
742ea1d6981Smrg</para>
743ea1d6981Smrg
744ea1d6981Smrg<literallayout class="monospaced">
745ea1d6981Smrg     window           : WINDOW
746ea1d6981Smrg     event_mask       : SETofEVENT
747ea1d6981Smrg     index            : CARD16
748ea1d6981Smrg     side             : {Mono,Left,Right}
749ea1d6981Smrg</literallayout>
750ea1d6981Smrg
751ea1d6981Smrg<para>
752ea1d6981Smrg<emphasis remap='I'>window</emphasis> indicates the window this buffer is
753ea1d6981Smrgassociated with.
754ea1d6981Smrg<emphasis remap='I'>event_mask</emphasis> specifies which events, relevant to
755ea1d6981Smrgbuffers, will be sent back to the client via the associated buffer ID
756ea1d6981Smrg(initially no events are selected).
757ea1d6981Smrg<emphasis remap='I'>index</emphasis> is the list position (0, 1, ...) of the
758ea1d6981Smrgbuffer.
759ea1d6981Smrg<emphasis remap='I'>side</emphasis> indicates whether this buffer is
760ea1d6981Smrgassociated with
761ea1d6981Smrgthe left side or right side of a stereo window.
762ea1d6981SmrgFor non-stereo windows, this attribute will be set to
763ea1d6981Smrg<emphasis remap='I'>Mono</emphasis>.
764ea1d6981SmrgThese attributes can be queried with the following request:
765ea1d6981Smrg</para>
766ea1d6981Smrg
767ea1d6981Smrg<literallayout class="monospaced">
768ea1d6981SmrgGetBufferAttributes
769ea1d6981Smrg     buffer          : BUFFER
770ea1d6981Smrg     =&gt;
771ea1d6981Smrg     window           : WINDOW
772ea1d6981Smrg     event_mask       : SETofEVENT
773ea1d6981Smrg     index            : CARD16
774ea1d6981Smrg     side             : {Mono,Left,Right}
775ea1d6981Smrg
776ea1d6981Smrg     (Errors: Buffer, Value)
777ea1d6981Smrg</literallayout>
778ea1d6981Smrg
779ea1d6981Smrg<para>
780ea1d6981SmrgThe only buffer attribute that can be explicitly set
781ea1d6981Smrgis <emphasis remap='I'>event_mask</emphasis>.
782ea1d6981SmrgThe only events that are valid are
783ea1d6981Smrg<function>Expose</function> and the new
784ea1d6981Smrg<function>ClobberNotify</function> and <function>UpdateNotify</function>
785ea1d6981Smrgevent (see Events section below). <!-- xref -->
786ea1d6981SmrgA <function>Value</function> error will be generated if an event not
787ea1d6981Smrgselectable for a buffer is specified in an event mask.
788ea1d6981SmrgRather than have a specific request
789ea1d6981Smrgto set this attribute, a generic set request is provided to
790ea1d6981Smrgallow for future expansion:
791ea1d6981Smrg</para>
792ea1d6981Smrg
793ea1d6981Smrg<literallayout class="monospaced">
794ea1d6981SmrgSetBufferAttributes
795ea1d6981Smrg     buffer          : BUFFER
796ea1d6981Smrg     value_mask      : BITMASK
797ea1d6981Smrg     value_list      : LISTofVALUE
798ea1d6981Smrg
799ea1d6981Smrg     (Errors: Buffer, Value)
800ea1d6981Smrg</literallayout>
801ea1d6981Smrg
802ea1d6981Smrg<para>
803ea1d6981SmrgClients may want to query the server about basic multi-buffer
804ea1d6981Smrgand stereo capability on a per screen basis.  The following request
805ea1d6981Smrgreturns a large list of information
806ea1d6981Smrgthat would most likely be read once by Xlib for each screen, and used as a
807ea1d6981Smrgdata base for other Xlib queries:
808ea1d6981Smrg</para>
809ea1d6981Smrg
810ea1d6981Smrg<literallayout class="monospaced">
811ea1d6981SmrgGetBufferInfo
812ea1d6981Smrg     root            : WINDOW
813ea1d6981Smrg     =&gt;
814ea1d6981Smrg     info            : LISTofSCREEN_INFO
815ea1d6981Smrg</literallayout>
816ea1d6981Smrg
817ea1d6981Smrg<para>
818ea1d6981SmrgWhere <function>SCREEN_INFO</function> and
819ea1d6981Smrg<function>BUFFER_INFO</function> are defined as:
820ea1d6981Smrg</para>
821ea1d6981Smrg
822ea1d6981Smrg<literallayout class="monospaced">
823ea1d6981Smrg     SCREEN_INFO     : [ normal_info : LISTofBUFFER_INFO,
824ea1d6981Smrg                         stereo_info : LISTofBUFFER_INFO ]
825ea1d6981Smrg
826ea1d6981Smrg     BUFFER_INFO     : [ visual      : VISUALID,
827ea1d6981Smrg                         max_buffers : CARD16,
828ea1d6981Smrg                         depth       : CARD8 ]
829ea1d6981Smrg</literallayout>
830ea1d6981Smrg
831ea1d6981Smrg<para>
832ea1d6981SmrgInformation regarding multi-buffering of normal (mono) windows
833ea1d6981Smrgis returned in the <emphasis remap='I'>normal_info</emphasis> list.
834ea1d6981SmrgThe <emphasis remap='I'>stereo_info</emphasis>
835ea1d6981Smrglist contains information about stereo windows.
836ea1d6981SmrgIf the <emphasis remap='I'>stereo_info</emphasis> list is empty, stereo
837ea1d6981Smrgwindows are
838ea1d6981Smrgnot supported on the screen.  If
839ea1d6981Smrg<emphasis remap='I'>max_buffers</emphasis> is zero,
840ea1d6981Smrgthe maximum number of buffers for the depth and visual is
841ea1d6981Smrga function of the size of the created window and current
842ea1d6981Smrgmemory limitations.
843ea1d6981Smrg</para>
844ea1d6981Smrg
845ea1d6981Smrg<para>
846ea1d6981SmrgThe following request returns the major and minor version numbers
847ea1d6981Smrgof this extension:
848ea1d6981Smrg</para>
849ea1d6981Smrg
850ea1d6981Smrg<literallayout class="monospaced">
851ea1d6981SmrgGetBufferVersion
852ea1d6981Smrg     =&gt;
853ea1d6981Smrg     major_number    : CARD8
854ea1d6981Smrg     minor_number    : CARD8
855ea1d6981Smrg</literallayout>
856ea1d6981Smrg
857ea1d6981Smrg<para>
858ea1d6981SmrgThe version numbers are an escape hatch in case future revisions of
859ea1d6981Smrgthe protocol are necessary.  In general, the major version would
860ea1d6981Smrgincrement for incompatible changes, and the minor version would
861ea1d6981Smrgincrement for small upward compatible changes.  Barring changes, the
862ea1d6981Smrgmajor version will be 1, and the minor version will be 1.
863ea1d6981Smrg</para>
864ea1d6981Smrg</chapter>
865ea1d6981Smrg
866ea1d6981Smrg<chapter id='Events'>
867ea1d6981Smrg<title>Events</title>
868ea1d6981Smrg
869ea1d6981Smrg<para>
870ea1d6981SmrgAll events normally generated for single-buffered
871ea1d6981Smrgwindows are also generated for multi-buffered windows.
872ea1d6981SmrgMost of these events (ie: <function>ConfigureNotify</function>) will
873ea1d6981Smrgonly be generated for the window and not for each buffer.
874ea1d6981SmrgThese events will return a window ID.
875ea1d6981Smrg</para>
876ea1d6981Smrg
877ea1d6981Smrg<para>
878ea1d6981Smrg<function>Expose</function> events will be generated for both the window
879ea1d6981Smrgand any buffer affected.  When this event is generated for
880ea1d6981Smrga buffer, the same event structure will be used
881ea1d6981Smrgbut a buffer ID is returned instead of a window ID.
882ea1d6981SmrgClients, when processing these events, will know whether an
883ea1d6981SmrgID returned in an event structure is for a window or a buffer
884ea1d6981Smrgby comparing the returned ID to the ones returned when the
885ea1d6981Smrgwindow and buffer were created.
886ea1d6981Smrg</para>
887ea1d6981Smrg
888ea1d6981Smrg<para>
889ea1d6981Smrg<function>GraphicsExposure</function> and
890ea1d6981Smrg<function>NoExposure</function> are generated
891ea1d6981Smrgusing whatever ID is specified in the graphics operation.
892ea1d6981SmrgIf a window ID is specified, the event will contain the
893ea1d6981Smrgwindow ID.  If a buffer ID is specified, the event will
894ea1d6981Smrgcontain the buffer ID.
895ea1d6981Smrg</para>
896ea1d6981Smrg<para>
897ea1d6981SmrgIn some implementations, moving a window
898ea1d6981Smrgover a multi-buffered window may cause one or more of its buffers
899ea1d6981Smrgto get overwritten or become unwritable.  To allow a
900ea1d6981Smrgclient drawing into one of these buffers the opportunity
901ea1d6981Smrgto stop drawing until some portion of the buffer is
902ea1d6981Smrgwritable, the following event is added:
903ea1d6981Smrg</para>
904ea1d6981Smrg
905ea1d6981Smrg<literallayout class="monospaced">
906ea1d6981SmrgClobberNotify
907ea1d6981Smrg     buffer         :  BUFFER
908ea1d6981Smrg     state          : {Unclobbered,PartiallyClobbered,FullyClobbered}
909ea1d6981Smrg</literallayout>
910ea1d6981Smrg
911ea1d6981Smrg<para>
912ea1d6981SmrgThe <function>ClobberNotify</function> event is reported to clients selecting
913ea1d6981Smrg<emphasis remap='I'>ClobberNotify</emphasis> on a buffer.  When a buffer
914ea1d6981Smrgthat was fully
915ea1d6981Smrgor partially clobbered becomes unclobbered, an event with
916ea1d6981Smrg<emphasis remap='I'>Unclobbered</emphasis>
917ea1d6981Smrgis generated.  When a buffer that was unclobbered becomes
918ea1d6981Smrgpartially clobbered, an event with
919ea1d6981Smrg<emphasis remap='I'>PartiallyClobbered</emphasis>
920ea1d6981Smrgis generated.  When a buffer that was unclobbered or
921ea1d6981Smrgpartially clobbered becomes fully clobbered, an event with
922ea1d6981Smrg<emphasis remap='I'>FullyClobbered</emphasis> is generated.
923ea1d6981Smrg</para>
924ea1d6981Smrg
925ea1d6981Smrg<para>
926ea1d6981Smrg<function>ClobberNotify</function> events on a given buffer are
927ea1d6981Smrggenerated before any <function>Expose</function> events on that buffer,
928ea1d6981Smrgbut it is not required that all <function>ClobberNotify</function>
929ea1d6981Smrgevents on all buffers be generated before all
930ea1d6981Smrg<function>Expose</function> events on all buffers.
931ea1d6981Smrg</para>
932ea1d6981Smrg
933ea1d6981Smrg<para>
934ea1d6981SmrgThe ordering of <function>ClobberNotify</function> events with respect
935ea1d6981Smrgto <function>VisibilityNotify</function> events is not constrained.
936ea1d6981Smrg</para>
937ea1d6981Smrg
938ea1d6981Smrg<para>
939ea1d6981SmrgIf multiple buffers were used as an image FIFO between an image
940ea1d6981Smrgserver and the X display server, then the FIFO manager would like
941ea1d6981Smrgto know when a buffer that was previously displayed, has been
942ea1d6981Smrgundisplayed and updated, as the side effect of a
943ea1d6981Smrg<function>DisplayImageBuffers</function>
944ea1d6981Smrgrequest.  This allows the FIFO manager to load up a future frame as
945ea1d6981Smrgsoon as a buffer becomes available.  To support this,
946ea1d6981Smrgthe following event is added:
947ea1d6981Smrg</para>
948ea1d6981Smrg
949ea1d6981Smrg<literallayout class="monospaced">
950ea1d6981SmrgUpdateNotify
951ea1d6981Smrg     buffer         :  BUFFER
952ea1d6981Smrg</literallayout>
953ea1d6981Smrg
954ea1d6981Smrg<para>
955ea1d6981SmrgThe <function>UpdateNotify</function> event is reported to clients selecting
956ea1d6981Smrg<emphasis remap='I'>UpdateNotify</emphasis> on a buffer.  Whenever a buffer
957ea1d6981Smrgbecomes <emphasis remap='I'>updated</emphasis>
958ea1d6981Smrg(e.g. its update action is performed as part of a
959ea1d6981Smrg<function>DisplayImageBuffers</function>
960ea1d6981Smrgrequest), an <function>UpdateNotify</function> event is generated.
961ea1d6981Smrg</para>
962ea1d6981Smrg</chapter>
963ea1d6981Smrg
964ea1d6981Smrg<chapter id='Errors'>
965ea1d6981Smrg<title>Errors</title>
966ea1d6981Smrg
967ea1d6981Smrg<para>
968ea1d6981SmrgThe following error type has been added to support
969ea1d6981Smrgthis extension:
970ea1d6981Smrg</para>
971ea1d6981Smrg
972ea1d6981Smrg<sect1 id='Buffer_2'>
973ea1d6981Smrg<title>Buffer</title>
974ea1d6981Smrg<para>
975ea1d6981SmrgA value for a BUFFER argument does not name a defined BUFFER.
976ea1d6981Smrg</para>
977ea1d6981Smrg</sect1>
978ea1d6981Smrg
979ea1d6981Smrg<sect1 id='Double_Buffering_Normal_Windows'>
980ea1d6981Smrg<title>Double-Buffering Normal Windows</title>
981ea1d6981Smrg
982ea1d6981Smrg<para>
983ea1d6981SmrgThe following pseudo-code fragment illustrates how to create and display
984ea1d6981Smrga double-buffered image:
985ea1d6981Smrg</para>
986ea1d6981Smrg
987ea1d6981Smrg<literallayout class="monospaced">
988ea1d6981Smrg/*
989ea1d6981Smrg * Create a normal window
990ea1d6981Smrg */
991ea1d6981SmrgCreateWindow( W, ... )
992ea1d6981Smrg
993ea1d6981Smrg/*
994ea1d6981Smrg * Create two image buffers.  Assume after display, buffer
995ea1d6981Smrg * contents become "undefined".  Assume we will "frequently"
996ea1d6981Smrg * update the display.  Abort if we don't get two buffers,
997ea1d6981Smrg */
998ea1d6981Smrgn = CreateImageBuffers( W, [B0,B1], Undefined, Frequent )
999ea1d6981Smrgif (n != 2) &lt;abort&gt;
1000ea1d6981Smrg
1001ea1d6981Smrg/*
1002ea1d6981Smrg * Map window to the screen
1003ea1d6981Smrg */
1004ea1d6981SmrgMapWindow( W )
1005ea1d6981Smrg
1006ea1d6981Smrg/*
1007ea1d6981Smrg * Draw images using alternate buffers, display every
1008ea1d6981Smrg * 1/10 of a second.  Note we draw B1 first so it will
1009ea1d6981Smrg * "pop" on the screen
1010ea1d6981Smrg */
1011ea1d6981Smrgwhile animating
1012ea1d6981Smrg{
1013ea1d6981Smrg     &lt;draw picture using B1&gt;
1014ea1d6981Smrg     DisplayImageBuffers( [B1], 100, 0 )
1015ea1d6981Smrg
1016ea1d6981Smrg     &lt;draw picture using B0&gt;
1017ea1d6981Smrg     DisplayImageBuffers( [B0], 100, 0 )
1018ea1d6981Smrg}
1019ea1d6981Smrg
1020ea1d6981Smrg/*
1021ea1d6981Smrg * Strip image buffers and leave window with
1022ea1d6981Smrg * contents of last displayed image buffer.
1023ea1d6981Smrg */
1024ea1d6981SmrgDestroyImageBuffers( W )
1025ea1d6981Smrg</literallayout>
1026ea1d6981Smrg
1027ea1d6981Smrg</sect1>
1028ea1d6981Smrg
1029ea1d6981Smrg<sect1 id='Multi_Buffering_Normal_Windows'>
1030ea1d6981Smrg<title>Multi-Buffering Normal Windows</title>
1031ea1d6981Smrg
1032ea1d6981Smrg<para>
1033ea1d6981SmrgMulti-buffered images are also supported by these requests.
1034ea1d6981SmrgThe following pseudo-code fragment illustrates how to create a
1035ea1d6981Smrga multi-buffered image and cycle through the images to
1036ea1d6981Smrgsimulate a movie loop:
1037ea1d6981Smrg</para>
1038ea1d6981Smrg
1039ea1d6981Smrg<literallayout class="monospaced">
1040ea1d6981Smrg/*
1041ea1d6981Smrg * Create a normal window
1042ea1d6981Smrg */
1043ea1d6981SmrgCreateWindow( W, ... )
1044ea1d6981Smrg
1045ea1d6981Smrg/*
1046ea1d6981Smrg * Create 'N' image buffers.  Assume after display, buffer
1047ea1d6981Smrg * contents are "untouched".  Assume we will "frequently"
1048ea1d6981Smrg * update the display.  Abort if we don't get all the buffers.
1049ea1d6981Smrg */
1050ea1d6981Smrgn = CreateImageBuffers( W, [B0,B1,...,B(N-1)], Untouched, Frequent )
1051ea1d6981Smrgif (n != N) &lt;abort&gt;
1052ea1d6981Smrg
1053ea1d6981Smrg/*
1054ea1d6981Smrg * Map window to screen
1055ea1d6981Smrg */
1056ea1d6981SmrgMapWindow( W )
1057ea1d6981Smrg
1058ea1d6981Smrg/*
1059ea1d6981Smrg * Draw each frame of movie one per buffer
1060ea1d6981Smrg */
1061ea1d6981Smrgforeach frame
1062ea1d6981Smrg     &lt;draw frame using B(i)&gt;
1063ea1d6981Smrg
1064ea1d6981Smrg/*
1065ea1d6981Smrg * Cycle through frames, one frame every 1/10 of a second.
1066ea1d6981Smrg */
1067ea1d6981Smrgwhile animating
1068ea1d6981Smrg{
1069ea1d6981Smrg     foreach frame
1070ea1d6981Smrg          DisplayImageBuffers( [B(i)], 100, 0 )
1071ea1d6981Smrg}
1072ea1d6981Smrg</literallayout>
1073ea1d6981Smrg
1074ea1d6981Smrg</sect1>
1075ea1d6981Smrg
1076ea1d6981Smrg<sect1 id='Stereo_Windows'>
1077ea1d6981Smrg<title>Stereo Windows</title>
1078ea1d6981Smrg<para>
1079ea1d6981Smrg<emphasis remap='I'>How</emphasis> stereo windows are supported on a server
1080ea1d6981Smrgis implementation
1081ea1d6981Smrgdependent.  A server may contain specialized hardware that allows
1082ea1d6981Smrgleft and right images to be toggled at field or frame rates.  The
1083ea1d6981Smrgstereo affect may only be perceived with the aid of special
1084ea1d6981Smrgviewing glasses.  The <emphasis remap='I'>display</emphasis> of a
1085ea1d6981Smrgstereo picture should
1086ea1d6981Smrgbe independent of how often the contents of the picture are
1087ea1d6981Smrg<emphasis remap='I'>updated</emphasis> by an application.  Double and
1088ea1d6981Smrgmulti-buffering
1089ea1d6981Smrgof images should be possible regardless of whether the image
1090ea1d6981Smrgis displayed normally or in stereo.
1091ea1d6981Smrg</para>
1092ea1d6981Smrg
1093ea1d6981Smrg<para>
1094ea1d6981SmrgTo achieve this goal, a simple extension to normal windows
1095ea1d6981Smrgis suggested.  Stereo windows are just like normal windows
1096ea1d6981Smrgexcept the displayed image is made up of a left image
1097ea1d6981Smrgbuffer and a right image buffer.  To create a stereo window,
1098ea1d6981Smrga client makes the following request:
1099ea1d6981Smrg</para>
1100ea1d6981Smrg
1101ea1d6981Smrg<literallayout class="monospaced">
1102ea1d6981SmrgCreateStereoWindow
1103ea1d6981Smrg     parent          : WINDOW
1104ea1d6981Smrg     w_id            : WINDOW
1105ea1d6981Smrg     left, right     : BUFFER
1106ea1d6981Smrg     depth           : CARD8
1107ea1d6981Smrg     visual          : VISUALID or CopyFromParent
1108ea1d6981Smrg     x, y            : INT16
1109ea1d6981Smrg     width, height   : INT16
1110ea1d6981Smrg     border_width    : INT16
1111ea1d6981Smrg     value_mask      : BITMASK
1112ea1d6981Smrg     value_list      : LISTofVALUE
1113ea1d6981Smrg
1114ea1d6981Smrg     (Errors: Alloc, Color, Cursor, Match,
1115ea1d6981Smrg              Pixmap, Value, Window)
1116ea1d6981Smrg</literallayout>
1117ea1d6981Smrg
1118ea1d6981Smrg<para>
1119ea1d6981SmrgThis request, modeled after the <function>CreateWindow</function> request,
1120ea1d6981Smrgadds just two new parameters: <emphasis remap='I'>left</emphasis> and
1121ea1d6981Smrg<emphasis remap='I'>right</emphasis>.
1122ea1d6981SmrgFor stereo, it is essential that one can distinguish whether
1123ea1d6981Smrga draw operation is to occur on the left image or right image.
1124ea1d6981SmrgWhile an internal mode could have been added to achieve this,
1125ea1d6981Smrgusing two buffer ID's allows clients to simultaneously build up
1126ea1d6981Smrgthe left and right components of a stereo image.  These
1127ea1d6981SmrgID's always refer to (are an alias for) the left and right
1128ea1d6981Smrgimage buffers that are currently <emphasis remap='I'>displayed</emphasis>.
1129ea1d6981Smrg</para>
1130ea1d6981Smrg
1131ea1d6981Smrg<para>
1132ea1d6981SmrgLike normal windows, the window ID is used whenever a window
1133ea1d6981Smrgmanagement operation is to be performed.  Window queries would
1134ea1d6981Smrgalso return this window ID (eg: <function>QueryTree</function>) as would most
1135ea1d6981Smrgevents.  Like the window ID, the left and right buffer ID's
1136ea1d6981Smrgeach have their own event mask.  They can be set and queried
1137ea1d6981Smrgusing the <function>Set/GetBufferAttributes</function> requests.
1138ea1d6981Smrg</para>
1139ea1d6981Smrg
1140ea1d6981Smrg<para>
1141ea1d6981SmrgUsing the window ID of a stereo window in a draw request
1142ea1d6981Smrg(eg: <function>GetImage</function>) results in pixels that are
1143ea1d6981Smrg<emphasis remap='I'>undefined</emphasis>.
1144ea1d6981SmrgPossible semantics are that both left and right images get
1145ea1d6981Smrgdrawn, or just a single side is operated on (existing applications
1146ea1d6981Smrgwill have to be re-written to explicitly use the left and right
1147ea1d6981Smrgbuffer ID's in order to successfully create, fetch, and store
1148ea1d6981Smrgstereo images).
1149ea1d6981Smrg</para>
1150ea1d6981Smrg
1151ea1d6981Smrg<para>
1152ea1d6981SmrgHaving an explicit <function>CreateStereoWindow</function> request is helpful
1153ea1d6981Smrgin that a server implementation will know from the onset whether
1154ea1d6981Smrga stereo window is desired and can return appropriate status
1155ea1d6981Smrgto the client if it cannot support this functionality.
1156ea1d6981Smrg</para>
1157ea1d6981Smrg
1158ea1d6981Smrg<para>
1159ea1d6981SmrgSome hardware may support separate stereo and non-stereo modes,
1160ea1d6981Smrgperhaps with different vertical resolutions.  For example, the
1161ea1d6981Smrgvertical resolution in stereo mode may be half that of non-stereo
1162ea1d6981Smrgmode.  Selecting one mode or the other must be done through some
1163ea1d6981Smrgmeans outside of this extension (eg: by providing a separate
1164ea1d6981Smrgscreen for each hardware display mode).  The screen attributes
1165ea1d6981Smrg(ie: x/y resolution) for a screen that supports normal windows,
1166ea1d6981Smrgmay differ from a screen that supports stereo windows;
1167ea1d6981Smrghowever, all windows, regardless of type, displayed on the
1168ea1d6981Smrgsame screen must have the same screen attributes
1169ea1d6981Smrg(ie: pixel aspect ratio).
1170ea1d6981Smrg</para>
1171ea1d6981Smrg
1172ea1d6981Smrg<para>
1173ea1d6981SmrgIf a screen that supports stereo windows also supports
1174ea1d6981Smrgnormal windows, then the images presented to the left and
1175ea1d6981Smrgright eyes for normal windows should be the same
1176ea1d6981Smrg(ie: have no stereo offset).
1177ea1d6981Smrg</para>
1178ea1d6981Smrg
1179ea1d6981Smrg</sect1>
1180ea1d6981Smrg
1181ea1d6981Smrg<sect1 id='Single_Buffered_Stereo_Windows'>
1182ea1d6981Smrg<title>Single-Buffered Stereo Windows</title>
1183ea1d6981Smrg
1184ea1d6981Smrg<para>
1185ea1d6981SmrgThe following shows how to create and display a single-buffered
1186ea1d6981Smrgstereo image:
1187ea1d6981Smrg</para>
1188ea1d6981Smrg<literallayout class="monospaced">
1189ea1d6981Smrg/*
1190ea1d6981Smrg * Create the stereo window, map it the screen,
1191ea1d6981Smrg * and draw the left and right images
1192ea1d6981Smrg */
1193ea1d6981SmrgCreateStereoWindow( W, L, R, ... )
1194ea1d6981Smrg
1195ea1d6981SmrgMapWindow( W )
1196ea1d6981Smrg
1197ea1d6981Smrg&lt;draw picture using L,R&gt;
1198ea1d6981Smrg</literallayout>
1199ea1d6981Smrg</sect1>
1200ea1d6981Smrg
1201ea1d6981Smrg<sect1 id='Double_Buffering_Stereo_Windows'>
1202ea1d6981Smrg<title>Double-Buffering Stereo Windows</title>
1203ea1d6981Smrg
1204ea1d6981Smrg<para>
1205ea1d6981SmrgAdditional image buffers may be added to a stereo window
1206ea1d6981Smrgto allow double or multi-buffering of stereo images.
1207ea1d6981SmrgSimply use the the <function>CreateImageBuffers</function> request.
1208ea1d6981SmrgEven numbered buffers (0,2,...) will be left buffers.
1209ea1d6981SmrgOdd numbered buffers (1,3,...) will be right buffers.
1210ea1d6981SmrgDisplayable stereo images are formed by consecutive
1211ea1d6981Smrgleft/right pairs of image buffers.  For example,
1212ea1d6981Smrg(buffer[0],buffer[1]) form the first displayable
1213ea1d6981Smrgstereo image; (buffer[2],buffer[3]) the next;
1214ea1d6981Smrgand so on.
1215ea1d6981Smrg</para>
1216ea1d6981Smrg
1217ea1d6981Smrg<para>
1218ea1d6981SmrgThe <function>CreateImageBuffers</function> request will only create
1219ea1d6981Smrgpairs of left and right image buffers for stereo windows.
1220ea1d6981SmrgBy always pairing left and right image
1221ea1d6981Smrgbuffers together, implementations might be able to
1222ea1d6981Smrgperform some type of optimization.  If an odd number
1223ea1d6981Smrgof buffers is specified, a <function>Value</function> error is generated.
1224ea1d6981SmrgAll the rules mentioned at the start of this proposal
1225ea1d6981Smrgstill apply to the image buffers supported by a stereo window.
1226ea1d6981Smrg</para>
1227ea1d6981Smrg
1228ea1d6981Smrg<para>
1229ea1d6981SmrgTo display a image buffer pair of a multi-buffered stereo image,
1230ea1d6981Smrgeither the left buffer ID or right buffer ID may be specified in a
1231ea1d6981Smrg<function>DisplayImageBuffers</function> request, but not both.
1232ea1d6981Smrg</para>
1233ea1d6981Smrg
1234ea1d6981Smrg<para>
1235ea1d6981SmrgTo double-buffer a stereo window:
1236ea1d6981Smrg</para>
1237ea1d6981Smrg
1238ea1d6981Smrg<literallayout class="monospaced">
1239ea1d6981Smrg/*
1240ea1d6981Smrg * Create stereo window and map it to the screen
1241ea1d6981Smrg */
1242ea1d6981SmrgCreateStereoWindow( W, L, R, ... )
1243ea1d6981Smrg
1244ea1d6981Smrg/*
1245ea1d6981Smrg * Create two pairs of image buffers.  Assume after display,
1246ea1d6981Smrg * buffer contents become "undefined".  Assume we will "frequently"
1247ea1d6981Smrg * update the display.  Abort if we did get all the buffers.
1248ea1d6981Smrg */
1249ea1d6981Smrgn = CreateImageBuffers( W, [L0,R0,L1,R1], Undefined, Frequently )
1250ea1d6981Smrgif (n != 4) &lt;abort&gt;
1251ea1d6981Smrg
1252ea1d6981Smrg/*
1253ea1d6981Smrg * Map window to the screen
1254ea1d6981Smrg */
1255ea1d6981SmrgMapWindow( W )
1256ea1d6981Smrg
1257ea1d6981Smrg/*
1258ea1d6981Smrg * Draw images using alternate buffers,
1259ea1d6981Smrg * display every 1/10 of a second.
1260ea1d6981Smrg */
1261ea1d6981Smrgwhile animating
1262ea1d6981Smrg{
1263ea1d6981Smrg     &lt;draw picture using L1,R1&gt;
1264ea1d6981Smrg     DisplayImageBuffers( [L1], 100, 0 )
1265ea1d6981Smrg
1266ea1d6981Smrg     &lt;draw picture using L0,R0&gt;
1267ea1d6981Smrg     DisplayImageBuffers( [L0], 100, 0 )
1268ea1d6981Smrg}
1269ea1d6981Smrg</literallayout>
1270ea1d6981Smrg
1271ea1d6981Smrg</sect1>
1272ea1d6981Smrg
1273ea1d6981Smrg<sect1 id='Multi_Buffering_Stereo_Windows'>
1274ea1d6981Smrg<title>Multi-Buffering Stereo Windows</title>
1275ea1d6981Smrg
1276ea1d6981Smrg<para>
1277ea1d6981SmrgTo cycle through <emphasis remap='I'>N</emphasis> stereo images:
1278ea1d6981Smrg</para>
1279ea1d6981Smrg
1280ea1d6981Smrg<literallayout class="monospaced">
1281ea1d6981Smrg/*
1282ea1d6981Smrg * Create stereo window
1283ea1d6981Smrg */
1284ea1d6981SmrgCreateStereoWindow( W, L, R, ... )
1285ea1d6981Smrg
1286ea1d6981Smrg/*
1287ea1d6981Smrg * Create N pairs of image buffers.  Assume after display,
1288ea1d6981Smrg * buffer contents are "untouched".  Assume we will "frequently"
1289ea1d6981Smrg * update the display.  Abort if we don't get all the buffers.
1290ea1d6981Smrg */
1291ea1d6981Smrgn = CreateImageBuffers( W, [L0,R0,...,L(N-1),R(N-1)], Untouched, Frequently )
1292ea1d6981Smrgif (n != N*2) &lt;abort&gt;
1293ea1d6981Smrg
1294ea1d6981Smrg/*
1295ea1d6981Smrg * Map window to screen
1296ea1d6981Smrg */
1297ea1d6981SmrgMapWindow( W )
1298ea1d6981Smrg
1299ea1d6981Smrg/*
1300ea1d6981Smrg * Draw the left and right halves of each image
1301ea1d6981Smrg */
1302ea1d6981Smrgforeach stereo image
1303ea1d6981Smrg     &lt;draw picture using L(i),R(i)&gt;
1304ea1d6981Smrg
1305ea1d6981Smrg/*
1306ea1d6981Smrg * Cycle through images every 1/10 of a second
1307ea1d6981Smrg */
1308ea1d6981Smrgwhile animating
1309ea1d6981Smrg{
1310ea1d6981Smrg     foreach stereo image
1311ea1d6981Smrg          DisplayImageBuffers( [L(i)], 100, 0 )
1312ea1d6981Smrg}
1313ea1d6981Smrg</literallayout>
1314ea1d6981Smrg</sect1>
1315ea1d6981Smrg
1316ea1d6981Smrg<sect1 id='Protocol_Encoding'>
1317ea1d6981Smrg<title>Protocol Encoding</title>
1318ea1d6981Smrg
1319ea1d6981Smrg<para>
1320ea1d6981SmrgThe official name of this extension is "Multi-Buffering".
1321ea1d6981SmrgWhen this string passed to <function>QueryExtension</function> the
1322ea1d6981Smrginformation returned should be interpreted as follows:
1323ea1d6981Smrg</para>
1324ea1d6981Smrg
1325ea1d6981Smrg<variablelist>
1326ea1d6981Smrg  <varlistentry>
1327ea1d6981Smrg    <term>major-opcode</term>
1328ea1d6981Smrg    <listitem>
1329ea1d6981Smrg      <para>
1330ea1d6981SmrgSpecifies the major opcode of this extension.
1331ea1d6981SmrgThe first byte of each extension request should
1332ea1d6981Smrgspecify this value.
1333ea1d6981Smrg      </para>
1334ea1d6981Smrg    </listitem>
1335ea1d6981Smrg  </varlistentry>
1336ea1d6981Smrg  <varlistentry>
1337ea1d6981Smrg    <term>first-event</term>
1338ea1d6981Smrg    <listitem>
1339ea1d6981Smrg      <para>
1340ea1d6981SmrgSpecifies the code that will be returned when
1341ea1d6981Smrg<function>ClobberNotify</function> events are generated.
1342ea1d6981Smrg      </para>
1343ea1d6981Smrg    </listitem>
1344ea1d6981Smrg  </varlistentry>
1345ea1d6981Smrg  <varlistentry>
1346ea1d6981Smrg    <term>first-error</term>
1347ea1d6981Smrg    <listitem>
1348ea1d6981Smrg      <para>
1349ea1d6981SmrgSpecifies the code that will be returned when
1350ea1d6981Smrg<function>Buffer</function> errors are generated.
1351ea1d6981Smrg      </para>
1352ea1d6981Smrg    </listitem>
1353ea1d6981Smrg  </varlistentry>
1354ea1d6981Smrg</variablelist>
1355ea1d6981Smrg
1356ea1d6981Smrg<para>
1357ea1d6981SmrgThe following sections describe the protocol
1358ea1d6981Smrgencoding for this extension.
1359ea1d6981Smrg</para>
1360ea1d6981Smrg</sect1>
1361ea1d6981Smrg</chapter>
1362ea1d6981Smrg
1363ea1d6981Smrg<chapter id='TYPES'>
1364ea1d6981Smrg<title>TYPES</title>
1365ea1d6981Smrg
1366ea1d6981Smrg<literallayout class="monospaced">
1367ea1d6981SmrgBUFFER_INFO
1368ea1d6981Smrg
1369ea1d6981Smrg4       VISUALID     visual
1370ea1d6981Smrg2       CARD16       max-buffers
1371ea1d6981Smrg1       CARD8        depth
1372ea1d6981Smrg1                    unused
1373ea1d6981Smrg</literallayout>
1374ea1d6981Smrg
1375ea1d6981Smrg<literallayout class="monospaced">
1376ea1d6981SmrgSETofBUFFER_EVENT
1377ea1d6981Smrg
1378ea1d6981Smrg        #x00008000   Exposure
1379ea1d6981Smrg        #x02000000   ClobberNotify
1380ea1d6981Smrg        #x04000000   UpdateNotify
1381ea1d6981Smrg</literallayout>
1382ea1d6981Smrg
1383ea1d6981Smrg</chapter>
1384ea1d6981Smrg
1385ea1d6981Smrg<chapter id='EVENTS_2'>
1386ea1d6981Smrg<title>EVENTS</title>
1387ea1d6981Smrg
1388ea1d6981Smrg<literallayout class="monospaced">
1389ea1d6981Smrg<function>ClobberNotify</function>
1390ea1d6981Smrg1       see <emphasis remap='I'>first-event</emphasis> code
1391ea1d6981Smrg1                                unused
1392ea1d6981Smrg2       CARD16                   sequence number
1393ea1d6981Smrg4       BUFFER                   buffer
1394ea1d6981Smrg1                                state
1395ea1d6981Smrg        0 Unclobbered
1396ea1d6981Smrg        1 PartiallyClobbered
1397ea1d6981Smrg        2 FullyClobbered
1398ea1d6981Smrg23                                unused
1399ea1d6981Smrg</literallayout>
1400ea1d6981Smrg
1401ea1d6981Smrg<literallayout class="monospaced">
1402ea1d6981Smrg<function>UpdateNotify</function>
1403ea1d6981Smrg1 <emphasis remap='I'>first-event</emphasis>+1 code
1404ea1d6981Smrg1                       unused
1405ea1d6981Smrg2      CARD16           sequence number
1406ea1d6981Smrg4      BUFFER           buffer
1407ea1d6981Smrg24                      unused
1408ea1d6981Smrg</literallayout>
1409ea1d6981Smrg
1410ea1d6981Smrg</chapter>
1411ea1d6981Smrg<chapter id='ERRORS_2'>
1412ea1d6981Smrg<title>ERRORS</title>
1413ea1d6981Smrg
1414ea1d6981Smrg<literallayout class="monospaced">
1415ea1d6981Smrg<function>Buffer</function>
1416ea1d6981Smrg1     0                 Error
1417ea1d6981Smrg1     see <emphasis remap='I'>first-error</emphasis> code
1418ea1d6981Smrg2     CARD16                 sequence number
1419ea1d6981Smrg4     CARD32                 bad resource id
1420ea1d6981Smrg2     CARD16                 minor-opcode
1421ea1d6981Smrg1     CARD8                  major-opcode
1422ea1d6981Smrg21                           unused
1423ea1d6981Smrg</literallayout>
1424ea1d6981Smrg
1425ea1d6981Smrg</chapter>
1426ea1d6981Smrg
1427ea1d6981Smrg<chapter id='Requests'>
1428ea1d6981Smrg<title>REQUESTS</title>
1429ea1d6981Smrg
1430ea1d6981Smrg<literallayout class="monospaced">
1431ea1d6981Smrg<function>GetBufferVersion</function>
1432ea1d6981Smrg1       see <emphasis remap='I'>major-opcode</emphasis>         major-opcode
1433ea1d6981Smrg1       0                  minor-opcode
1434ea1d6981Smrg2       1                  request length
1435ea1d6981Smrg-&gt;
1436ea1d6981Smrg1       1                  Reply
1437ea1d6981Smrg1                          unused
1438ea1d6981Smrg2       CARD16             sequencenumber
1439ea1d6981Smrg4       0                  reply length
1440ea1d6981Smrg1       CARD8              majorversion number
1441ea1d6981Smrg1       CARD8              minorversion number
1442ea1d6981Smrg22                         unused
1443ea1d6981Smrg
1444ea1d6981Smrg
1445ea1d6981Smrg<function>CreateImageBuffers</function>
1446ea1d6981Smrg
1447ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1448ea1d6981Smrg1        1                 minor-opcode
1449ea1d6981Smrg2        3+n               requestlength
1450ea1d6981Smrg4        WINDOW            wid
1451ea1d6981Smrg1                          update-action
1452ea1d6981Smrg         0 Undefined
1453ea1d6981Smrg         1 Background
1454ea1d6981Smrg         2 Untouched
1455ea1d6981Smrg         3 Copied
1456ea1d6981Smrg1                          update-hint
1457ea1d6981Smrg         0 Frequent
1458ea1d6981Smrg         1 Intermittent
1459ea1d6981Smrg         2 Static
1460ea1d6981Smrg2                          unused
1461ea1d6981Smrg4n     LISTofBUFFER        buffer-list
1462ea1d6981Smrg-&gt;
1463ea1d6981Smrg1        1                 Reply
1464ea1d6981Smrg1                          unused
1465ea1d6981Smrg2      CARD16              sequencenumber
1466ea1d6981Smrg4      0                   reply length
1467ea1d6981Smrg2      CARD16              number-buffers
1468ea1d6981Smrg22                         unused
1469ea1d6981Smrg
1470ea1d6981Smrg
1471ea1d6981Smrg<function>DestroyImageBuffers</function>
1472ea1d6981Smrg
1473ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1474ea1d6981Smrg1       2                  minor-opcode
1475ea1d6981Smrg2       2                  request length
1476ea1d6981Smrg4       WINDOW             wid
1477ea1d6981Smrg
1478ea1d6981Smrg
1479ea1d6981Smrg<function>DisplayImageBuffers</function>
1480ea1d6981Smrg
1481ea1d6981Smrg
1482ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1483ea1d6981Smrg2        2+n               requestlength
1484ea1d6981Smrg2        CARD16            min-delay
1485ea1d6981Smrg2        CARD16            max-delay
1486ea1d6981Smrg4n       LISTofBUFFER      buffer-list
1487ea1d6981Smrg
1488ea1d6981Smrg
1489ea1d6981Smrg<function>SetMultiBufferAttributes</function>
1490ea1d6981Smrg
1491ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1492ea1d6981Smrg1        4                 minor-opcode
1493ea1d6981Smrg2        3+n               requestlength
1494ea1d6981Smrg4        WINDOW            wid
1495ea1d6981Smrg4        BITMASK           value-mask (has n bits set to 1)
1496ea1d6981Smrg         #x00000001        update-hint
1497ea1d6981Smrg4n        LISTofVALUE      value-list
1498ea1d6981SmrgVALUEs
1499ea1d6981Smrg1                          update-hint
1500ea1d6981Smrg         0 Frequent
1501ea1d6981Smrg         1 Intermittent
1502ea1d6981Smrg         2 Static
1503ea1d6981Smrg
1504ea1d6981Smrg
1505ea1d6981Smrg<function>GetMultiBufferAttributes</function>
1506ea1d6981Smrg
1507ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1508ea1d6981Smrg1        5                 minor-opcode
1509ea1d6981Smrg2        2                 request length
1510ea1d6981Smrg4        WINDOW            wid
1511ea1d6981Smrg®
1512ea1d6981Smrg1        1                 Reply
1513ea1d6981Smrg1                          unused
1514ea1d6981Smrg2        CARD16            sequencenumber
1515ea1d6981Smrg4        n                 reply length
1516ea1d6981Smrg2        CARD16            displayed-buffer
1517ea1d6981Smrg1                          update-action
1518ea1d6981Smrg         0 Undefined
1519ea1d6981Smrg         1 Background
1520ea1d6981Smrg         2 Untouched
1521ea1d6981Smrg         3 Copied
1522ea1d6981Smrg1                          update-hint
1523ea1d6981Smrg         0 Frequent
1524ea1d6981Smrg         1 Intermittent
1525ea1d6981Smrg         2 Static
1526ea1d6981Smrg1                          window-mode
1527ea1d6981Smrg         0 Mono
1528ea1d6981Smrg         1 Stereo
1529ea1d6981Smrg19                         unused
1530ea1d6981Smrg4n       LISTofBUFFER      buffer list
1531ea1d6981Smrg
1532ea1d6981Smrg
1533ea1d6981Smrg<function>SetBufferAttributes</function>
1534ea1d6981Smrg
1535ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1536ea1d6981Smrg1        6                 minor-opcode
1537ea1d6981Smrg2        3+n               requestlength
1538ea1d6981Smrg4        BUFFER            buffer
1539ea1d6981Smrg4        BITMASK           value-mask (has n bits set to 1)
1540ea1d6981Smrg         #x00000001        event-mask
1541ea1d6981Smrg4n       LISTofVALUE       value-list
1542ea1d6981SmrgVALUEs
1543ea1d6981Smrg4        SETofBUFFER_EVENT event-mask
1544ea1d6981Smrg
1545ea1d6981Smrg<function>GetBufferAttributes</function>
1546ea1d6981Smrg
1547ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1548ea1d6981Smrg1        7                 minor-opcode
1549ea1d6981Smrg2        2                 request length
1550ea1d6981Smrg4        BUFFER            buffer
1551ea1d6981Smrg-&gt;
1552ea1d6981Smrg1        1                 Reply
1553ea1d6981Smrg1                          unused
1554ea1d6981Smrg2        CARD16            sequencenumber
1555ea1d6981Smrg4        0                 reply length
1556ea1d6981Smrg4        WINDOW            wid
1557ea1d6981Smrg4        SETofBUFFER_EVENT event-mask
1558ea1d6981Smrg2        CARD16            index
1559ea1d6981Smrg         1 side
1560ea1d6981Smrg         0 Mono
1561ea1d6981Smrg         1 Left
1562ea1d6981Smrg         2 Right
1563ea1d6981Smrg13                         unused
1564ea1d6981Smrg
1565ea1d6981Smrg<function>GetBufferInfo</function>
1566ea1d6981Smrg
1567ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1568ea1d6981Smrg1        8                   minor-opcode
1569ea1d6981Smrg2        2                   request length
1570ea1d6981Smrg4        WINDOW              root
1571ea1d6981Smrg®
1572ea1d6981Smrg1        1                   Reply
1573ea1d6981Smrg1                            unused
1574ea1d6981Smrg2        CARD16              sequencenumber
1575ea1d6981Smrg4        2(n+m)              replylength
1576ea1d6981Smrg2        n                   number BUFFER_INFO in normal-info
1577ea1d6981Smrg2        m                   number BUFFER_INFO in stereo-info
1578ea1d6981Smrg20                           unused
1579ea1d6981Smrg8n       LISTofBUFFER_INFO   normal-info
1580ea1d6981Smrg8m       LISTofBUFFER_INFO   stereo-info
1581ea1d6981Smrg
1582ea1d6981Smrg<function>CreateStereoWindow</function>
1583ea1d6981Smrg
1584ea1d6981Smrg1        see <emphasis remap='I'>major-opcode</emphasis>  major-opcode
1585ea1d6981Smrg1        9 minor-opcode
1586ea1d6981Smrg2        11+n                    requestlength
1587ea1d6981Smrg3                                unused
1588ea1d6981Smrg1        CARD8                   depth
1589ea1d6981Smrg4        WINDOW                  wid
1590ea1d6981Smrg4        WINDOW                  parent
1591ea1d6981Smrg4        BUFFER                  left
1592ea1d6981Smrg4        BUFFER                  right
1593ea1d6981Smrg2        INT16                   x
1594ea1d6981Smrg2        INT16                   y
1595ea1d6981Smrg2        CARD16                  width
1596ea1d6981Smrg2        CARD16                  height
1597ea1d6981Smrg2        CARD16                  border-width
1598ea1d6981Smrg2                                class
1599ea1d6981Smrg         0 CopyFromParent
1600ea1d6981Smrg         1 InputOutput
1601ea1d6981Smrg         2 InputOnly
1602ea1d6981Smrg4        VISUALID                visual
1603ea1d6981Smrg         0 CopyFromParent
1604ea1d6981Smrg4        BITMASK                 value-mask (has n bits set to 1)
1605ea1d6981Smrg         encodings are the same
1606ea1d6981Smrg         as for CreateWindow
1607ea1d6981Smrg4n       LISTofVALUE             value-list
1608ea1d6981Smrg         encodings are the same
1609ea1d6981Smrg         as for CreateWindow
1610ea1d6981Smrg
1611ea1d6981Smrg
1612ea1d6981Smrg<function>ClearImageBufferArea</function>
1613ea1d6981Smrg
1614ea1d6981Smrg1 see major-opcode major-opcode
1615ea1d6981Smrg1        10                      minor-opcode
1616ea1d6981Smrg2        5                       request length
1617ea1d6981Smrg4        WINDOW                  buffer
1618ea1d6981Smrg2        INT16                   x
1619ea1d6981Smrg2        INT16                   y
1620ea1d6981Smrg2        CARD16                  width
1621ea1d6981Smrg2        CARD16                  height
1622ea1d6981Smrg3                                unused
1623ea1d6981Smrg1        BOOL                    exposures
1624ea1d6981Smrg
1625ea1d6981Smrg</literallayout>
1626ea1d6981Smrg
1627ea1d6981Smrg</chapter>
1628ea1d6981Smrg</book>
1629