1 /******************************************************************************
3 * Copyright (c) 1994, 1995 Hewlett-Packard Company
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * Except as contained in this notice, the name of the Hewlett-Packard
25 * Company shall not be used in advertising or otherwise to promote the
26 * sale, use or other dealings in this Software without prior written
27 * authorization from the Hewlett-Packard Company.
29 * Header file for DIX-related DBE
31 *****************************************************************************/
39 #define NEED_DBE_PROTOCOL
40 #include <X11/extensions/dbeproto.h>
41 #include "windowstr.h"
46 VisualID visual; /* one visual ID that supports double-buffering */
47 int depth; /* depth of visual in bits */
48 int perflevel; /* performance level of visual */
54 int count; /* number of items in visual_depth */
55 XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */
61 #define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
62 dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
64 #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
65 DBE_SCREEN_PRIV((pDrawable)->pScreen)
67 #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
68 DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
70 #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
71 DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
73 #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
74 DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
76 #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
77 DBE_SCREEN_PRIV((pGC)->pScreen)
79 #define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
80 dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
82 /* Initial size of the buffer ID array in the window priv. */
83 #define DBE_INIT_MAX_IDS 2
85 /* Reallocation increment for the buffer ID array. */
86 #define DBE_INCR_MAX_IDS 4
88 /* Marker for free elements in the buffer ID array. */
89 #define DBE_FREE_ID_ELEMENT 0
91 extern _X_EXPORT void DbeExtensionInit (void);
95 /* Record used to pass swap information between DIX and DDX swapping
98 typedef struct _DbeSwapInfoRec
101 unsigned char swapAction;
103 } DbeSwapInfoRec, *DbeSwapInfoPtr;
106 ******************************************************************************
108 ******************************************************************************
111 typedef struct _DbeWindowPrivRec
113 /* A pointer to the window with which the DBE window private (buffer) is
118 /* Last known swap action for this buffer. Legal values for this field
119 * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
121 unsigned char swapAction;
123 /* Last known buffer size.
125 unsigned short width, height;
127 /* Coordinates used for static gravity when the window is positioned.
131 /* Number of XIDs associated with this buffer.
135 /* Capacity of the current buffer ID array, IDs. */
138 /* Pointer to the array of buffer IDs. This initially points to initIDs.
139 * When the static limit of the initIDs array is reached, the array is
140 * reallocated and this pointer is set to the new array instead of initIDs.
144 /* Initial array of buffer IDs. We are defining the XID array within the
145 * window priv to optimize for data locality. In most cases, only one
146 * buffer will be associated with a window. Having the array declared
147 * here can prevent us from accessing the data in another memory page,
148 * possibly resulting in a page swap and loss of performance. Initially we
149 * will use this array to store buffer IDs. For situations where we have
150 * more IDs than can fit in this static array, we will allocate a larger
151 * array to use, possibly suffering a performance loss.
153 XID initIDs[DBE_INIT_MAX_IDS];
155 /* Device-specific private information.
157 PrivateRec *devPrivates;
159 } DbeWindowPrivRec, *DbeWindowPrivPtr;
163 ******************************************************************************
165 ******************************************************************************
168 typedef struct _DbeScreenPrivRec
171 * It is the responsibilty of the DDX layer to wrap PositionWindow().
172 * DbeExtensionInit wraps DestroyWindow().
174 PositionWindowProcPtr PositionWindow;
175 DestroyWindowProcPtr DestroyWindow;
177 /* Per-screen DIX routines */
178 Bool (*SetupBackgroundPainter)(
183 /* Per-screen DDX routines */
184 Bool (*GetVisualInfo)(
185 ScreenPtr /*pScreen*/,
186 XdbeScreenVisualInfo * /*pVisInfo*/
188 int (*AllocBackBufferName)(
194 ClientPtr /*client*/,
195 int * /*pNumWindows*/,
196 DbeSwapInfoPtr /*swapInfo*/
204 void (*WinPrivDelete)(
205 DbeWindowPrivPtr /*pDbeWindowPriv*/,
209 ScreenPtr /*pScreen*/
212 } DbeScreenPrivRec, *DbeScreenPrivPtr;
214 #endif /* DBE_STRUCT_H */