105b261ecSmrg/****************************************************************************** 2f7df2e56Smrg * 305b261ecSmrg * Copyright (c) 1994, 1995 Hewlett-Packard Company 405b261ecSmrg * 505b261ecSmrg * Permission is hereby granted, free of charge, to any person obtaining 605b261ecSmrg * a copy of this software and associated documentation files (the 705b261ecSmrg * "Software"), to deal in the Software without restriction, including 805b261ecSmrg * without limitation the rights to use, copy, modify, merge, publish, 905b261ecSmrg * distribute, sublicense, and/or sell copies of the Software, and to 1005b261ecSmrg * permit persons to whom the Software is furnished to do so, subject to 1105b261ecSmrg * the following conditions: 12f7df2e56Smrg * 1305b261ecSmrg * The above copyright notice and this permission notice shall be included 1405b261ecSmrg * in all copies or substantial portions of the Software. 15f7df2e56Smrg * 1605b261ecSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1705b261ecSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1805b261ecSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1905b261ecSmrg * IN NO EVENT SHALL HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY CLAIM, 2005b261ecSmrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 2105b261ecSmrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 2205b261ecSmrg * THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23f7df2e56Smrg * 2405b261ecSmrg * Except as contained in this notice, the name of the Hewlett-Packard 2505b261ecSmrg * Company shall not be used in advertising or otherwise to promote the 2605b261ecSmrg * sale, use or other dealings in this Software without prior written 2705b261ecSmrg * authorization from the Hewlett-Packard Company. 28f7df2e56Smrg * 2905b261ecSmrg * Header file for DIX-related DBE 3005b261ecSmrg * 3105b261ecSmrg *****************************************************************************/ 3205b261ecSmrg 3305b261ecSmrg#ifndef DBE_STRUCT_H 3405b261ecSmrg#define DBE_STRUCT_H 3505b261ecSmrg 3605b261ecSmrg/* INCLUDES */ 3705b261ecSmrg 3805b261ecSmrg#define NEED_DBE_PROTOCOL 39684baedfSmrg#include <X11/extensions/dbeproto.h> 4005b261ecSmrg#include "windowstr.h" 414642e01fSmrg#include "privates.h" 4205b261ecSmrg 43f7df2e56Smrgtypedef struct { 44f7df2e56Smrg VisualID visual; /* one visual ID that supports double-buffering */ 45f7df2e56Smrg int depth; /* depth of visual in bits */ 46f7df2e56Smrg int perflevel; /* performance level of visual */ 47f7df2e56Smrg} XdbeVisualInfo; 48f7df2e56Smrg 49f7df2e56Smrgtypedef struct { 50f7df2e56Smrg int count; /* number of items in visual_depth */ 51f7df2e56Smrg XdbeVisualInfo *visinfo; /* list of visuals & depths for scrn */ 52f7df2e56Smrg} XdbeScreenVisualInfo; 5305b261ecSmrg 5405b261ecSmrg/* DEFINES */ 5505b261ecSmrg 564642e01fSmrg#define DBE_SCREEN_PRIV(pScreen) ((DbeScreenPrivPtr) \ 574642e01fSmrg dixLookupPrivate(&(pScreen)->devPrivates, dbeScreenPrivKey)) 5805b261ecSmrg 5905b261ecSmrg#define DBE_SCREEN_PRIV_FROM_DRAWABLE(pDrawable) \ 6005b261ecSmrg DBE_SCREEN_PRIV((pDrawable)->pScreen) 6105b261ecSmrg 6205b261ecSmrg#define DBE_SCREEN_PRIV_FROM_WINDOW_PRIV(pDbeWindowPriv) \ 6305b261ecSmrg DBE_SCREEN_PRIV((pDbeWindowPriv)->pWindow->drawable.pScreen) 6405b261ecSmrg 6505b261ecSmrg#define DBE_SCREEN_PRIV_FROM_WINDOW(pWindow) \ 6605b261ecSmrg DBE_SCREEN_PRIV((pWindow)->drawable.pScreen) 6705b261ecSmrg 6805b261ecSmrg#define DBE_SCREEN_PRIV_FROM_PIXMAP(pPixmap) \ 6905b261ecSmrg DBE_SCREEN_PRIV((pPixmap)->drawable.pScreen) 7005b261ecSmrg 7105b261ecSmrg#define DBE_SCREEN_PRIV_FROM_GC(pGC)\ 7205b261ecSmrg DBE_SCREEN_PRIV((pGC)->pScreen) 7305b261ecSmrg 744642e01fSmrg#define DBE_WINDOW_PRIV(pWin) ((DbeWindowPrivPtr) \ 754642e01fSmrg dixLookupPrivate(&(pWin)->devPrivates, dbeWindowPrivKey)) 7605b261ecSmrg 7705b261ecSmrg/* Initial size of the buffer ID array in the window priv. */ 7805b261ecSmrg#define DBE_INIT_MAX_IDS 2 7905b261ecSmrg 8005b261ecSmrg/* Reallocation increment for the buffer ID array. */ 8105b261ecSmrg#define DBE_INCR_MAX_IDS 4 8205b261ecSmrg 8305b261ecSmrg/* Marker for free elements in the buffer ID array. */ 8405b261ecSmrg#define DBE_FREE_ID_ELEMENT 0 8505b261ecSmrg 8605b261ecSmrg/* TYPEDEFS */ 8705b261ecSmrg 8805b261ecSmrg/* Record used to pass swap information between DIX and DDX swapping 8905b261ecSmrg * procedures. 9005b261ecSmrg */ 91f7df2e56Smrgtypedef struct _DbeSwapInfoRec { 92f7df2e56Smrg WindowPtr pWindow; 93f7df2e56Smrg unsigned char swapAction; 9405b261ecSmrg 9505b261ecSmrg} DbeSwapInfoRec, *DbeSwapInfoPtr; 9605b261ecSmrg 9705b261ecSmrg/* 9805b261ecSmrg ****************************************************************************** 9905b261ecSmrg ** Per-window data 10005b261ecSmrg ****************************************************************************** 10105b261ecSmrg */ 10205b261ecSmrg 103f7df2e56Smrgtypedef struct _DbeWindowPrivRec { 10405b261ecSmrg /* A pointer to the window with which the DBE window private (buffer) is 10505b261ecSmrg * associated. 10605b261ecSmrg */ 107f7df2e56Smrg WindowPtr pWindow; 10805b261ecSmrg 10905b261ecSmrg /* Last known swap action for this buffer. Legal values for this field 11005b261ecSmrg * are XdbeUndefined, XdbeBackground, XdbeUntouched, and XdbeCopied. 11105b261ecSmrg */ 112f7df2e56Smrg unsigned char swapAction; 11305b261ecSmrg 11405b261ecSmrg /* Last known buffer size. 11505b261ecSmrg */ 116f7df2e56Smrg unsigned short width, height; 11705b261ecSmrg 11805b261ecSmrg /* Coordinates used for static gravity when the window is positioned. 11905b261ecSmrg */ 120f7df2e56Smrg short x, y; 12105b261ecSmrg 12205b261ecSmrg /* Number of XIDs associated with this buffer. 12305b261ecSmrg */ 124f7df2e56Smrg int nBufferIDs; 12505b261ecSmrg 12605b261ecSmrg /* Capacity of the current buffer ID array, IDs. */ 127f7df2e56Smrg int maxAvailableIDs; 12805b261ecSmrg 12905b261ecSmrg /* Pointer to the array of buffer IDs. This initially points to initIDs. 13005b261ecSmrg * When the static limit of the initIDs array is reached, the array is 13105b261ecSmrg * reallocated and this pointer is set to the new array instead of initIDs. 13205b261ecSmrg */ 133f7df2e56Smrg XID *IDs; 13405b261ecSmrg 13505b261ecSmrg /* Initial array of buffer IDs. We are defining the XID array within the 13605b261ecSmrg * window priv to optimize for data locality. In most cases, only one 13705b261ecSmrg * buffer will be associated with a window. Having the array declared 13805b261ecSmrg * here can prevent us from accessing the data in another memory page, 13905b261ecSmrg * possibly resulting in a page swap and loss of performance. Initially we 14005b261ecSmrg * will use this array to store buffer IDs. For situations where we have 14105b261ecSmrg * more IDs than can fit in this static array, we will allocate a larger 142f7df2e56Smrg * array to use, possibly suffering a performance loss. 143f7df2e56Smrg */ 144f7df2e56Smrg XID initIDs[DBE_INIT_MAX_IDS]; 145f7df2e56Smrg 146f7df2e56Smrg /* Pointer to a drawable that contains the contents of the back buffer. 14705b261ecSmrg */ 148f7df2e56Smrg PixmapPtr pBackBuffer; 149f7df2e56Smrg 150f7df2e56Smrg /* Pointer to a drawable that contains the contents of the front buffer. 151f7df2e56Smrg * This pointer is only used for the XdbeUntouched swap action. For that 152f7df2e56Smrg * swap action, we need to copy the front buffer (window) contents into 153f7df2e56Smrg * this drawable, copy the contents of current back buffer drawable (the 154f7df2e56Smrg * back buffer) into the window, swap the front and back drawable pointers, 155f7df2e56Smrg * and then swap the drawable/resource associations in the resource 156f7df2e56Smrg * database. 157f7df2e56Smrg */ 158f7df2e56Smrg PixmapPtr pFrontBuffer; 15905b261ecSmrg 16005b261ecSmrg /* Device-specific private information. 16105b261ecSmrg */ 162f7df2e56Smrg PrivateRec *devPrivates; 16305b261ecSmrg 16405b261ecSmrg} DbeWindowPrivRec, *DbeWindowPrivPtr; 16505b261ecSmrg 16605b261ecSmrg/* 16705b261ecSmrg ****************************************************************************** 16805b261ecSmrg ** Per-screen data 16905b261ecSmrg ****************************************************************************** 17005b261ecSmrg */ 17105b261ecSmrg 172f7df2e56Smrgtypedef struct _DbeScreenPrivRec { 17305b261ecSmrg /* Wrapped functions 1745a112b11Smrg * It is the responsibility of the DDX layer to wrap PositionWindow(). 17505b261ecSmrg * DbeExtensionInit wraps DestroyWindow(). 17605b261ecSmrg */ 17705b261ecSmrg PositionWindowProcPtr PositionWindow; 178f7df2e56Smrg DestroyWindowProcPtr DestroyWindow; 17905b261ecSmrg 18005b261ecSmrg /* Per-screen DIX routines */ 181f7df2e56Smrg Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ , 182f7df2e56Smrg GCPtr /*pGC */ 183f7df2e56Smrg ); 18405b261ecSmrg 18505b261ecSmrg /* Per-screen DDX routines */ 186f7df2e56Smrg Bool (*GetVisualInfo) (ScreenPtr /*pScreen */ , 187f7df2e56Smrg XdbeScreenVisualInfo * /*pVisInfo */ 188f7df2e56Smrg ); 189f7df2e56Smrg int (*AllocBackBufferName) (WindowPtr /*pWin */ , 190f7df2e56Smrg XID /*bufId */ , 191f7df2e56Smrg int /*swapAction */ 192f7df2e56Smrg ); 193f7df2e56Smrg int (*SwapBuffers) (ClientPtr /*client */ , 194f7df2e56Smrg int * /*pNumWindows */ , 195f7df2e56Smrg DbeSwapInfoPtr /*swapInfo */ 196f7df2e56Smrg ); 197f7df2e56Smrg void (*WinPrivDelete) (DbeWindowPrivPtr /*pDbeWindowPriv */ , 198f7df2e56Smrg XID /*bufId */ 199f7df2e56Smrg ); 20005b261ecSmrg} DbeScreenPrivRec, *DbeScreenPrivPtr; 20105b261ecSmrg 202f7df2e56Smrg#endif /* DBE_STRUCT_H */ 203