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 *****************************************************************************/
38 #define NEED_DBE_PROTOCOL
39 #include <X11/extensions/dbeproto.h>
40 #include "windowstr.h"
44 VisualID visual
; /* one visual ID that supports double-buffering */
45 int depth
; /* depth of visual in bits */
46 int perflevel
; /* performance level of visual */
50 int count
; /* number of items in visual_depth */
51 XdbeVisualInfo
*visinfo
; /* list of visuals & depths for scrn */
52 } XdbeScreenVisualInfo
;
56 #define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \
57 dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey))
59 #define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \
60 DBE_SCREEN_PRIV((pDrawable)->pScreen)
62 #define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \
63 DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen)
65 #define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \
66 DBE_SCREEN_PRIV((pWindow)->drawable.pScreen)
68 #define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \
69 DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen)
71 #define DBE_SCREEN_PRIV_FROM_GC(pGC)\
72 DBE_SCREEN_PRIV((pGC)->pScreen)
74 #define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \
75 dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey))
77 /* Initial size of the buffer ID array in the window priv. */
78 #define DBE_INIT_MAX_IDS 2
80 /* Reallocation increment for the buffer ID array. */
81 #define DBE_INCR_MAX_IDS 4
83 /* Marker for free elements in the buffer ID array. */
84 #define DBE_FREE_ID_ELEMENT 0
88 /* Record used to pass swap information between DIX and DDX swapping
91 typedef struct _DbeSwapInfoRec
{
93 unsigned char swapAction
;
95 } DbeSwapInfoRec
, *DbeSwapInfoPtr
;
98 ******************************************************************************
100 ******************************************************************************
103 typedef struct _DbeWindowPrivRec
{
104 /* A pointer to the window with which the DBE window private (buffer) is
109 /* Last known swap action for this buffer. Legal values for this field
110 * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
112 unsigned char swapAction
;
114 /* Last known buffer size.
116 unsigned short width
, height
;
118 /* Coordinates used for static gravity when the window is positioned.
122 /* Number of XIDs associated with this buffer.
126 /* Capacity of the current buffer ID array, IDs. */
129 /* Pointer to the array of buffer IDs. This initially points to initIDs.
130 * When the static limit of the initIDs array is reached, the array is
131 * reallocated and this pointer is set to the new array instead of initIDs.
135 /* Initial array of buffer IDs. We are defining the XID array within the
136 * window priv to optimize for data locality. In most cases, only one
137 * buffer will be associated with a window. Having the array declared
138 * here can prevent us from accessing the data in another memory page,
139 * possibly resulting in a page swap and loss of performance. Initially we
140 * will use this array to store buffer IDs. For situations where we have
141 * more IDs than can fit in this static array, we will allocate a larger
142 * array to use, possibly suffering a performance loss.
144 XID initIDs
[DBE_INIT_MAX_IDS
];
146 /* Pointer to a drawable that contains the contents of the back buffer.
148 PixmapPtr pBackBuffer
;
150 /* Pointer to a drawable that contains the contents of the front buffer.
151 * This pointer is only used for the XdbeUntouched swap action. For that
152 * swap action, we need to copy the front buffer (window) contents into
153 * this drawable, copy the contents of current back buffer drawable (the
154 * back buffer) into the window, swap the front and back drawable pointers,
155 * and then swap the drawable/resource associations in the resource
158 PixmapPtr pFrontBuffer
;
160 /* Device-specific private information.
162 PrivateRec
*devPrivates
;
164 } DbeWindowPrivRec
, *DbeWindowPrivPtr
;
167 ******************************************************************************
169 ******************************************************************************
172 typedef struct _DbeScreenPrivRec
{
174 * It is the responsibilty of the DDX layer to wrap PositionWindow().
175 * DbeExtensionInit wraps DestroyWindow().
177 PositionWindowProcPtr PositionWindow
;
178 DestroyWindowProcPtr DestroyWindow
;
180 /* Per-screen DIX routines */
181 Bool (*SetupBackgroundPainter
) (WindowPtr
/*pWin */ ,
185 /* Per-screen DDX routines */
186 Bool (*GetVisualInfo
) (ScreenPtr
/*pScreen */ ,
187 XdbeScreenVisualInfo
* /*pVisInfo */
189 int (*AllocBackBufferName
) (WindowPtr
/*pWin */ ,
193 int (*SwapBuffers
) (ClientPtr
/*client */ ,
194 int * /*pNumWindows */ ,
195 DbeSwapInfoPtr
/*swapInfo */
197 void (*WinPrivDelete
) (DbeWindowPrivPtr
/*pDbeWindowPriv */ ,
200 } DbeScreenPrivRec
, *DbeScreenPrivPtr
;
202 #endif /* DBE_STRUCT_H */