diff options
Diffstat (limited to 'saa/saa_priv.h')
-rw-r--r-- | saa/saa_priv.h | 279 |
1 files changed, 279 insertions, 0 deletions
diff --git a/saa/saa_priv.h b/saa/saa_priv.h new file mode 100644 index 0000000..6652054 --- /dev/null +++ b/saa/saa_priv.h | |||
@@ -0,0 +1,279 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2000 Keith Packard, member of The XFree86 Project, Inc. | ||
4 | * 2005 Zack Rusin, Trolltech | ||
5 | * Copyright 2011 VMWare, inc. All rights reserved. | ||
6 | * | ||
7 | * Permission to use, copy, modify, distribute, and sell this software and its | ||
8 | * documentation for any purpose is hereby granted without fee, provided that | ||
9 | * the above copyright notice appear in all copies and that both that | ||
10 | * copyright notice and this permission notice appear in supporting | ||
11 | * documentation, and that the name of Keith Packard not be used in | ||
12 | * advertising or publicity pertaining to distribution of the software without | ||
13 | * specific, written prior permission. Keith Packard makes no | ||
14 | * representations about the suitability of this software for any purpose. It | ||
15 | * is provided "as is" without express or implied warranty. | ||
16 | * | ||
17 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS | ||
18 | * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
19 | * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY | ||
20 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
21 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN | ||
22 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING | ||
23 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
24 | * SOFTWARE. | ||
25 | * | ||
26 | * Authors: Based on exa_priv.h | ||
27 | * Authors: Thomas Hellstrom <thellstrom@vmware.com> | ||
28 | */ | ||
29 | |||
30 | #ifndef _SAA_PRIV_H | ||
31 | #define _SAA_PRIV_H | ||
32 | |||
33 | #ifdef HAVE_CONFIG_H | ||
34 | #include <config.h> | ||
35 | #endif | ||
36 | #ifdef HAVE_DIX_CONFIG_H | ||
37 | #include <dix-config.h> | ||
38 | #else | ||
39 | #include <xorg-server.h> | ||
40 | #endif | ||
41 | #include "xf86.h" | ||
42 | |||
43 | #include "saa.h" | ||
44 | |||
45 | #include <X11/X.h> | ||
46 | #include <X11/Xproto.h> | ||
47 | #include "scrnintstr.h" | ||
48 | #include "pixmapstr.h" | ||
49 | #include "windowstr.h" | ||
50 | #include "servermd.h" | ||
51 | #include "mibstore.h" | ||
52 | #include "colormapst.h" | ||
53 | #include "gcstruct.h" | ||
54 | #include "input.h" | ||
55 | #include "mipointer.h" | ||
56 | #include "mi.h" | ||
57 | #include "dix.h" | ||
58 | #include "fb.h" | ||
59 | #ifdef RENDER | ||
60 | #include "glyphstr.h" | ||
61 | #endif | ||
62 | #include "damage.h" | ||
63 | |||
64 | #define SAA_INVALID_ADDRESS \ | ||
65 | ((void *) ((unsigned long) 0xFFFFFFFF - 1024*1024)) | ||
66 | |||
67 | struct saa_gc_priv { | ||
68 | /* GC values from the layer below. */ | ||
69 | GCOps *saved_ops; | ||
70 | GCFuncs *saved_funcs; | ||
71 | }; | ||
72 | |||
73 | struct saa_screen_priv { | ||
74 | struct saa_driver *driver; | ||
75 | CreateGCProcPtr saved_CreateGC; | ||
76 | CloseScreenProcPtr saved_CloseScreen; | ||
77 | GetImageProcPtr saved_GetImage; | ||
78 | GetSpansProcPtr saved_GetSpans; | ||
79 | CreatePixmapProcPtr saved_CreatePixmap; | ||
80 | DestroyPixmapProcPtr saved_DestroyPixmap; | ||
81 | CopyWindowProcPtr saved_CopyWindow; | ||
82 | ChangeWindowAttributesProcPtr saved_ChangeWindowAttributes; | ||
83 | BitmapToRegionProcPtr saved_BitmapToRegion; | ||
84 | ModifyPixmapHeaderProcPtr saved_ModifyPixmapHeader; | ||
85 | #ifdef RENDER | ||
86 | CompositeProcPtr saved_Composite; | ||
87 | CompositeRectsProcPtr saved_CompositeRects; | ||
88 | TrianglesProcPtr saved_Triangles; | ||
89 | GlyphsProcPtr saved_Glyphs; | ||
90 | TrapezoidsProcPtr saved_Trapezoids; | ||
91 | AddTrapsProcPtr saved_AddTraps; | ||
92 | UnrealizeGlyphProcPtr saved_UnrealizeGlyph; | ||
93 | SourceValidateProcPtr saved_SourceValidate; | ||
94 | #endif | ||
95 | Bool fallback_debug; | ||
96 | |||
97 | unsigned int fallback_count; | ||
98 | |||
99 | RegionRec srcReg; | ||
100 | RegionRec maskReg; | ||
101 | DrawablePtr srcDraw; | ||
102 | }; | ||
103 | |||
104 | extern GCOps saa_gc_ops; | ||
105 | |||
106 | #if DEBUG_TRACE_FALL | ||
107 | #define SAA_FALLBACK(x) \ | ||
108 | do { \ | ||
109 | ErrorF("SAA fallback at %s: ", __FUNCTION__); \ | ||
110 | ErrorF x; \ | ||
111 | } while (0) | ||
112 | |||
113 | #define saa_drawable_location() ("u") | ||
114 | #else | ||
115 | #define SAA_FALLBACK(x) | ||
116 | #endif | ||
117 | |||
118 | /* | ||
119 | * Some macros to deal with function wrapping. | ||
120 | */ | ||
121 | #define saa_wrap(priv, real, mem, func) {\ | ||
122 | (priv)->saved_##mem = (real)->mem; \ | ||
123 | (real)->mem = func; \ | ||
124 | } | ||
125 | |||
126 | #define saa_unwrap(priv, real, mem) {\ | ||
127 | (real)->mem = (priv)->saved_##mem; \ | ||
128 | } | ||
129 | |||
130 | #define saa_swap(priv, real, mem) {\ | ||
131 | void *tmp = (priv)->saved_##mem; \ | ||
132 | (priv)->saved_##mem = (real)->mem; \ | ||
133 | (real)->mem = tmp; \ | ||
134 | } | ||
135 | |||
136 | #if (GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) >= 8) | ||
137 | #define SAA_DEVPRIVATEKEYREC 1 | ||
138 | |||
139 | extern DevPrivateKeyRec saa_screen_index; | ||
140 | extern DevPrivateKeyRec saa_pixmap_index; | ||
141 | extern DevPrivateKeyRec saa_gc_index; | ||
142 | |||
143 | static inline struct saa_screen_priv * | ||
144 | saa_screen(ScreenPtr screen) | ||
145 | { | ||
146 | return (struct saa_screen_priv *)dixGetPrivate(&screen->devPrivates, | ||
147 | &saa_screen_index); | ||
148 | } | ||
149 | |||
150 | static inline struct saa_gc_priv * | ||
151 | saa_gc(GCPtr gc) | ||
152 | { | ||
153 | return (struct saa_gc_priv *)dixGetPrivateAddr(&gc->devPrivates, | ||
154 | &saa_gc_index); | ||
155 | } | ||
156 | |||
157 | static inline struct saa_pixmap * | ||
158 | saa_pixmap(PixmapPtr pix) | ||
159 | { | ||
160 | return (struct saa_pixmap *)dixGetPrivateAddr(&pix->devPrivates, | ||
161 | &saa_pixmap_index); | ||
162 | } | ||
163 | #else | ||
164 | #undef SAA_DEVPRIVATEKEYREC | ||
165 | extern int saa_screen_index; | ||
166 | extern int saa_pixmap_index; | ||
167 | extern int saa_gc_index; | ||
168 | |||
169 | static inline struct saa_screen_priv * | ||
170 | saa_screen(ScreenPtr screen) | ||
171 | { | ||
172 | return (struct saa_screen_priv *)dixLookupPrivate(&screen->devPrivates, | ||
173 | &saa_screen_index); | ||
174 | } | ||
175 | |||
176 | static inline struct saa_gc_priv * | ||
177 | saa_gc(GCPtr gc) | ||
178 | { | ||
179 | return (struct saa_gc_priv *)dixLookupPrivateAddr(&gc->devPrivates, | ||
180 | &saa_gc_index); | ||
181 | } | ||
182 | |||
183 | static inline struct saa_pixmap * | ||
184 | saa_pixmap(PixmapPtr pix) | ||
185 | { | ||
186 | return (struct saa_pixmap *)dixLookupPrivateAddr(&pix->devPrivates, | ||
187 | &saa_pixmap_index); | ||
188 | } | ||
189 | |||
190 | #endif | ||
191 | |||
192 | extern void | ||
193 | saa_check_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int nspans, | ||
194 | DDXPointPtr ppt, int *pwidth, int fSorted); | ||
195 | extern void | ||
196 | saa_check_poly_fill_rect(DrawablePtr pDrawable, GCPtr pGC, | ||
197 | int nrect, xRectangle * prect); | ||
198 | extern RegionPtr | ||
199 | saa_check_copy_area(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, | ||
200 | int srcx, int srcy, int w, int h, int dstx, int dsty); | ||
201 | extern void | ||
202 | saa_check_copy_nton(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, | ||
203 | BoxPtr pbox, int nbox, int dx, int dy, Bool reverse, | ||
204 | Bool upsidedown, Pixel bitplane, void *closure); | ||
205 | |||
206 | extern void | ||
207 | saa_unaccel_setup(ScreenPtr pScreen); | ||
208 | |||
209 | extern void | ||
210 | saa_unaccel_takedown(ScreenPtr pScreen); | ||
211 | |||
212 | extern RegionPtr | ||
213 | saa_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, | ||
214 | int srcx, int srcy, int width, int height, int dstx, int dsty); | ||
215 | |||
216 | extern Bool | ||
217 | saa_hw_copy_nton(DrawablePtr pSrcDrawable, | ||
218 | DrawablePtr pDstDrawable, | ||
219 | GCPtr pGC, | ||
220 | BoxPtr pbox, | ||
221 | int nbox, int dx, int dy, Bool reverse, Bool upsidedown); | ||
222 | |||
223 | #ifdef RENDER | ||
224 | extern void | ||
225 | saa_render_setup(ScreenPtr pScreen); | ||
226 | |||
227 | extern void | ||
228 | saa_render_takedown(ScreenPtr pScreen); | ||
229 | |||
230 | |||
231 | extern void | ||
232 | saa_check_composite(CARD8 op, | ||
233 | PicturePtr pSrc, | ||
234 | PicturePtr pMask, | ||
235 | PicturePtr pDst, | ||
236 | INT16 xSrc, | ||
237 | INT16 ySrc, | ||
238 | INT16 xMask, | ||
239 | INT16 yMask, | ||
240 | INT16 xDst, INT16 yDst, CARD16 width, CARD16 height, | ||
241 | RegionPtr src_region, | ||
242 | RegionPtr mask_region, | ||
243 | RegionPtr dst_region); | ||
244 | #endif | ||
245 | |||
246 | extern Bool | ||
247 | saa_modify_pixmap_header(PixmapPtr pPixmap, int width, int height, int depth, | ||
248 | int bitsPerPixel, int devKind, pointer pPixData); | ||
249 | |||
250 | extern PixmapPtr | ||
251 | saa_create_pixmap(ScreenPtr pScreen, int w, int h, int depth, | ||
252 | unsigned usage_hint); | ||
253 | |||
254 | extern Bool | ||
255 | saa_destroy_pixmap(PixmapPtr pPixmap); | ||
256 | |||
257 | static inline RegionPtr | ||
258 | saa_pix_damage_pending(struct saa_pixmap *spix) | ||
259 | { | ||
260 | return (spix->damage ? DamagePendingRegion(spix->damage) : NULL); | ||
261 | } | ||
262 | |||
263 | extern RegionPtr | ||
264 | saa_boxes_to_region(ScreenPtr pScreen, int nbox, BoxPtr pbox, int ordering); | ||
265 | |||
266 | |||
267 | Bool | ||
268 | saa_compute_composite_regions(ScreenPtr pScreen, | ||
269 | PicturePtr pSrc, | ||
270 | PicturePtr pMask, | ||
271 | PicturePtr pDst, | ||
272 | INT16 xSrc, INT16 ySrc, INT16 xMask, | ||
273 | INT16 yMask, INT16 xDst, | ||
274 | INT16 yDst, INT16 width, INT16 height, | ||
275 | RegionPtr dst_reg, | ||
276 | RegionPtr *src_reg, | ||
277 | RegionPtr *mask_reg); | ||
278 | |||
279 | #endif | ||