1706f2543Smrg 2706f2543Smrg/* 3706f2543Smrg * Copyright (c) 1998-2001 by The XFree86 Project, Inc. 4706f2543Smrg * 5706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining a 6706f2543Smrg * copy of this software and associated documentation files (the "Software"), 7706f2543Smrg * to deal in the Software without restriction, including without limitation 8706f2543Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9706f2543Smrg * and/or sell copies of the Software, and to permit persons to whom the 10706f2543Smrg * Software is furnished to do so, subject to the following conditions: 11706f2543Smrg * 12706f2543Smrg * The above copyright notice and this permission notice shall be included in 13706f2543Smrg * all copies or substantial portions of the Software. 14706f2543Smrg * 15706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16706f2543Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17706f2543Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18706f2543Smrg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19706f2543Smrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20706f2543Smrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21706f2543Smrg * OTHER DEALINGS IN THE SOFTWARE. 22706f2543Smrg * 23706f2543Smrg * Except as contained in this notice, the name of the copyright holder(s) 24706f2543Smrg * and author(s) shall not be used in advertising or otherwise to promote 25706f2543Smrg * the sale, use or other dealings in this Software without prior written 26706f2543Smrg * authorization from the copyright holder(s) and author(s). 27706f2543Smrg */ 28706f2543Smrg 29706f2543Smrg#ifndef _XF86FBMAN_H 30706f2543Smrg#define _XF86FBMAN_H 31706f2543Smrg 32706f2543Smrg 33706f2543Smrg#include "scrnintstr.h" 34706f2543Smrg#include "regionstr.h" 35706f2543Smrg 36706f2543Smrg 37706f2543Smrg#define FAVOR_AREA_THEN_WIDTH 0 38706f2543Smrg#define FAVOR_AREA_THEN_HEIGHT 1 39706f2543Smrg#define FAVOR_WIDTH_THEN_AREA 2 40706f2543Smrg#define FAVOR_HEIGHT_THEN_AREA 3 41706f2543Smrg 42706f2543Smrg#define PRIORITY_LOW 0 43706f2543Smrg#define PRIORITY_NORMAL 1 44706f2543Smrg#define PRIORITY_EXTREME 2 45706f2543Smrg 46706f2543Smrg 47706f2543Smrgtypedef struct _FBArea { 48706f2543Smrg ScreenPtr pScreen; 49706f2543Smrg BoxRec box; 50706f2543Smrg int granularity; 51706f2543Smrg void (*MoveAreaCallback)(struct _FBArea*, struct _FBArea*); 52706f2543Smrg void (*RemoveAreaCallback)(struct _FBArea*); 53706f2543Smrg DevUnion devPrivate; 54706f2543Smrg} FBArea, *FBAreaPtr; 55706f2543Smrg 56706f2543Smrgtypedef struct _FBLinear { 57706f2543Smrg ScreenPtr pScreen; 58706f2543Smrg int size; 59706f2543Smrg int offset; 60706f2543Smrg int granularity; 61706f2543Smrg void (*MoveLinearCallback)(struct _FBLinear*, struct _FBLinear*); 62706f2543Smrg void (*RemoveLinearCallback)(struct _FBLinear*); 63706f2543Smrg DevUnion devPrivate; 64706f2543Smrg} FBLinear, *FBLinearPtr; 65706f2543Smrg 66706f2543Smrgtypedef void (*FreeBoxCallbackProcPtr)(ScreenPtr, RegionPtr, pointer); 67706f2543Smrgtypedef void (*MoveAreaCallbackProcPtr)(FBAreaPtr, FBAreaPtr); 68706f2543Smrgtypedef void (*RemoveAreaCallbackProcPtr)(FBAreaPtr); 69706f2543Smrg 70706f2543Smrgtypedef void (*MoveLinearCallbackProcPtr)(FBLinearPtr, FBLinearPtr); 71706f2543Smrgtypedef void (*RemoveLinearCallbackProcPtr)(FBLinearPtr); 72706f2543Smrg 73706f2543Smrg 74706f2543Smrgtypedef struct { 75706f2543Smrg FBAreaPtr (*AllocateOffscreenArea)( 76706f2543Smrg ScreenPtr pScreen, 77706f2543Smrg int w, int h, 78706f2543Smrg int granularity, 79706f2543Smrg MoveAreaCallbackProcPtr moveCB, 80706f2543Smrg RemoveAreaCallbackProcPtr removeCB, 81706f2543Smrg pointer privData); 82706f2543Smrg void (*FreeOffscreenArea)(FBAreaPtr area); 83706f2543Smrg Bool (*ResizeOffscreenArea)(FBAreaPtr area, int w, int h); 84706f2543Smrg Bool (*QueryLargestOffscreenArea)( 85706f2543Smrg ScreenPtr pScreen, 86706f2543Smrg int *width, int *height, 87706f2543Smrg int granularity, 88706f2543Smrg int preferences, 89706f2543Smrg int priority); 90706f2543Smrg Bool (*RegisterFreeBoxCallback)( 91706f2543Smrg ScreenPtr pScreen, 92706f2543Smrg FreeBoxCallbackProcPtr FreeBoxCallback, 93706f2543Smrg pointer devPriv); 94706f2543Smrg/* linear functions */ 95706f2543Smrg FBLinearPtr (*AllocateOffscreenLinear)( 96706f2543Smrg ScreenPtr pScreen, 97706f2543Smrg int size, 98706f2543Smrg int granularity, 99706f2543Smrg MoveLinearCallbackProcPtr moveCB, 100706f2543Smrg RemoveLinearCallbackProcPtr removeCB, 101706f2543Smrg pointer privData); 102706f2543Smrg void (*FreeOffscreenLinear)(FBLinearPtr area); 103706f2543Smrg Bool (*ResizeOffscreenLinear)(FBLinearPtr area, int size); 104706f2543Smrg Bool (*QueryLargestOffscreenLinear)( 105706f2543Smrg ScreenPtr pScreen, 106706f2543Smrg int *size, 107706f2543Smrg int granularity, 108706f2543Smrg int priority); 109706f2543Smrg Bool (*PurgeOffscreenAreas) (ScreenPtr); 110706f2543Smrg} FBManagerFuncs, *FBManagerFuncsPtr; 111706f2543Smrg 112706f2543Smrg 113706f2543Smrgextern _X_EXPORT Bool xf86RegisterOffscreenManager( 114706f2543Smrg ScreenPtr pScreen, 115706f2543Smrg FBManagerFuncsPtr funcs 116706f2543Smrg); 117706f2543Smrg 118706f2543Smrgextern _X_EXPORT Bool 119706f2543Smrgxf86InitFBManagerRegion( 120706f2543Smrg ScreenPtr pScreen, 121706f2543Smrg RegionPtr ScreenRegion 122706f2543Smrg); 123706f2543Smrg 124706f2543Smrgextern _X_EXPORT Bool 125706f2543Smrgxf86InitFBManagerArea( 126706f2543Smrg ScreenPtr pScreen, 127706f2543Smrg int PixalArea, 128706f2543Smrg int Verbosity 129706f2543Smrg); 130706f2543Smrg 131706f2543Smrgextern _X_EXPORT Bool 132706f2543Smrgxf86InitFBManager( 133706f2543Smrg ScreenPtr pScreen, 134706f2543Smrg BoxPtr FullBox 135706f2543Smrg); 136706f2543Smrg 137706f2543Smrgextern _X_EXPORT Bool 138706f2543Smrgxf86InitFBManagerLinear( 139706f2543Smrg ScreenPtr pScreen, 140706f2543Smrg int offset, 141706f2543Smrg int size 142706f2543Smrg); 143706f2543Smrg 144706f2543Smrgextern _X_EXPORT Bool 145706f2543Smrgxf86FBManagerRunning( 146706f2543Smrg ScreenPtr pScreen 147706f2543Smrg); 148706f2543Smrg 149706f2543Smrgextern _X_EXPORT FBAreaPtr 150706f2543Smrgxf86AllocateOffscreenArea ( 151706f2543Smrg ScreenPtr pScreen, 152706f2543Smrg int w, int h, 153706f2543Smrg int granularity, 154706f2543Smrg MoveAreaCallbackProcPtr moveCB, 155706f2543Smrg RemoveAreaCallbackProcPtr removeCB, 156706f2543Smrg pointer privData 157706f2543Smrg); 158706f2543Smrg 159706f2543Smrgextern _X_EXPORT FBAreaPtr 160706f2543Smrgxf86AllocateLinearOffscreenArea ( 161706f2543Smrg ScreenPtr pScreen, 162706f2543Smrg int length, 163706f2543Smrg int granularity, 164706f2543Smrg MoveAreaCallbackProcPtr moveCB, 165706f2543Smrg RemoveAreaCallbackProcPtr removeCB, 166706f2543Smrg pointer privData 167706f2543Smrg); 168706f2543Smrg 169706f2543Smrgextern _X_EXPORT FBLinearPtr 170706f2543Smrgxf86AllocateOffscreenLinear ( 171706f2543Smrg ScreenPtr pScreen, 172706f2543Smrg int length, 173706f2543Smrg int granularity, 174706f2543Smrg MoveLinearCallbackProcPtr moveCB, 175706f2543Smrg RemoveLinearCallbackProcPtr removeCB, 176706f2543Smrg pointer privData 177706f2543Smrg); 178706f2543Smrg 179706f2543Smrgextern _X_EXPORT void xf86FreeOffscreenArea(FBAreaPtr area); 180706f2543Smrgextern _X_EXPORT void xf86FreeOffscreenLinear(FBLinearPtr area); 181706f2543Smrg 182706f2543Smrgextern _X_EXPORT Bool 183706f2543Smrgxf86ResizeOffscreenArea( 184706f2543Smrg FBAreaPtr resize, 185706f2543Smrg int w, int h 186706f2543Smrg); 187706f2543Smrg 188706f2543Smrgextern _X_EXPORT Bool 189706f2543Smrgxf86ResizeOffscreenLinear( 190706f2543Smrg FBLinearPtr resize, 191706f2543Smrg int size 192706f2543Smrg); 193706f2543Smrg 194706f2543Smrg 195706f2543Smrgextern _X_EXPORT Bool 196706f2543Smrgxf86RegisterFreeBoxCallback( 197706f2543Smrg ScreenPtr pScreen, 198706f2543Smrg FreeBoxCallbackProcPtr FreeBoxCallback, 199706f2543Smrg pointer devPriv 200706f2543Smrg); 201706f2543Smrg 202706f2543Smrgextern _X_EXPORT Bool 203706f2543Smrgxf86PurgeUnlockedOffscreenAreas( 204706f2543Smrg ScreenPtr pScreen 205706f2543Smrg); 206706f2543Smrg 207706f2543Smrg 208706f2543Smrgextern _X_EXPORT Bool 209706f2543Smrgxf86QueryLargestOffscreenArea( 210706f2543Smrg ScreenPtr pScreen, 211706f2543Smrg int *width, int *height, 212706f2543Smrg int granularity, 213706f2543Smrg int preferences, 214706f2543Smrg int priority 215706f2543Smrg); 216706f2543Smrg 217706f2543Smrgextern _X_EXPORT Bool 218706f2543Smrgxf86QueryLargestOffscreenLinear( 219706f2543Smrg ScreenPtr pScreen, 220706f2543Smrg int *size, 221706f2543Smrg int granularity, 222706f2543Smrg int priority 223706f2543Smrg); 224706f2543Smrg 225706f2543Smrg 226706f2543Smrg#endif /* _XF86FBMAN_H */ 227