dbe.xml revision d63b911f
1<?xml version="1.0" encoding="UTF-8" ?>
2<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
3          "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
4[
5<!ENTITY % defs SYSTEM "defs.ent"> %defs;
6]>
7
8
9<!--
10by TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)
11xhtml,docbook,html,refcaption -->
12
13<book id="dbe">
14
15<bookinfo>
16  <title>Double Buffer Extension Protocol</title>
17  <subtitle>X Consortium Standard</subtitle>
18  <authorgroup>
19    <author>
20      <firstname>Ian</firstname><surname>Elliott</surname>
21      <affiliation><orgname>Hewlett-Packard Company</orgname></affiliation>
22    </author>
23    <othercredit>
24      <firstname>David</firstname><othername>P.</othername><surname>Wiggins</surname>
25      <affiliation><orgname>X Consortium</orgname></affiliation>
26    </othercredit>
27  </authorgroup>
28  <copyright><year>1989</year><year>1992</year><year>1993</year><year>1994</year>
29    <holder>X Consortium, Inc.</holder>
30  </copyright>
31  <copyright><year>1989</year><holder>Digital Equipment Corporation</holder></copyright>
32  <copyright><year>1992</year><holder>Intergraph Corporation</holder></copyright>
33  <copyright><year>1993</year><holder>Silicon Graphics, Inc.</holder></copyright>
34  <copyright><year>1994</year><holder>Hewlett-Packard Company</holder></copyright>
35  <releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
36  <releaseinfo>Version 1.0</releaseinfo>
37
38<legalnotice>
39<para>
40Permission to use, copy, modify, and distribute this documentation for any
41purpose and without fee is hereby granted, provided that the above copyright
42notice and this permission notice appear in all copies. Digital Equipment
43Corporation, Intergraph Corporation, Silicon Graphics, Hewlett-Packard, and
44the X Consortium make no representations about the suitability for any purpose
45of the information in this document. This documentation is provided &ldquo;as is&rdquo;
46without express or implied warranty.
47</para>
48</legalnotice>
49</bookinfo>
50
51<chapter id='Introduction'>
52<title>Introduction</title>
53<para>The Double Buffer Extension (DBE) provides a standard way to utilize
54double-buffering within the framework of the X Window System. Double-buffering
55uses two buffers, called front and back, which hold images. The front buffer
56is visible to the user; the back buffer is not. Successive frames of an
57animation are rendered into the back buffer while the previously rendered
58frame is displayed in the front buffer. When a new frame is ready, the back
59and front buffers swap roles, making the new frame visible. Ideally, this
60exchange appears to happen instantaneously to the user and with no visual
61artifacts. Thus, only completely rendered images are presented to the user,
62and they remain visible during the entire time it takes to render a new frame.
63The result is a flicker-free animation.
64</para>
65</chapter>
66
67<chapter id='Goals'>
68<title>Goals</title>
69<para>This extension should enable clients to:
70</para>
71
72<itemizedlist>
73  <listitem>
74    <para>Allocate and deallocate double-buffering for a window.</para>
75  </listitem>
76  <listitem>
77    <para>
78Draw to and read from the front and back buffers associated with a window.
79    </para>
80  </listitem>
81  <listitem>
82    <para>Swap the front and back buffers associated with a window.</para>
83  </listitem>
84  <listitem>
85    <para>
86Specify a wide range of actions to be taken when a window is swapped.
87This includes explicit, simple swap actions (defined below), and more
88complex actions (for example, clearing ancillary buffers) that can be put
89together within explicit "begin" and "end" requests (defined below).
90    </para>
91  </listitem>
92  <listitem>
93    <para>
94Request that the front and back buffers associated with multiple
95double-buffered windows be swapped simultaneously.
96    </para>
97  </listitem>
98</itemizedlist>
99
100<para>
101In addition, the extension should:
102</para>
103
104<itemizedlist>
105  <listitem>
106    <para>
107Allow multiple clients to use double-buffering on the same window.</para>
108  </listitem>
109  <listitem>
110    <para>
111Support a range of implementation methods that can capitalize on existing
112hardware features.
113    </para>
114  </listitem>
115  <listitem>
116    <para>Add no new event types.</para>
117  </listitem>
118  <listitem>
119    <para>
120Be reasonably easy to integrate with a variety of direct graphics hardware
121access (DGHA) architectures.
122    </para>
123  </listitem>
124</itemizedlist>
125
126</chapter>
127
128<chapter id='Concepts'>
129<title>Concepts</title>
130
131<para>
132Normal windows are created using the core <function>CreateWindow</function>
133request, which allocates a set of window attributes and, for InputOutput
134windows, a front buffer, into which an image can be drawn. The contents of
135this buffer will be displayed when the window is visible.
136</para>
137<para>
138This extension enables applications to use double-buffering with a window.
139This involves creating a second buffer, called a back buffer, and associating
140one or more back buffer names (XIDs) with the window for use when referring to
141(that is, drawing to or reading from) the window's back buffer. The back
142buffer name is a DRAWABLE of type BACKBUFFER.
143</para>
144
145<para>
146DBE provides a relative double-buffering model. One XID, the window, always
147refers to the front buffer. One or more other XIDs, the back buffer names,
148always refer to the back buffer. After a buffer swap, the window continues to
149refer to the (new) front buffer, and the back buffer name continues to refer
150to the (new) back buffer. Thus, applications and toolkits that want to just
151render to the back buffer always use the back buffer name for all drawing
152requests to the window. Portions of an application that want to render to
153the front buffer always use the window XID for all drawing requests to the
154window.
155</para>
156
157<para>
158Multiple clients and toolkits can all use double-buffering on the same
159window. DBE does not provide a request for querying whether a window has
160double-buffering support, and if so, what the back buffer name is. Given
161the asynchronous nature of the X Window System, this would cause race
162conditions. Instead, DBE allows multiple back buffer names to exist for
163the same window; they all refer to the same physical back buffer. The first
164time a back buffer name is allocated for a window, the window becomes
165double-buffered and the back buffer name is associated with the window.
166Subsequently, the window already is a double-buffered window, and nothing
167about the window changes when a new back buffer name is allocated, except
168that the new back buffer name is associated with the window. The window
169remains double-buffered until either the window is destroyed or until all of
170the back buffer names for the window are deallocated.
171</para>
172
173<para>
174In general, both the front and back buffers are treated the same. In
175particular, here are some important characteristics:
176</para>
177
178<itemizedlist>
179  <listitem>
180    <para>
181Only one buffer per window can be visible at a time (the front buffer).
182    </para>
183  </listitem>
184  <listitem>
185    <para>
186Both buffers associated with a window have the same visual type, depth,
187width, height, and shape as the window.
188    </para>
189  </listitem>
190  <listitem>
191    <para>
192Both buffers associated with a window are "visible" (or "obscured") in
193the same way. When an Expose event is generated for a window, both
194buffers should be considered to be damaged in the exposed area. Damage
195that occurs to either buffer will result in an Expose event on the window.
196When a double-buffered window is exposed, both buffers are tiled with the
197window background, exactly as stated by the core protocol. Even though
198the back buffer is not visible, terms such as obscure apply to the back
199buffer as well as to the front buffer.
200    </para>
201  </listitem>
202  <listitem>
203    <para>
204It is acceptable at any time to pass a BACKBUFFER in any
205request, notably any core or extension drawing request, that expects
206a DRAWABLE. This enables an application to draw directly into
207BACKBUFFERs in the same fashion as it would draw into any other
208DRAWABLE.
209    </para>
210  </listitem>
211  <listitem>
212    <para>
213It is an error (Window) to pass a BACKBUFFER in a core request that
214expects a Window.
215    </para>
216  </listitem>
217  <listitem>
218    <para>
219A BACKBUFFER will never be sent by core X in a reply, event, or error
220where a Window is specified.
221    </para>
222  </listitem>
223  <listitem>
224    <para>
225If core X11 backing-store and save-under applies to a double-buffered
226window, it applies to both buffers equally.
227    </para>
228  </listitem>
229  <listitem>
230    <para>
231If the core <function>ClearArea</function> request is executed on a
232double-buffered window, the same area in both the front and back buffers
233is cleared.
234    </para>
235  </listitem>
236</itemizedlist>
237<para>
238The effect of passing a window to a request that accepts a DRAWABLE is
239unchanged by this extension. The window and front buffer are synonymous with
240each other. This includes obeying the <function>GetImage</function> semantics
241and the subwindow-mode semantics if a core graphics context is involved.
242Regardless of whether the window was explicitly passed in a
243<function>GetImage</function> request, or implicitly referenced (that is,
244one of the windo's ancestors was passed in the request), the front (that is,
245visible) buffer is always referenced. Thus, DBE-naive screen dump clients will
246always get the front buffer. <function>GetImage</function> on a back buffer
247returns undefined image contents for any obscured regions of the back buffer
248that fall within the image.
249</para>
250
251<para>
252Drawing to a back buffer always uses the clip region that would be used to
253draw to the front buffer with a GC subwindow-mode of
254<function>ClipByChildren</function>. If an
255ancestor of a double-buffered window is drawn to with a core GC having a
256subwindow-mode of <function>IncludeInferiors</function>, the effect on the
257double-buffered window's back buffer depends on the depth of the
258double-buffered window and the ancestor. If the depths are the same, the
259contents of the back buffer of the double-buffered window are not changed.
260If the depths are different, the contents of the back buffer of the
261double-buffered window are undefined for the pixels that the
262<function>IncludeInferiors</function> drawing touched.
263</para>
264
265<para>
266DBE adds no new events. DBE does not extend the semantics of any existing
267events with the exception of adding a new DRAWABLE type called BACKBUFFER. If
268events, replies, or errors that contain a DRAWABLE (for example,
269<function>GraphicsExpose</function>) are generated in response to a request,
270the DRAWABLE returned will be the one specified in the request.
271</para>
272
273<para>
274DBE advertises which visuals support double-buffering.
275</para>
276
277<para>
278DBE does not include any timing or synchronization facilities.
279Applications that need such facilities (for example, to maintain a constant
280frame rate) should investigate the Synchronization Extension, an X
281Consortium standard.
282</para>
283
284<sect1 id='Window_Management_Operations'>
285<title>Window Management Operations</title>
286
287<para>
288The basic philosophy of DBE is that both buffers are treated the same by core
289X window management operations.
290</para>
291
292<para>
293When the core <function>DestroyWindow</function> is executed on a
294double-buffered window, both buffers associated with the window are
295destroyed, and all back buffer names associated with the window are freed.
296</para>
297
298<para>
299If the core <function>ConfigureWindow</function> request changes the size of
300a window, both buffers assume the new size. If the windo's size increases,
301the effect on the buffers depends on whether the implementation honors bit
302gravity for buffers. If bit gravity is implemented, then the contents of
303both buffers are moved in accordance with the windo's bit gravity (see the
304core <function>ConfigureWindow</function> request), and the remaining areas
305are tiled with the window background. If bit gravity is not implemented, then
306the entire unobscured region of both buffers is tiled with the window
307background. In either case, <function>Expose</function> events are generated
308for the region that is tiled with the window background.
309</para>
310
311<para>
312If the core <function>GetGeometry</function> request is executed on a
313BACKBUFFER, the returned x, y, and border-width will be zero.
314</para>
315
316<para>
317If the Shape extension <function>ShapeRectangles</function>,
318<function>ShapeMask</function>,
319<function>ShapeCombine</function>, or
320<function>ShapeOffset</function>
321request is executed on a double-buffered window, both buffers are reshaped
322to match the new window shape. The region difference is the following:
323</para>
324
325<literallayout>
326   D = newshape - oldshape
327</literallayout>
328
329<para>
330It is tiled with the window background in both buffers, and
331<function>Expose</function> events are generated for D.
332</para>
333
334</sect1>
335
336<sect1 id='Complex_Swap_Actions'>
337<title>Complex Swap Actions</title>
338<para>
339DBE has no explicit knowledge of ancillary buffers (for example, depth
340buffers or alpha buffers), and only has a limited set of defined swap
341actions. Some applications may need a richer set of swap actions than DBE
342provides. Some DBE implementations have knowledge of ancillary buffers,
343and/or can provide a rich set of swap actions. Instead of continually
344extending DBE to increase its set of swap actions, DBE provides a flexible
345"idiom" mechanism. If an application's needs are served by the defined swap
346actions, it should use them; otherwise, it should use the following method
347of expressing a complex swap action as an idiom. Following this policy will
348ensure the best possible performance across a wide variety of implementations.
349</para>
350
351<para>
352As suggested by the term "idiom," a complex swap action should be expressed
353as a group/series of requests. Taken together, this group of requests may be
354combined into an atomic operation by the implementation, in order to maximize
355performance. The set of idioms actually recognized for optimization is
356implementation dependent. To help with idiom expression and interpretation,
357an idiom must be surrounded by two protocol requests:
358<function>DBEBeginIdiom</function> and
359<function>DBEEndIdiom</function>. Unless this begin-end pair
360surrounds the idiom, it may not be recognized by a given implementation, and
361performance will suffer.
362</para>
363
364<para>
365For example, if an application wants to swap buffers for two windows, and
366use core X to clear only certain planes of the back buffers, the application
367would issue the following protocol requests as a group, and in the following
368order:
369</para>
370
371<itemizedlist>
372  <listitem>
373    <para>DBEBeginIdiom request.</para>
374  </listitem>
375  <listitem>
376    <para>
377<function>DBESwapBuffers</function> request with XIDs for two windows, each of which uses
378a swap action of Untouched.
379    </para>
380  </listitem>
381  <listitem>
382    <para>
383Core X PolyFillRectangle request to the back buffer of one window.
384    </para>
385  </listitem>
386  <listitem>
387    <para>
388Core X PolyFillRectangle request to the back buffer of the other window.
389    </para>
390  </listitem>
391  <listitem>
392    <para>DBEEndIdiom request.</para>
393  </listitem>
394</itemizedlist>
395
396<para>
397The <function>DBEBeginIdiom</function> and <function>DBEEndIdiom</function>
398requests do not perform any actions themselves. They are treated as markers
399by implementations that can combine certain groups/series of requests as
400idioms, and are ignored by other implementations or for nonrecognized
401groups/series of requests. If these requests are sent out of order, or are
402mismatched, no errors are sent, and the requests are executed as usual,
403though performance may suffer.
404</para>
405
406<para>
407An idiom need not include a <function>DBESwapBuffers</function> request. For
408example, if a swap action of Copied is desired, but only some of the planes
409should be copied, a core X
410<function>CopyArea</function> request may be used instead of
411<function>DBESwapBuffers</function>.
412If <function>DBESwapBuffers</function> is included in an idiom, it should
413immediately follow the <function>DBEBeginIdiom</function> request. Also, when
414the <function>DBESwapBuffers</function> is included in an idiom, that
415request's swap action will still be valid, and if the swap action might
416overlap with another request, then the final result of the idiom must be as if
417the separate requests were executed serially. For example, if the specified
418swap action is Untouched, and if a <function>PolyFillRectangle</function>
419using a client clip rectangle is done to the windo's back buffer after the
420<function>DBESwapBuffers</function> request, then the contents of the new
421back buffer (after the idiom) will be the same as if the idiom was not
422recognized by the implementation.
423</para>
424
425<para>
426It is highly recommended that Application Programming Interface (API)
427providers define, and application developers use, "convenience" functions
428that allow client applications to call one procedure that encapsulates
429common idioms. These functions will generate the
430<function>DBEBeginIdiom</function> request, the idiom requests, and
431<function>DBEEndIdiom</function> request. Usage of these functions will
432ensure best possible performance across a wide variety of implementations.
433</para>
434
435</sect1>
436</chapter>
437
438<chapter id='Requests'>
439<title>Requests</title>
440<para>The DBE defines the following requests.</para>
441
442<sect1 id='DBEGetVersion'>
443<title>DBEGetVersion</title>
444<para>
445This request returns the major and minor version numbers of this extension.
446</para>
447
448<para>DBEGetVersion</para>
449<informaltable frame='none'>
450  <?dbfo keep-together="always" ?>
451  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
452    <colspec colname="c1" colwidth='1.0*'/>
453    <colspec colname="c2" colwidth='2.0*'/>
454    <tbody>
455      <row>
456        <entry>client-major-version</entry>
457        <entry>CARD8</entry>
458      </row>
459      <row>
460        <entry>client-minor-version </entry>
461        <entry>CARD8</entry>
462      </row>
463      <row>
464        <entry>=></entry>
465        <entry></entry>
466      </row>
467      <row>
468        <entry>server-major-version </entry>
469        <entry>CARD8</entry>
470      </row>
471      <row>
472        <entry>server-minor-version </entry>
473        <entry>CARD8</entry>
474      </row>
475    </tbody>
476  </tgroup>
477</informaltable>
478
479<para>
480The client-major-version and client-minor-version numbers indicate what
481version of the protocol the client wants the server to implement. The
482server-major-version and the server-minor-version numbers returned indicate
483the protocol this extension actually supports. This might not equal the
484version sent by the client. An implementation can (but need not) support
485more than one version simultaneously.  The server-major-version and
486server-minor-version allow the creation of future revisions of the DBE
487protocol that may be necessary. In general, the major version
488would increment for incompatible changes, and the minor version would increment
489for small, upward-compatible changes. Servers that support the protocol
490defined in this document will return a server-major-version of one (1), and a
491server-minor-version of zero (0).
492</para>
493
494<para>
495The DBE client must issue a DBEGetVersion request before any other double
496buffering request in order to negotiate a compatible protocol version;
497otherwise, the client will get undefined behavior (DBE may or may not work).
498</para>
499
500</sect1>
501
502<sect1 id='DBEGetVisualInfo'>
503<title>DBEGetVisualInfo</title>
504<para>
505This request returns information about which visuals support double buffering.
506</para>
507
508<para>DBEGetVisualInfo</para>
509
510<informaltable frame='none'>
511  <?dbfo keep-together="always" ?>
512  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
513    <colspec colname="c1" colwidth='1.0*'/>
514    <colspec colname="c2" colwidth='2.0*'/>
515    <tbody>
516      <row>
517        <entry>screen-specifiers</entry>
518        <entry>LISTofDRAWABLE</entry>
519      </row>
520      <row>
521        <entry>=></entry>
522        <entry></entry>
523      </row>
524      <row>
525        <entry>visinfo</entry>
526        <entry>LISTofSCREENVISINFO</entry>
527      </row>
528    </tbody>
529  </tgroup>
530</informaltable>
531<para>where:</para>
532
533<informaltable frame='none'>
534  <?dbfo keep-together="always" ?>
535  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
536    <colspec colname="c1" colwidth='1.0*'/>
537    <colspec colname="c2" colwidth='2.0*'/>
538    <tbody>
539      <row>
540        <entry>SCREENVISINFO</entry>
541        <entry>LISTofVISINFO</entry>
542      </row>
543      <row>
544        <entry>VISINFO</entry>
545        <entry>[ visual: VISUALID</entry>
546      </row>
547      <row>
548        <entry></entry>
549        <entry>depth: CARD8</entry>
550      </row>
551      <row>
552        <entry></entry>
553        <entry>perflevel: CARD8 ]</entry>
554      </row>
555    </tbody>
556  </tgroup>
557</informaltable>
558
559<para>Errors: Drawable</para>
560
561<para>
562All of the values passed in screen-specifiers must be valid DRAWABLEs (or a
563<function>Drawable</function> error results). For each drawable in
564screen-specifiers, the reply will contain a list of VISINFO structures for
565visuals that support double-buffering on the screen on which the drawable
566resides. The visual member specifies the VISUALID. The depth member specifies
567the depth in bits for the visual. The perflevel is a performance hint. The
568only operation defined on a perflevel is comparison to a perflevel of another
569visual on the same screen. The visual having the higher perflevel is likely
570to have better double-buffer graphics performance than the visual having the
571lower perflevel. Nothing can be deduced from any of the following: the
572magnitude of the difference of two perflevels, a perflevel value in isolation,
573or comparing perflevels from different servers.
574</para>
575
576<para>
577If the list of screen-specifiers is empty, information for all screens is
578returned, starting with screen zero.
579</para>
580
581</sect1>
582
583<sect1 id='DBEAllocateBackBufferName'>
584<title>DBEAllocateBackBufferName</title>
585
586<para>
587This request allocates a drawable ID used to refer to the back buffer of a
588window.
589</para>
590
591<para>DBEAllocateBackBufferName</para>
592
593<informaltable frame='none'>
594  <?dbfo keep-together="always" ?>
595  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
596    <colspec colname="c1" colwidth='1.0*'/>
597    <colspec colname="c2" colwidth='2.0*'/>
598    <tbody>
599      <row>
600        <entry>window</entry>
601        <entry>WINDOW</entry>
602      </row>
603      <row>
604        <entry>back-buffer-name</entry>
605        <entry>BACKBUFFER</entry>
606      </row>
607      <row>
608        <entry>swap-action-hint</entry>
609        <entry>SWAPACTION </entry>
610      </row>
611    </tbody>
612  </tgroup>
613</informaltable>
614
615<para>
616Errors: Alloc, Value, IDChoice, Match, Window
617</para>
618
619<para>
620If the window is not already a double-buffered window, the window becomes
621double-buffered, and the back-buffer-name is associated with the window. The
622swap-action-hint tells the server which swap action is most likely to be
623used with the window in subsequent <function>DBESwapBuffers</function>
624requests. The swap-action-hint must have one of the values specified for type
625SWAPACTION (or a Value error results). See the description of the
626<function>DBESwapBuffers</function> request for a complete discussion of
627swap actions and the SWAPACTION type.
628</para>
629
630<para>
631If the window already is a double-buffered window, nothing about the window
632changes, except that an additional back-buffer-name is associated with the
633window.  The window remains double-buffered until either the window is
634destroyed, or until all of the back buffer names for the window are
635deallocated.
636</para>
637
638<para>
639The window passed into the request must be a valid WINDOW (or a Window error
640results). The window passed into the request must be an InputOutput window (or
641a Match error results). The visual of the window must be in the list returned
642by <function>DBEGetVisualInfo</function> (or a Match error results). The
643back-buffer-name must be in the range assigned to the client, and must not
644already be in use (or an IDChoice error results). If the server cannot
645allocate all resources associated with turning on double-buffering for the
646window, an Alloc error results, the windo's double-buffer status (whether it
647is already double-buffered or not) remains unchanged, and the
648back-buffer-name is freed.
649</para>
650</sect1>
651
652<sect1 id='DBEDeallocateBackBufferName'>
653<title>DBEDeallocateBackBufferName</title>
654<para>
655This request frees a drawable ID that was obtained by
656<function>DBEAllocateBackBufferName</function>.
657</para>
658
659<para>DBEDeallocateBackBufferName</para>
660
661<informaltable frame='none'>
662  <?dbfo keep-together="always" ?>
663  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
664  <colspec colname="c1" colwidth='1.0*'/>
665  <colspec colname="c2" colwidth='2.0*'/>
666  <tbody>
667    <row>
668      <entry>back-buffer-name</entry>
669      <entry>BACKBUFFER</entry>
670    </row>
671  </tbody>
672  </tgroup>
673</informaltable>
674
675<para>Errors: Buffer</para>
676
677<para>
678The back-buffer-name passed in the request is freed and no longer associated
679with the window. If this is the last back-buffer-name associated with the
680window, then the back buffer is no longer accessible to clients, and all
681double-buffering resources associated with the window may be freed. The
682window's current front buffer remains the front buffer.
683</para>
684
685<para>
686The back-buffer-name must be a valid BACKBUFFER associated with a window (or
687a Buffer error results).
688</para>
689</sect1>
690
691<sect1 id='DBESwapBuffers'>
692<title>DBESwapBuffers</title>
693<para>
694This request swaps the buffers for all windows listed, applying the
695appropriate swap action for each window.
696</para>
697
698<para><function>DBESwapBuffers</function></para>
699
700<informaltable frame='none'>
701  <?dbfo keep-together="always" ?>
702  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
703  <colspec colname="c1" colwidth='1.0*'/>
704  <colspec colname="c2" colwidth='3.0*'/>
705  <tbody>
706    <row>
707      <entry>windows</entry>
708      <entry>LISTofSWAPINFO</entry>
709    </row>
710  </tbody>
711  </tgroup>
712</informaltable>
713<para>where:</para>
714<informaltable frame='none'>
715  <?dbfo keep-together="always" ?>
716  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
717  <colspec colname="c1" colwidth='1.0*'/>
718  <colspec colname="c2" colwidth='2.0*'/>
719  <tbody>
720    <row>
721      <entry>SWAPINFO</entry>
722      <entry>[ window: WINDOW</entry>
723    </row>
724    <row>
725      <entry></entry>
726      <entry>swap-action: SWAPACTION ]</entry>
727    </row>
728    <row>
729      <entry>SWAPACTION</entry>
730      <entry>{ Undefined, Background, Untouched, Copied }</entry>
731    </row>
732  </tbody>
733  </tgroup>
734</informaltable>
735
736<para>Errors: Match, Window, Value</para>
737
738<para>
739Each window passed into the request must be a valid WINDOW (or a
740<function>Window</function> error results). Each window passed into the
741request must be a double-buffered window (or a <function>Match</function>
742error results). Each window passed into the request must only be listed
743once (or a <function>Match</function> error results). Each swap-action in
744the list must have one of the values specified for type SWAPACTION (or a
745<function>Value</function> error results). If an error results, none of
746the valid double-buffered windows will have their buffers swapped.
747</para>
748
749<para>
750The swap-action determines what will happen to the new back buffer of the
751window it is paired with in the list in addition to making the old back
752buffer become visible.  The defined actions are as follows:
753</para>
754
755<variablelist>
756  <varlistentry>
757    <term>Undefined</term>
758      <listitem><para>
759The contents of the new back buffer become undefined. This may be the
760most efficient action since it allows the implementation to discard the
761contents of the buffer if it needs to.
762      </para></listitem>
763  </varlistentry>
764  <varlistentry>
765    <term>Background</term>
766    <listitem><para>
767The unobscured region of the new back buffer will be tiled with the window
768background. The background action allows devices to use a fast clear
769capability during a swap.
770    </para></listitem>
771  </varlistentry>
772  <varlistentry>
773    <term>Untouched</term>
774    <listitem><para>
775The unobscured region of the new back buffer will be unmodified by the swap.
776    </para></listitem>
777  </varlistentry>
778  <varlistentry>
779    <term>Copied</term>
780    <listitem><para>
781The unobscured region of the new back buffer will be the contents of the
782old back buffer.
783    </para></listitem>
784  </varlistentry>
785</variablelist>
786
787<para>
788If <function>DBESwapBuffers</function> is included in a "swap and clear"
789type of idiom, it must immediately follow the
790<function>DBEBeginIdiom</function> request.
791</para>
792</sect1>
793
794<sect1 id='DBEBeginIdiom'>
795<title>DBEBeginIdiom</title>
796<para>
797This request informs the server that a complex swap will immediately follow
798this request.
799</para>
800
801<para><function>DBEBeginIdiom</function></para>
802
803<para>
804As previously discussed, a complex swap action is a group/series of
805requests that, taken together, may be combined into an atomic operation by
806the implementation.  The sole function of this request is to serve as a
807"marker" that the server can use to aid in idiom processing. The server is
808free to implement this request as a no-op.
809</para>
810</sect1>
811
812<sect1 id='DBEEndIdiom'>
813<title>DBEEndIdiom</title>
814
815
816<para>
817This request informs the server that a complex swap has concluded.
818</para>
819
820<para><function>DBEEndIdiom</function></para>
821
822<para>
823The sole function of this request is to serve as a "marker" that the server
824can use to aid in idiom processing. The server is free to implement this
825request as a no-op.
826</para>
827
828</sect1>
829
830<sect1 id='DBEGetBackBufferAttributes'>
831<title>DBEGetBackBufferAttributes</title>
832
833<para>This request returns information about a back buffer.</para>
834
835<para><function>DBEGetBackBufferAttributes</function></para>
836
837<informaltable frame='none'>
838  <?dbfo keep-together="always" ?>
839  <tgroup cols="2" align='left' colsep='0' rowsep='0'>
840  <colspec colname="c1" colwidth='1.0*'/>
841  <colspec colname="c2" colwidth='2.0*'/>
842  <tbody>
843    <row>
844      <entry>back-buffer-name</entry>
845      <entry>BACKBUFFER</entry>
846    </row>
847    <row>
848      <entry>=></entry>
849      <entry></entry>
850    </row>
851    <row>
852      <entry>attributes</entry>
853      <entry>BUFFER_ATTRIBUTES</entry>
854    </row>
855  </tbody>
856  </tgroup>
857</informaltable>
858
859<para>where:</para>
860
861<para>BUFFER_ATTRIBUTES: [ window: WINDOW ]</para>
862
863<para>
864If back-buffer-name is a valid BACKBUFFER, the window field of the
865attributes in the reply will be the window which has the back buffer that
866back-buffer-name refers to. If back-buffer-name is not a valid BACKBUFFER,
867the window field of the attributes in the reply will be None.
868</para>
869
870</sect1>
871</chapter>
872
873<chapter id='Encoding'>
874<title>Encoding</title>
875<para>
876Please refer to the X11 Protocol Encoding document as this section uses
877syntactic conventions and data types established there.
878</para>
879
880<para>The name of this extension is "DOUBLE-BUFFER".</para>
881
882<sect1 id='Type'>
883<title>Type</title>
884<para>The following new types are used by the extension.
885</para>
886
887<para>BACKBUFFER: XID</para>
888<para>SWAPACTION</para>
889<literallayout class="monospaced">
890#x00  Undefined
891#x01  Background
892#x02  Untouched
893#x03  Copied
894</literallayout>
895
896<para>SWAPINFO</para>
897<literallayout class="monospaced">
8984     WINDOW                 window
8991     SWAPACTION             swap action
9003                            unused
901</literallayout>
902
903<literallayout class="monospaced">
904VISINFO
9054     VISUALID                visual
9061     CARD8                   depth
9071     CARD8                   perflevel
9082                             unused
909
910SCREENVISINFO
9114     CARD32                  n, number in list
9128n    LISTofVISINFO           n VISINFOs
913
914BUFFER_ATTRIBUTES
9154     WINDOW                 window
916</literallayout>
917</sect1>
918
919<sect1 id='Error'>
920<title>Error</title>
921<para><function>Buffer</function></para>
922<literallayout class="monospaced">
9231     0                       error
9241     error base + 0          code
9252     CARD16                  sequence number
9264     CARD32                  bad buffer
9272     CARD16                  minor-opcode
9281     CARD8                   major-opcode
92921                            unused
930</literallayout>
931</sect1>
932
933<sect1 id='Request'>
934<title>Request</title>
935
936<literallayout class="monospaced">
937DBEGetVersion
9381     CARD8                  major-opcode
9391     0                      minor-opcode
9402     2                      request length
9411     CARD8                  client-major-version
9421     CARD8                  client-minor-version
9432                            unused
944=>
9451                            unused
9462     CARD16                 sequence number
9474     0                      reply length
9481     CARD8                  server-major-version
9491     CARD8                  server-minor-version
95022                           unused
951</literallayout>
952
953<para><function>DBEAllocateBackBufferName</function></para>
954<literallayout class="monospaced">
9551     CARD8                  major-opcode
9561     1                      minor-opcode
9572     4                      request length
9584     WINDOW                 window
9594     BACKBUFFER             back buffer name
9601     SWAPACTION             swap action hint
9613                            unused
962</literallayout>
963
964<para><function>DBEDeallocateBackBufferName</function></para>
965<literallayout class="monospaced">
9661     CARD8                  major-opcode
9671     2                      minor-opcode
9682     2                      request length
9694     BACKBUFFER             back buffer name
970</literallayout>
971
972
973<para><function>DBESwapBuffers</function></para>
974<literallayout class="monospaced">
9751     CARD8                   major-opcode
9761     3                       minor-opcode
9772     2+2n                    request length
9784     CARD32                  n, number of window/swap action pairs in list
9798n    LISTofSWAPINFO          window/swap action pairs
980</literallayout>
981
982
983<para><function>DBEBeginIdiom</function></para>
984<literallayout class="monospaced">
9851     CARD8                   major-opcode
9861     4                       minor-opcode
9872     1                       request length
988</literallayout>
989
990<para><function>DBEEndIdiom</function></para>
991<literallayout class="monospaced">
9921     CARD8                   major-opcode
9931     5                       minor-opcode
9942     1                       request length
995</literallayout>
996
997<para><function>DBEGetVisualInfo</function></para>
998<literallayout class="monospaced">
9991     CARD8                   major-opcode
10001     6                       minor-opcode
10012     2+n                     request length
10024     CARD32                  n, number of screen specifiers in list
10034n    LISTofDRAWABLE          n screen specifiers
1004=>
10051     1                       Reply
10061                             unused
10072     CARD16                  sequence number
10084     CARD32                  reply length
10094     CARD32                  m, number of SCREENVISINFOs in list
101020                            unused
10114j    LISTofSCREENVISINFO     m SCREENVISINFOs
1012</literallayout>
1013
1014<para><function>DBEGetBackBufferAttributes</function></para>
1015<literallayout class="monospaced">
10161     CARD8                   major-opcode
10171     7                       minor-opcode
10182     2                       request length
10194     BACKBUFFER              back-buffer-name
1020=>
10211                             unused
10222     CARD16                  sequence number
10234     0                       reply length
10244     BUFFER_ATTRIBUTES       attributes
102520                            unused
1026</literallayout>
1027</sect1>
1028
1029</chapter>
1030
1031<chapter id='Acknowledgements'>
1032<title>Acknowledgements</title>
1033<para>
1034We wish to thank the following individuals who have contributed their time
1035and talent toward shaping the DBE specification:
1036</para>
1037<para>T. Alex Chen, IBM; Peter Daifuku, Silicon Graphics, Inc.;
1038Ian Elliott, Hewlett-Packard Company; Stephen Gildea, X Consortium, Inc.;
1039Jim Graham, Sun; Larry Hare, AGE Logic; Jay Hersh, X Consortium, Inc.;
1040Daryl Huff, Sun; Deron Dann Johnson, Sun; Louis Khouw, Sun;
1041Mark Kilgard, Silicon Graphics, Inc.; Rob
1042Lembree, Digital Equipment Corporation; Alan Ricker, Metheus; Michael
1043Rosenblum, Digital Equipment Corporation; Bob Scheifler, X Consortium, Inc.;
1044Larry Seiler, Digital Equipment Corporation; Jeanne Sparlin Smith, IBM;
1045Jeff Stevenson, Hewlett-Packard Company; Walter Strand, Metheus; Ken
1046Tidwell, Hewlett-Packard Company; and David P. Wiggins, X Consortium, Inc.
1047</para>
1048
1049<para>
1050Mark provided the impetus to start the DBE project. Ian wrote the first
1051draft of the specification. David served as architect.
1052</para>
1053</chapter>
1054
1055<chapter id='References'>
1056<title>References</title>
1057<para>
1058Jeffrey Friedberg, Larry Seiler, and Jeff Vroom, "Multi-buffering Extension
1059Specification Version 3.3."
1060</para>
1061<para>Tim Glauert, Dave Carver, Jim Gettys, and David P. Wiggins,
1062"X Synchronization Extension Version 3.0."
1063</para>
1064</chapter>
1065</book>
1066