VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.9.0/xf86VGAarbiterPriv.h

最後變更 在這個檔案是 32163,由 vboxsync 提交於 14 年 前

Additions/x11/x11include: additional headers for building drivers for X.Org Server 1.9

  • 屬性 svn:eol-style 設為 native
檔案大小: 11.1 KB
 
1/*
2 * Copyright (c) 2009 Tiago Vignatti
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 *
25 */
26
27#ifdef HAVE_XORG_CONFIG_H
28#include <xorg-config.h>
29#endif
30
31#include "misc.h"
32#include "xf86.h"
33#include "xf86_OSproc.h"
34#include <X11/X.h>
35#include "colormapst.h"
36#include "scrnintstr.h"
37#include "screenint.h"
38#include "gcstruct.h"
39#include "pixmapstr.h"
40#include "pixmap.h"
41#include "windowstr.h"
42#include "window.h"
43#include "xf86str.h"
44#include "mipointer.h"
45#include "mipointrst.h"
46# include "picturestr.h"
47
48
49#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
50
51#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
52
53#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
54 dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
55
56#define SCREEN_EPILOG(x,y) pScreen->x = y;
57
58#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
59 ps->x = y;}
60
61#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
62
63#define PICTURE_PROLOGUE(field) ps->field = \
64 ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
65 VGAarbiterScreenKey))->field
66
67#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
68
69#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
70
71#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
72
73#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
74 (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
75 miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
76 ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
77 VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
78
79#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
80 PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
81
82#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
83 PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
84 } while (0)
85
86#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
87
88#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
89 pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
90 (x)->funcs = &VGAarbiterGCFuncs;
91
92#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
93 (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
94 (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
95
96#define GC_SCREEN register ScrnInfoPtr pScrn = \
97 xf86Screens[pGC->pScreen->myNum]
98
99#define VGAGet(x)\
100 pci_device_vgaarb_set_target(xf86Screens[pScreen->myNum]->vgaDev); \
101 pci_device_vgaarb_lock();
102
103#define VGAGet_GC(x)\
104 pci_device_vgaarb_set_target(xf86Screens[pGC->pScreen->myNum]->vgaDev); \
105 pci_device_vgaarb_lock();
106
107#define VGAPut(x)\
108 pci_device_vgaarb_unlock();
109
110#define VGAPut_GC(x)\
111 pci_device_vgaarb_unlock();
112
113
114typedef struct _VGAarbiterScreen {
115 CreateGCProcPtr CreateGC;
116 CloseScreenProcPtr CloseScreen;
117 ScreenBlockHandlerProcPtr BlockHandler;
118 ScreenWakeupHandlerProcPtr WakeupHandler;
119 GetImageProcPtr GetImage;
120 GetSpansProcPtr GetSpans;
121 SourceValidateProcPtr SourceValidate;
122 CopyWindowProcPtr CopyWindow;
123 ClearToBackgroundProcPtr ClearToBackground;
124 CreatePixmapProcPtr CreatePixmap;
125 SaveScreenProcPtr SaveScreen;
126 /* Colormap */
127 StoreColorsProcPtr StoreColors;
128 /* Cursor */
129 DisplayCursorProcPtr DisplayCursor;
130 RealizeCursorProcPtr RealizeCursor;
131 UnrealizeCursorProcPtr UnrealizeCursor;
132 RecolorCursorProcPtr RecolorCursor;
133 SetCursorPositionProcPtr SetCursorPosition;
134 void (*AdjustFrame)(int,int,int,int);
135 Bool (*SwitchMode)(int, DisplayModePtr,int);
136 Bool (*EnterVT)(int, int);
137 void (*LeaveVT)(int, int);
138 void (*FreeScreen)(int, int);
139 miPointerSpriteFuncPtr miSprite;
140 CompositeProcPtr Composite;
141 GlyphsProcPtr Glyphs;
142 CompositeRectsProcPtr CompositeRects;
143} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
144
145typedef struct _VGAarbiterGC {
146 GCOps *wrapOps;
147 GCFuncs *wrapFuncs;
148} VGAarbiterGCRec, *VGAarbiterGCPtr;
149
150/* Screen funcs */
151static void VGAarbiterBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask);
152static void VGAarbiterWakeupHandler(int i, pointer blockData, unsigned long result, pointer pReadmask);
153static Bool VGAarbiterCloseScreen (int i, ScreenPtr pScreen);
154static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w,
155 int h, unsigned int format, unsigned long planemask, char *pdstLine);
156static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr
157 ppt, int *pwidth, int nspans, char *pdstStart);
158static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y,
159 int width, int height);
160static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
161 RegionPtr prgnSrc);
162static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w,
163 int h, Bool generateExposures);
164static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
165 int depth, unsigned int usage_hint);
166static Bool VGAarbiterCreateGC(GCPtr pGC);
167static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
168static void VGAarbiterStoreColors (ColormapPtr pmap, int ndef, xColorItem
169 *pdefs);
170static void VGAarbiterRecolorCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
171 CursorPtr pCurs, Bool displayed);
172static Bool VGAarbiterRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
173 CursorPtr pCursor);
174static Bool VGAarbiterUnrealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
175 CursorPtr pCursor);
176static Bool VGAarbiterDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
177 CursorPtr pCursor);
178static Bool VGAarbiterSetCursorPosition (DeviceIntPtr pDev, ScreenPtr
179 pScreen, int x, int y, Bool generateEvent);
180static void VGAarbiterAdjustFrame(int index, int x, int y, int flags);
181static Bool VGAarbiterSwitchMode(int index, DisplayModePtr mode, int flags);
182static Bool VGAarbiterEnterVT(int index, int flags);
183static void VGAarbiterLeaveVT(int index, int flags);
184static void VGAarbiterFreeScreen(int index, int flags);
185
186/* GC funcs */
187static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
188 DrawablePtr pDraw);
189static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
190static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
191static void VGAarbiterDestroyGC(GCPtr pGC);
192static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
193 int nrects);
194static void VGAarbiterDestroyClip(GCPtr pGC);
195static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
196
197/* GC ops */
198static void VGAarbiterFillSpans( DrawablePtr pDraw, GC *pGC, int nInit,
199 DDXPointPtr pptInit, int *pwidthInit, int fSorted);
200static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
201 register DDXPointPtr ppt, int *pwidth, int nspans, int fSorted);
202static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth,
203 int x, int y, int w, int h, int leftPad, int format, char *pImage);
204static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
205 GC *pGC, int srcx, int srcy, int width, int height, int dstx, int dsty);
206static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
207 GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty,
208 unsigned long bitPlane);
209static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode,
210 int npt, xPoint *pptInit);
211static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode,
212 int npt, DDXPointPtr pptInit);
213static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
214 xSegment *pSeg);
215static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
216 int nRectsInit, xRectangle *pRectsInit);
217static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
218 xArc *parcs);
219static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
220 int mode, int count, DDXPointPtr ptsIn);
221static void VGAarbiterPolyFillRect( DrawablePtr pDraw, GCPtr pGC,
222 int nrectFill, xRectangle *prectInit);
223static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
224 xArc *parcs);
225static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
226 int count, char *chars);
227static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
228 int count, unsigned short *chars);
229static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
230 int count, char *chars);
231static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
232 int count, unsigned short *chars);
233static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
234 int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
235static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
236 int yInit, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase);
237static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
238 pDraw, int dx, int dy, int xOrg, int yOrg);
239
240/* miSpriteFuncs */
241static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
242 pScreen, CursorPtr pCur);
243static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
244 pScreen, CursorPtr pCur);
245static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
246 CursorPtr pCur, int x, int y);
247static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
248 int x, int y);
249static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
250static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
251
252
253static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
254 PicturePtr pDst, INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
255 INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
256static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
257 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist, GlyphListPtr
258 list, GlyphPtr *glyphs);
259static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor
260 *color, int nRect, xRectangle *rects);
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette