VirtualBox

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

最後變更 在這個檔案從62425是 45134,由 vboxsync 提交於 12 年 前

Additions/X11: build vboxvideo_drv.so for X.Org Server 1.14.

  • 屬性 svn:eol-style 設為 native
檔案大小: 12.5 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#define WRAP_SCREEN(x,y) {pScreenPriv->x = pScreen->x; pScreen->x = y;}
49
50#define UNWRAP_SCREEN(x) pScreen->x = pScreenPriv->x
51
52#define SCREEN_PROLOG(x) pScreen->x = ((VGAarbiterScreenPtr) \
53 dixLookupPrivate(&(pScreen)->devPrivates, VGAarbiterScreenKey))->x
54
55#define SCREEN_EPILOG(x,y) pScreen->x = y;
56
57#define WRAP_PICT(x,y) if (ps) {pScreenPriv->x = ps->x;\
58 ps->x = y;}
59
60#define UNWRAP_PICT(x) if (ps) {ps->x = pScreenPriv->x;}
61
62#define PICTURE_PROLOGUE(field) ps->field = \
63 ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
64 VGAarbiterScreenKey))->field
65
66#define PICTURE_EPILOGUE(field, wrap) ps->field = wrap
67
68#define WRAP_SCREEN_INFO(x,y) do {pScreenPriv->x = pScrn->x; pScrn->x = y;} while(0)
69
70#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
71
72#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \
73 (miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \
74 miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \
75 ((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
76 VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite;
77
78#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\
79 PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs;
80
81#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
82 PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
83 } while (0)
84
85#define UNWRAP_SPRITE PointPriv->spriteFuncs = pScreenPriv->miSprite
86
87#define GC_WRAP(x) pGCPriv->wrapOps = (x)->ops;\
88 pGCPriv->wrapFuncs = (x)->funcs; (x)->ops = &VGAarbiterGCOps;\
89 (x)->funcs = &VGAarbiterGCFuncs;
90
91#define GC_UNWRAP(x) VGAarbiterGCPtr pGCPriv = \
92 (VGAarbiterGCPtr)dixLookupPrivate(&(x)->devPrivates, VGAarbiterGCKey);\
93 (x)->ops = pGCPriv->wrapOps; (x)->funcs = pGCPriv->wrapFuncs;
94
95static inline void
96VGAGet(ScreenPtr pScreen)
97{
98 pci_device_vgaarb_set_target(xf86ScreenToScrn(pScreen)->vgaDev);
99 pci_device_vgaarb_lock();
100}
101
102static inline void
103VGAPut(void)
104{
105 pci_device_vgaarb_unlock();
106}
107
108typedef struct _VGAarbiterScreen {
109 CreateGCProcPtr CreateGC;
110 CloseScreenProcPtr CloseScreen;
111 ScreenBlockHandlerProcPtr BlockHandler;
112 ScreenWakeupHandlerProcPtr WakeupHandler;
113 GetImageProcPtr GetImage;
114 GetSpansProcPtr GetSpans;
115 SourceValidateProcPtr SourceValidate;
116 CopyWindowProcPtr CopyWindow;
117 ClearToBackgroundProcPtr ClearToBackground;
118 CreatePixmapProcPtr CreatePixmap;
119 SaveScreenProcPtr SaveScreen;
120 /* Colormap */
121 StoreColorsProcPtr StoreColors;
122 /* Cursor */
123 DisplayCursorProcPtr DisplayCursor;
124 RealizeCursorProcPtr RealizeCursor;
125 UnrealizeCursorProcPtr UnrealizeCursor;
126 RecolorCursorProcPtr RecolorCursor;
127 SetCursorPositionProcPtr SetCursorPosition;
128 void (*AdjustFrame) (ScrnInfoPtr, int, int);
129 Bool (*SwitchMode) (ScrnInfoPtr, DisplayModePtr);
130 Bool (*EnterVT) (ScrnInfoPtr);
131 void (*LeaveVT) (ScrnInfoPtr);
132 void (*FreeScreen) (ScrnInfoPtr);
133 miPointerSpriteFuncPtr miSprite;
134 CompositeProcPtr Composite;
135 GlyphsProcPtr Glyphs;
136 CompositeRectsProcPtr CompositeRects;
137} VGAarbiterScreenRec, *VGAarbiterScreenPtr;
138
139typedef struct _VGAarbiterGC {
140 GCOps *wrapOps;
141 GCFuncs *wrapFuncs;
142} VGAarbiterGCRec, *VGAarbiterGCPtr;
143
144/* Screen funcs */
145static void VGAarbiterBlockHandler(ScreenPtr pScreen, pointer pTimeout,
146 pointer pReadmask);
147static void VGAarbiterWakeupHandler(ScreenPtr pScreen,
148 unsigned long result, pointer pReadmask);
149static Bool VGAarbiterCloseScreen(ScreenPtr pScreen);
150static void VGAarbiterGetImage(DrawablePtr pDrawable, int sx, int sy, int w,
151 int h, unsigned int format,
152 unsigned long planemask, char *pdstLine);
153static void VGAarbiterGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
154 int *pwidth, int nspans, char *pdstStart);
155static void VGAarbiterSourceValidate(DrawablePtr pDrawable, int x, int y,
156 int width, int height,
157 unsigned int subWindowMode);
158static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
159 RegionPtr prgnSrc);
160static void VGAarbiterClearToBackground(WindowPtr pWin, int x, int y, int w,
161 int h, Bool generateExposures);
162static PixmapPtr VGAarbiterCreatePixmap(ScreenPtr pScreen, int w, int h,
163 int depth, unsigned int usage_hint);
164static Bool VGAarbiterCreateGC(GCPtr pGC);
165static Bool VGAarbiterSaveScreen(ScreenPtr pScreen, Bool unblank);
166static void VGAarbiterStoreColors(ColormapPtr pmap, int ndef, xColorItem
167 * pdefs);
168static void VGAarbiterRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
169 CursorPtr pCurs, Bool displayed);
170static Bool VGAarbiterRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
171 CursorPtr pCursor);
172static Bool VGAarbiterUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
173 CursorPtr pCursor);
174static Bool VGAarbiterDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
175 CursorPtr pCursor);
176static Bool VGAarbiterSetCursorPosition(DeviceIntPtr pDev, ScreenPtr
177 pScreen, int x, int y,
178 Bool generateEvent);
179static void VGAarbiterAdjustFrame(ScrnInfoPtr pScrn, int x, int y);
180static Bool VGAarbiterSwitchMode(ScrnInfoPtr pScrn, DisplayModePtr mode);
181static Bool VGAarbiterEnterVT(ScrnInfoPtr pScrn);
182static void VGAarbiterLeaveVT(ScrnInfoPtr pScrn);
183static void VGAarbiterFreeScreen(ScrnInfoPtr pScrn);
184
185/* GC funcs */
186static void VGAarbiterValidateGC(GCPtr pGC, unsigned long changes,
187 DrawablePtr pDraw);
188static void VGAarbiterChangeGC(GCPtr pGC, unsigned long mask);
189static void VGAarbiterCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
190static void VGAarbiterDestroyGC(GCPtr pGC);
191static void VGAarbiterChangeClip(GCPtr pGC, int type, pointer pvalue,
192 int nrects);
193static void VGAarbiterDestroyClip(GCPtr pGC);
194static void VGAarbiterCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
195
196/* GC ops */
197static void VGAarbiterFillSpans(DrawablePtr pDraw, GC * pGC, int nInit,
198 DDXPointPtr pptInit, int *pwidthInit,
199 int fSorted);
200static void VGAarbiterSetSpans(DrawablePtr pDraw, GCPtr pGC, char *pcharsrc,
201 register DDXPointPtr ppt, int *pwidth,
202 int nspans, int fSorted);
203static void VGAarbiterPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x,
204 int y, int w, int h, int leftPad, int format,
205 char *pImage);
206static RegionPtr VGAarbiterCopyArea(DrawablePtr pSrc, DrawablePtr pDst,
207 GC * pGC, int srcx, int srcy, int width,
208 int height, int dstx, int dsty);
209static RegionPtr VGAarbiterCopyPlane(DrawablePtr pSrc, DrawablePtr pDst,
210 GCPtr pGC, int srcx, int srcy, int width,
211 int height, int dstx, int dsty,
212 unsigned long bitPlane);
213static void VGAarbiterPolyPoint(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
214 xPoint * pptInit);
215static void VGAarbiterPolylines(DrawablePtr pDraw, GCPtr pGC, int mode, int npt,
216 DDXPointPtr pptInit);
217static void VGAarbiterPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg,
218 xSegment * pSeg);
219static void VGAarbiterPolyRectangle(DrawablePtr pDraw, GCPtr pGC,
220 int nRectsInit, xRectangle *pRectsInit);
221static void VGAarbiterPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
222 xArc * parcs);
223static void VGAarbiterFillPolygon(DrawablePtr pDraw, GCPtr pGC, int shape,
224 int mode, int count, DDXPointPtr ptsIn);
225static void VGAarbiterPolyFillRect(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
226 xRectangle *prectInit);
227static void VGAarbiterPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs,
228 xArc * parcs);
229static int VGAarbiterPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
230 int count, char *chars);
231static int VGAarbiterPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
232 int count, unsigned short *chars);
233static void VGAarbiterImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y,
234 int count, char *chars);
235static void VGAarbiterImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
236 int count, unsigned short *chars);
237static void VGAarbiterImageGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
238 int yInit, unsigned int nglyph,
239 CharInfoPtr * ppci, pointer pglyphBase);
240static void VGAarbiterPolyGlyphBlt(DrawablePtr pDraw, GCPtr pGC, int xInit,
241 int yInit, unsigned int nglyph,
242 CharInfoPtr * ppci, pointer pglyphBase);
243static void VGAarbiterPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr
244 pDraw, int dx, int dy, int xOrg, int yOrg);
245
246/* miSpriteFuncs */
247static Bool VGAarbiterSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr
248 pScreen, CursorPtr pCur);
249static Bool VGAarbiterSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr
250 pScreen, CursorPtr pCur);
251static void VGAarbiterSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
252 CursorPtr pCur, int x, int y);
253static void VGAarbiterSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
254 int x, int y);
255static Bool VGAarbiterDeviceCursorInitialize(DeviceIntPtr pDev,
256 ScreenPtr pScreen);
257static void VGAarbiterDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
258
259static void VGAarbiterComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
260 PicturePtr pDst, INT16 xSrc, INT16 ySrc,
261 INT16 xMask, INT16 yMask, INT16 xDst,
262 INT16 yDst, CARD16 width, CARD16 height);
263static void VGAarbiterGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
264 PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
265 int nlist, GlyphListPtr list, GlyphPtr * glyphs);
266static void VGAarbiterCompositeRects(CARD8 op, PicturePtr pDst,
267 xRenderColor * color, int nRect,
268 xRectangle *rects);
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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