VirtualBox

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

最後變更 在這個檔案從66474是 54163,由 vboxsync 提交於 10 年 前

Additions/x11/vboxvideo: support X.Org Server 1.17 (still untested).

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

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