]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/xserver.git/blob - dbe/dbestruct.h
Imported Upstream version 1.11.4
[glsdk/xserver.git] / dbe / dbestruct.h
1 /******************************************************************************
2  * 
3  * Copyright (c) 1994, 1995  Hewlett-Packard Company
4  *
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:
12  * 
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  * 
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.
23  * 
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.
28  * 
29  *     Header file for DIX-related DBE
30  *
31  *****************************************************************************/
33 #ifndef DBE_STRUCT_H
34 #define DBE_STRUCT_H
37 /* INCLUDES */
39 #define NEED_DBE_PROTOCOL
40 #include <X11/extensions/dbeproto.h>
41 #include "windowstr.h"
42 #include "privates.h"
44 typedef struct
45 {
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                  */
49 }
50 XdbeVisualInfo;
52 typedef struct
53 {
54     int                 count;          /* number of items in visual_depth   */
55     XdbeVisualInfo      *visinfo;       /* list of visuals & depths for scrn */
56 }
57 XdbeScreenVisualInfo;
59 /* DEFINES */
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);
93 /* TYPEDEFS */
95 /* Record used to pass swap information between DIX and DDX swapping
96  * procedures.
97  */
98 typedef struct _DbeSwapInfoRec
99 {
100     WindowPtr           pWindow;
101     unsigned char       swapAction;
103 } DbeSwapInfoRec, *DbeSwapInfoPtr;
105 /*
106  ******************************************************************************
107  ** Per-window data
108  ******************************************************************************
109  */
111 typedef struct _DbeWindowPrivRec
113     /* A pointer to the window with which the DBE window private (buffer) is
114      * associated.
115      */
116     WindowPtr           pWindow;
118     /* Last known swap action for this buffer.  Legal values for this field
119      * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied.
120      */
121     unsigned char       swapAction;
123     /* Last known buffer size.
124      */
125     unsigned short      width, height;
127     /* Coordinates used for static gravity when the window is positioned.
128      */
129     short               x, y;
131     /* Number of XIDs associated with this buffer.
132      */
133     int                 nBufferIDs;
135     /* Capacity of the current buffer ID array, IDs. */
136     int                 maxAvailableIDs;
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.
141      */
142     XID                 *IDs;
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. 
152      */
153     XID                 initIDs[DBE_INIT_MAX_IDS];
155     /* Device-specific private information.
156      */
157     PrivateRec          *devPrivates;
159 } DbeWindowPrivRec, *DbeWindowPrivPtr;
162 /*
163  ******************************************************************************
164  ** Per-screen data
165  ******************************************************************************
166  */
168 typedef struct _DbeScreenPrivRec
170     /* Wrapped functions
171      * It is the responsibilty of the DDX layer to wrap PositionWindow().
172      * DbeExtensionInit wraps DestroyWindow().
173      */
174     PositionWindowProcPtr PositionWindow;
175     DestroyWindowProcPtr  DestroyWindow;
177     /* Per-screen DIX routines */
178     Bool        (*SetupBackgroundPainter)(
179                 WindowPtr /*pWin*/,
180                 GCPtr /*pGC*/
181 );
183     /* Per-screen DDX routines */
184     Bool        (*GetVisualInfo)(
185                 ScreenPtr /*pScreen*/,
186                 XdbeScreenVisualInfo * /*pVisInfo*/
187 );
188     int         (*AllocBackBufferName)(
189                 WindowPtr /*pWin*/,
190                 XID /*bufId*/,
191                 int /*swapAction*/
192 );
193     int         (*SwapBuffers)(
194                 ClientPtr /*client*/,
195                 int * /*pNumWindows*/,
196                 DbeSwapInfoPtr /*swapInfo*/
197 );
198     void        (*BeginIdiom)(
199                 ClientPtr /*client*/
200 );
201     void        (*EndIdiom)(
202                 ClientPtr /*client*/
203 );
204     void        (*WinPrivDelete)(
205                 DbeWindowPrivPtr /*pDbeWindowPriv*/,
206                 XID /*bufId*/
207 );
208     void        (*ResetProc)(
209                 ScreenPtr /*pScreen*/
210 );
212 } DbeScreenPrivRec, *DbeScreenPrivPtr;
214 #endif /* DBE_STRUCT_H */