1706f2543Smrg/****************************************************************************** 2706f2543Smrg * 3706f2543Smrg * Copyright (c) 1994, 1995 Hewlett-Packard Company 4706f2543Smrg * 5706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining 6706f2543Smrg * a copy of this software and associated documentation files (the 7706f2543Smrg * "Software"), to deal in the Software without restriction, including 8706f2543Smrg * without limitation the rights to use, copy, modify, merge, publish, 9706f2543Smrg * distribute, sublicense, and/or sell copies of the Software, and to 10706f2543Smrg * permit persons to whom the Software is furnished to do so, subject to 11706f2543Smrg * the following conditions: 12706f2543Smrg * 13706f2543Smrg * The above copyright notice and this permission notice shall be included 14706f2543Smrg * in all copies or substantial portions of the Software. 15706f2543Smrg * 16706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17706f2543Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19706f2543Smrg * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, 20706f2543Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 21706f2543Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 22706f2543Smrg * THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23706f2543Smrg * 24706f2543Smrg * Except as contained in this notice, the name of the Hewlett-Packard 25706f2543Smrg * Company shall not be used in advertising or otherwise to promote the 26706f2543Smrg * sale, use or other dealings in this Software without prior written 27706f2543Smrg * authorization from the Hewlett-Packard Company. 28706f2543Smrg * 29706f2543Smrg * Header file for DIX-related DBE 30706f2543Smrg * 31706f2543Smrg *****************************************************************************/ 32706f2543Smrg 33706f2543Smrg#ifndef DBE_STRUCT_H 34706f2543Smrg#define DBE_STRUCT_H 35706f2543Smrg 36706f2543Smrg 37706f2543Smrg/* INCLUDES */ 38706f2543Smrg 39706f2543Smrg#define NEED_DBE_PROTOCOL 40706f2543Smrg#include <X11/extensions/dbeproto.h> 41706f2543Smrg#include "windowstr.h" 42706f2543Smrg#include "privates.h" 43706f2543Smrg 44706f2543Smrgtypedef struct 45706f2543Smrg{ 46706f2543Smrg VisualID visual; /* one visual ID that supports double-buffering */ 47706f2543Smrg int depth; /* depth of visual in bits */ 48706f2543Smrg int perflevel; /* performance level of visual */ 49706f2543Smrg} 50706f2543SmrgXdbeVisualInfo; 51706f2543Smrg 52706f2543Smrgtypedef struct 53706f2543Smrg{ 54706f2543Smrg int count; /* number of items in visual_depth */ 55706f2543Smrg XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ 56706f2543Smrg} 57706f2543SmrgXdbeScreenVisualInfo; 58706f2543Smrg 59706f2543Smrg/* DEFINES */ 60706f2543Smrg 61706f2543Smrg#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \ 62706f2543Smrg dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey)) 63706f2543Smrg 64706f2543Smrg#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ 65706f2543Smrg DBE_SCREEN_PRIV((pDrawable)->pScreen) 66706f2543Smrg 67706f2543Smrg#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \ 68706f2543Smrg DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen) 69706f2543Smrg 70706f2543Smrg#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \ 71706f2543Smrg DBE_SCREEN_PRIV((pWindow)->drawable.pScreen) 72706f2543Smrg 73706f2543Smrg#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \ 74706f2543Smrg DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen) 75706f2543Smrg 76706f2543Smrg#define DBE_SCREEN_PRIV_FROM_GC(pGC)\ 77706f2543Smrg DBE_SCREEN_PRIV((pGC)->pScreen) 78706f2543Smrg 79706f2543Smrg#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \ 80706f2543Smrg dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey)) 81706f2543Smrg 82706f2543Smrg/* Initial size of the buffer ID array in the window priv. */ 83706f2543Smrg#define DBE_INIT_MAX_IDS 2 84706f2543Smrg 85706f2543Smrg/* Reallocation increment for the buffer ID array. */ 86706f2543Smrg#define DBE_INCR_MAX_IDS 4 87706f2543Smrg 88706f2543Smrg/* Marker for free elements in the buffer ID array. */ 89706f2543Smrg#define DBE_FREE_ID_ELEMENT 0 90706f2543Smrg 91706f2543Smrgextern _X_EXPORT void DbeExtensionInit (void); 92706f2543Smrg 93706f2543Smrg/* TYPEDEFS */ 94706f2543Smrg 95706f2543Smrg/* Record used to pass swap information between DIX and DDX swapping 96706f2543Smrg * procedures. 97706f2543Smrg */ 98706f2543Smrgtypedef struct _DbeSwapInfoRec 99706f2543Smrg{ 100706f2543Smrg WindowPtr pWindow; 101706f2543Smrg unsigned char swapAction; 102706f2543Smrg 103706f2543Smrg} DbeSwapInfoRec, *DbeSwapInfoPtr; 104706f2543Smrg 105706f2543Smrg/* 106706f2543Smrg ****************************************************************************** 107706f2543Smrg ** Per-window data 108706f2543Smrg ****************************************************************************** 109706f2543Smrg */ 110706f2543Smrg 111706f2543Smrgtypedef struct _DbeWindowPrivRec 112706f2543Smrg{ 113706f2543Smrg /* A pointer to the window with which the DBE window private (buffer) is 114706f2543Smrg * associated. 115706f2543Smrg */ 116706f2543Smrg WindowPtr pWindow; 117706f2543Smrg 118706f2543Smrg /* Last known swap action for this buffer. Legal values for this field 119706f2543Smrg * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. 120706f2543Smrg */ 121706f2543Smrg unsigned char swapAction; 122706f2543Smrg 123706f2543Smrg /* Last known buffer size. 124706f2543Smrg */ 125706f2543Smrg unsigned short width, height; 126706f2543Smrg 127706f2543Smrg /* Coordinates used for static gravity when the window is positioned. 128706f2543Smrg */ 129706f2543Smrg short x, y; 130706f2543Smrg 131706f2543Smrg /* Number of XIDs associated with this buffer. 132706f2543Smrg */ 133706f2543Smrg int nBufferIDs; 134706f2543Smrg 135706f2543Smrg /* Capacity of the current buffer ID array, IDs. */ 136706f2543Smrg int maxAvailableIDs; 137706f2543Smrg 138706f2543Smrg /* Pointer to the array of buffer IDs. This initially points to initIDs. 139706f2543Smrg * When the static limit of the initIDs array is reached, the array is 140706f2543Smrg * reallocated and this pointer is set to the new array instead of initIDs. 141706f2543Smrg */ 142706f2543Smrg XID *IDs; 143706f2543Smrg 144706f2543Smrg /* Initial array of buffer IDs. We are defining the XID array within the 145706f2543Smrg * window priv to optimize for data locality. In most cases, only one 146706f2543Smrg * buffer will be associated with a window. Having the array declared 147706f2543Smrg * here can prevent us from accessing the data in another memory page, 148706f2543Smrg * possibly resulting in a page swap and loss of performance. Initially we 149706f2543Smrg * will use this array to store buffer IDs. For situations where we have 150706f2543Smrg * more IDs than can fit in this static array, we will allocate a larger 151706f2543Smrg * array to use, possibly suffering a performance loss. 152706f2543Smrg */ 153706f2543Smrg XID initIDs[DBE_INIT_MAX_IDS]; 154706f2543Smrg 155706f2543Smrg /* Device-specific private information. 156706f2543Smrg */ 157706f2543Smrg PrivateRec *devPrivates; 158706f2543Smrg 159706f2543Smrg} DbeWindowPrivRec, *DbeWindowPrivPtr; 160706f2543Smrg 161706f2543Smrg 162706f2543Smrg/* 163706f2543Smrg ****************************************************************************** 164706f2543Smrg ** Per-screen data 165706f2543Smrg ****************************************************************************** 166706f2543Smrg */ 167706f2543Smrg 168706f2543Smrgtypedef struct _DbeScreenPrivRec 169706f2543Smrg{ 170706f2543Smrg /* Wrapped functions 171706f2543Smrg * It is the responsibilty of the DDX layer to wrap PositionWindow(). 172706f2543Smrg * DbeExtensionInit wraps DestroyWindow(). 173706f2543Smrg */ 174706f2543Smrg PositionWindowProcPtr PositionWindow; 175706f2543Smrg DestroyWindowProcPtr DestroyWindow; 176706f2543Smrg 177706f2543Smrg /* Per-screen DIX routines */ 178706f2543Smrg Bool (*SetupBackgroundPainter)( 179706f2543Smrg WindowPtr /*pWin*/, 180706f2543Smrg GCPtr /*pGC*/ 181706f2543Smrg); 182706f2543Smrg 183706f2543Smrg /* Per-screen DDX routines */ 184706f2543Smrg Bool (*GetVisualInfo)( 185706f2543Smrg ScreenPtr /*pScreen*/, 186706f2543Smrg XdbeScreenVisualInfo * /*pVisInfo*/ 187706f2543Smrg); 188706f2543Smrg int (*AllocBackBufferName)( 189706f2543Smrg WindowPtr /*pWin*/, 190706f2543Smrg XID /*bufId*/, 191706f2543Smrg int /*swapAction*/ 192706f2543Smrg); 193706f2543Smrg int (*SwapBuffers)( 194706f2543Smrg ClientPtr /*client*/, 195706f2543Smrg int * /*pNumWindows*/, 196706f2543Smrg DbeSwapInfoPtr /*swapInfo*/ 197706f2543Smrg); 198706f2543Smrg void (*BeginIdiom)( 199706f2543Smrg ClientPtr /*client*/ 200706f2543Smrg); 201706f2543Smrg void (*EndIdiom)( 202706f2543Smrg ClientPtr /*client*/ 203706f2543Smrg); 204706f2543Smrg void (*WinPrivDelete)( 205706f2543Smrg DbeWindowPrivPtr /*pDbeWindowPriv*/, 206706f2543Smrg XID /*bufId*/ 207706f2543Smrg); 208706f2543Smrg void (*ResetProc)( 209706f2543Smrg ScreenPtr /*pScreen*/ 210706f2543Smrg); 211706f2543Smrg 212706f2543Smrg} DbeScreenPrivRec, *DbeScreenPrivPtr; 213706f2543Smrg 214706f2543Smrg#endif /* DBE_STRUCT_H */ 215